7#ifndef __OPENCV_RGBD_DEPTH_HPP__
8#define __OPENCV_RGBD_DEPTH_HPP__
10#include <opencv2/core.hpp>
33 isValidDepth(
const double & depth)
39 isValidDepth(
const short int & depth)
76 enum RGBD_NORMALS_METHOD
78 RGBD_NORMALS_METHOD_FALS = 0,
79 RGBD_NORMALS_METHOD_LINEMOD = 1,
80 RGBD_NORMALS_METHOD_SRI = 2
90 method_(RGBD_NORMALS_METHOD_FALS),
103 RgbdNormals(
int rows,
int cols,
int depth, InputArray K,
int window_size = 5,
int method =
104 RgbdNormals::RGBD_NORMALS_METHOD_FALS);
108 CV_WRAP
static Ptr<RgbdNormals> create(
int rows,
int cols,
int depth, InputArray K,
int window_size = 5,
int method =
109 RgbdNormals::RGBD_NORMALS_METHOD_FALS);
116 operator()(InputArray points,
OutputArray normals)
const;
124 CV_WRAP
int getRows()
const
128 CV_WRAP
void setRows(
int val)
132 CV_WRAP
int getCols()
const
136 CV_WRAP
void setCols(
int val)
140 CV_WRAP
int getWindowSize()
const
144 CV_WRAP
void setWindowSize(
int val)
148 CV_WRAP
int getDepth()
const
152 CV_WRAP
void setDepth(
int val)
160 CV_WRAP
void setK(
const cv::Mat &val)
164 CV_WRAP
int getMethod()
const
168 CV_WRAP
void setMethod(
int val)
175 initialize_normals_impl(
int rows,
int cols,
int depth,
const Mat & K,
int window_size,
int method)
const;
177 int rows_, cols_, depth_;
181 mutable void* rgbd_normals_impl_;
202 method_(DEPTH_CLEANER_NIL),
203 depth_cleaner_impl_(0)
212 DepthCleaner(
int depth,
int window_size = 5,
int method = DepthCleaner::DEPTH_CLEANER_NIL);
216 CV_WRAP
static Ptr<DepthCleaner> create(
int depth,
int window_size = 5,
int method = DepthCleaner::DEPTH_CLEANER_NIL);
223 operator()(InputArray points,
OutputArray depth)
const;
231 CV_WRAP
int getWindowSize()
const
235 CV_WRAP
void setWindowSize(
int val)
239 CV_WRAP
int getDepth()
const
243 CV_WRAP
void setDepth(
int val)
247 CV_WRAP
int getMethod()
const
251 CV_WRAP
void setMethod(
int val)
258 initialize_cleaner_impl()
const;
263 mutable void* depth_cleaner_impl_;
287 registerDepth(InputArray unregisteredCameraMatrix, InputArray registeredCameraMatrix, InputArray registeredDistCoeffs,
288 InputArray Rt, InputArray unregisteredDepth,
const Size& outputImagePlaneSize,
289 OutputArray registeredDepth,
bool depthDilation=
false);
332 enum RGBD_PLANE_METHOD
334 RGBD_PLANE_METHOD_DEFAULT
337 RgbdPlane(
int method = RgbdPlane::RGBD_PLANE_METHOD_DEFAULT)
341 min_size_(block_size_*block_size_),
359 int min_size,
double threshold,
double sensor_error_a = 0,
360 double sensor_error_b = 0,
double sensor_error_c = 0);
365 double sensor_error_a = 0,
double sensor_error_b = 0,
366 double sensor_error_c = 0);
377 operator()(InputArray points3d, InputArray normals,
OutputArray mask,
389 CV_WRAP
int getBlockSize()
const
393 CV_WRAP
void setBlockSize(
int val)
397 CV_WRAP
int getMinSize()
const
401 CV_WRAP
void setMinSize(
int val)
405 CV_WRAP
int getMethod()
const
409 CV_WRAP
void setMethod(
int val)
413 CV_WRAP
double getThreshold()
const
417 CV_WRAP
void setThreshold(
double val)
421 CV_WRAP
double getSensorErrorA()
const
423 return sensor_error_a_;
425 CV_WRAP
void setSensorErrorA(
double val)
427 sensor_error_a_ = val;
429 CV_WRAP
double getSensorErrorB()
const
431 return sensor_error_b_;
433 CV_WRAP
void setSensorErrorB(
double val)
435 sensor_error_b_ = val;
437 CV_WRAP
double getSensorErrorC()
const
439 return sensor_error_c_;
441 CV_WRAP
void setSensorErrorC(
double val)
443 sensor_error_c_ = val;
456 double sensor_error_a_, sensor_error_b_, sensor_error_c_;
494 CACHE_SRC = 1, CACHE_DST = 2, CACHE_ALL = CACHE_SRC + CACHE_DST
503 release() CV_OVERRIDE;
508 CV_PROP std::vector<Mat> pyramidImage;
509 CV_PROP std::vector<Mat> pyramidDepth;
510 CV_PROP std::vector<Mat> pyramidMask;
512 CV_PROP std::vector<Mat> pyramidCloud;
514 CV_PROP std::vector<Mat> pyramid_dI_dx;
515 CV_PROP std::vector<Mat> pyramid_dI_dy;
516 CV_PROP std::vector<Mat> pyramidTexturedMask;
518 CV_PROP std::vector<Mat> pyramidNormals;
519 CV_PROP std::vector<Mat> pyramidNormalsMask;
531 ROTATION = 1, TRANSLATION = 2, RIGID_BODY_MOTION = 4
534 CV_WRAP
static inline float
539 CV_WRAP
static inline float
544 CV_WRAP
static inline float
545 DEFAULT_MAX_DEPTH_DIFF()
549 CV_WRAP
static inline float
550 DEFAULT_MAX_POINTS_PART()
554 CV_WRAP
static inline float
555 DEFAULT_MAX_TRANSLATION()
559 CV_WRAP
static inline float
560 DEFAULT_MAX_ROTATION()
601 CV_WRAP
static Ptr<Odometry> create(
const String & odometryType);
604 CV_WRAP
virtual cv::Mat getCameraMatrix()
const = 0;
606 CV_WRAP
virtual void setCameraMatrix(
const cv::Mat &val) = 0;
608 CV_WRAP
virtual int getTransformType()
const = 0;
610 CV_WRAP
virtual void setTransformType(
int val) = 0;
614 checkParams()
const = 0;
618 const Mat& initRt)
const = 0;
640 RgbdOdometry(
const Mat& cameraMatrix,
float minDepth = Odometry::DEFAULT_MIN_DEPTH(),
float maxDepth = Odometry::DEFAULT_MAX_DEPTH(),
641 float maxDepthDiff = Odometry::DEFAULT_MAX_DEPTH_DIFF(),
const std::vector<int>& iterCounts = std::vector<int>(),
642 const std::vector<float>& minGradientMagnitudes = std::vector<float>(),
float maxPointsPart = Odometry::DEFAULT_MAX_POINTS_PART(),
643 int transformType = Odometry::RIGID_BODY_MOTION);
645 CV_WRAP
static Ptr<RgbdOdometry> create(
const Mat& cameraMatrix =
Mat(),
float minDepth = Odometry::DEFAULT_MIN_DEPTH(),
float maxDepth = Odometry::DEFAULT_MAX_DEPTH(),
646 float maxDepthDiff = Odometry::DEFAULT_MAX_DEPTH_DIFF(),
const std::vector<int>& iterCounts = std::vector<int>(),
647 const std::vector<float>& minGradientMagnitudes = std::vector<float>(),
float maxPointsPart = Odometry::DEFAULT_MAX_POINTS_PART(),
648 int transformType = Odometry::RIGID_BODY_MOTION);
652 CV_WRAP
cv::Mat getCameraMatrix() const CV_OVERRIDE
656 CV_WRAP
void setCameraMatrix(
const cv::Mat &val) CV_OVERRIDE
660 CV_WRAP
double getMinDepth()
const
664 CV_WRAP
void setMinDepth(
double val)
668 CV_WRAP
double getMaxDepth()
const
672 CV_WRAP
void setMaxDepth(
double val)
676 CV_WRAP
double getMaxDepthDiff()
const
680 CV_WRAP
void setMaxDepthDiff(
double val)
684 CV_WRAP
cv::Mat getIterationCounts()
const
688 CV_WRAP
void setIterationCounts(
const cv::Mat &val)
692 CV_WRAP
cv::Mat getMinGradientMagnitudes()
const
694 return minGradientMagnitudes;
696 CV_WRAP
void setMinGradientMagnitudes(
const cv::Mat &val)
698 minGradientMagnitudes = val;
700 CV_WRAP
double getMaxPointsPart()
const
702 return maxPointsPart;
704 CV_WRAP
void setMaxPointsPart(
double val)
708 CV_WRAP
int getTransformType() const CV_OVERRIDE
710 return transformType;
712 CV_WRAP
void setTransformType(
int val) CV_OVERRIDE
716 CV_WRAP
double getMaxTranslation()
const
718 return maxTranslation;
720 CV_WRAP
void setMaxTranslation(
double val)
722 maxTranslation = val;
724 CV_WRAP
double getMaxRotation()
const
728 CV_WRAP
void setMaxRotation(
double val)
735 checkParams() const CV_OVERRIDE;
738 computeImpl(const Ptr<OdometryFrame>& srcFrame, const Ptr<OdometryFrame>& dstFrame, OutputArray Rt,
739 const Mat& initRt) const CV_OVERRIDE;
743 double minDepth, maxDepth, maxDepthDiff;
747 Mat minGradientMagnitudes;
748 double maxPointsPart;
753 double maxTranslation, maxRotation;
773 ICPOdometry(
const Mat& cameraMatrix,
float minDepth = Odometry::DEFAULT_MIN_DEPTH(),
float maxDepth = Odometry::DEFAULT_MAX_DEPTH(),
774 float maxDepthDiff = Odometry::DEFAULT_MAX_DEPTH_DIFF(),
float maxPointsPart = Odometry::DEFAULT_MAX_POINTS_PART(),
775 const std::vector<int>& iterCounts = std::vector<int>(),
int transformType = Odometry::RIGID_BODY_MOTION);
777 CV_WRAP
static Ptr<ICPOdometry> create(
const Mat& cameraMatrix =
Mat(),
float minDepth = Odometry::DEFAULT_MIN_DEPTH(),
float maxDepth = Odometry::DEFAULT_MAX_DEPTH(),
778 float maxDepthDiff = Odometry::DEFAULT_MAX_DEPTH_DIFF(),
float maxPointsPart = Odometry::DEFAULT_MAX_POINTS_PART(),
779 const std::vector<int>& iterCounts = std::vector<int>(),
int transformType = Odometry::RIGID_BODY_MOTION);
783 CV_WRAP
cv::Mat getCameraMatrix() const CV_OVERRIDE
787 CV_WRAP
void setCameraMatrix(
const cv::Mat &val) CV_OVERRIDE
791 CV_WRAP
double getMinDepth()
const
795 CV_WRAP
void setMinDepth(
double val)
799 CV_WRAP
double getMaxDepth()
const
803 CV_WRAP
void setMaxDepth(
double val)
807 CV_WRAP
double getMaxDepthDiff()
const
811 CV_WRAP
void setMaxDepthDiff(
double val)
815 CV_WRAP
cv::Mat getIterationCounts()
const
819 CV_WRAP
void setIterationCounts(
const cv::Mat &val)
823 CV_WRAP
double getMaxPointsPart()
const
825 return maxPointsPart;
827 CV_WRAP
void setMaxPointsPart(
double val)
831 CV_WRAP
int getTransformType() const CV_OVERRIDE
833 return transformType;
835 CV_WRAP
void setTransformType(
int val) CV_OVERRIDE
839 CV_WRAP
double getMaxTranslation()
const
841 return maxTranslation;
843 CV_WRAP
void setMaxTranslation(
double val)
845 maxTranslation = val;
847 CV_WRAP
double getMaxRotation()
const
851 CV_WRAP
void setMaxRotation(
double val)
855 CV_WRAP Ptr<RgbdNormals> getNormalsComputer()
const
857 return normalsComputer;
862 checkParams() const CV_OVERRIDE;
865 computeImpl(const Ptr<OdometryFrame>& srcFrame, const Ptr<OdometryFrame>& dstFrame, OutputArray Rt,
866 const Mat& initRt) const CV_OVERRIDE;
870 double minDepth, maxDepth, maxDepthDiff;
872 double maxPointsPart;
879 double maxTranslation, maxRotation;
881 mutable Ptr<RgbdNormals> normalsComputer;
903 RgbdICPOdometry(
const Mat& cameraMatrix,
float minDepth = Odometry::DEFAULT_MIN_DEPTH(),
float maxDepth = Odometry::DEFAULT_MAX_DEPTH(),
904 float maxDepthDiff = Odometry::DEFAULT_MAX_DEPTH_DIFF(),
float maxPointsPart = Odometry::DEFAULT_MAX_POINTS_PART(),
905 const std::vector<int>& iterCounts = std::vector<int>(),
906 const std::vector<float>& minGradientMagnitudes = std::vector<float>(),
907 int transformType = Odometry::RIGID_BODY_MOTION);
909 CV_WRAP
static Ptr<RgbdICPOdometry> create(
const Mat& cameraMatrix =
Mat(),
float minDepth = Odometry::DEFAULT_MIN_DEPTH(),
float maxDepth = Odometry::DEFAULT_MAX_DEPTH(),
910 float maxDepthDiff = Odometry::DEFAULT_MAX_DEPTH_DIFF(),
float maxPointsPart = Odometry::DEFAULT_MAX_POINTS_PART(),
911 const std::vector<int>& iterCounts = std::vector<int>(),
912 const std::vector<float>& minGradientMagnitudes = std::vector<float>(),
913 int transformType = Odometry::RIGID_BODY_MOTION);
917 CV_WRAP
cv::Mat getCameraMatrix() const CV_OVERRIDE
921 CV_WRAP
void setCameraMatrix(
const cv::Mat &val) CV_OVERRIDE
925 CV_WRAP
double getMinDepth()
const
929 CV_WRAP
void setMinDepth(
double val)
933 CV_WRAP
double getMaxDepth()
const
937 CV_WRAP
void setMaxDepth(
double val)
941 CV_WRAP
double getMaxDepthDiff()
const
945 CV_WRAP
void setMaxDepthDiff(
double val)
949 CV_WRAP
double getMaxPointsPart()
const
951 return maxPointsPart;
953 CV_WRAP
void setMaxPointsPart(
double val)
957 CV_WRAP
cv::Mat getIterationCounts()
const
961 CV_WRAP
void setIterationCounts(
const cv::Mat &val)
965 CV_WRAP
cv::Mat getMinGradientMagnitudes()
const
967 return minGradientMagnitudes;
969 CV_WRAP
void setMinGradientMagnitudes(
const cv::Mat &val)
971 minGradientMagnitudes = val;
973 CV_WRAP
int getTransformType() const CV_OVERRIDE
975 return transformType;
977 CV_WRAP
void setTransformType(
int val) CV_OVERRIDE
981 CV_WRAP
double getMaxTranslation()
const
983 return maxTranslation;
985 CV_WRAP
void setMaxTranslation(
double val)
987 maxTranslation = val;
989 CV_WRAP
double getMaxRotation()
const
993 CV_WRAP
void setMaxRotation(
double val)
997 CV_WRAP Ptr<RgbdNormals> getNormalsComputer()
const
999 return normalsComputer;
1004 checkParams() const CV_OVERRIDE;
1007 computeImpl(const Ptr<OdometryFrame>& srcFrame, const Ptr<OdometryFrame>& dstFrame, OutputArray Rt,
1008 const Mat& initRt) const CV_OVERRIDE;
1012 double minDepth, maxDepth, maxDepthDiff;
1014 double maxPointsPart;
1018 Mat minGradientMagnitudes;
1023 double maxTranslation, maxRotation;
1025 mutable Ptr<RgbdNormals> normalsComputer;
1055 float maxDistDiff = Odometry::DEFAULT_MAX_DEPTH_DIFF(),
1056 float angleThreshold = (
float)(30. * CV_PI / 180.),
1057 float sigmaDepth = 0.04f,
1058 float sigmaSpatial = 4.5f,
1060 const std::vector<int>& iterCounts = std::vector<int>());
1063 float maxDistDiff = Odometry::DEFAULT_MAX_DEPTH_DIFF(),
1064 float angleThreshold = (
float)(30. * CV_PI / 180.),
1065 float sigmaDepth = 0.04f,
1066 float sigmaSpatial = 4.5f,
1068 const std::vector<int>& iterCounts = std::vector<int>());
1072 CV_WRAP
cv::Mat getCameraMatrix() const CV_OVERRIDE
1074 return cameraMatrix;
1076 CV_WRAP
void setCameraMatrix(
const cv::Mat &val) CV_OVERRIDE
1080 CV_WRAP
double getMaxDistDiff()
const
1084 CV_WRAP
void setMaxDistDiff(
float val)
1088 CV_WRAP
float getAngleThreshold()
const
1090 return angleThreshold;
1092 CV_WRAP
void setAngleThreshold(
float f)
1096 CV_WRAP
float getSigmaDepth()
const
1100 CV_WRAP
void setSigmaDepth(
float f)
1104 CV_WRAP
float getSigmaSpatial()
const
1106 return sigmaSpatial;
1108 CV_WRAP
void setSigmaSpatial(
float f)
1112 CV_WRAP
int getKernelSize()
const
1116 CV_WRAP
void setKernelSize(
int f)
1120 CV_WRAP
cv::Mat getIterationCounts()
const
1124 CV_WRAP
void setIterationCounts(
const cv::Mat &val)
1128 CV_WRAP
int getTransformType() const CV_OVERRIDE
1130 return Odometry::RIGID_BODY_MOTION;
1132 CV_WRAP
void setTransformType(
int val) CV_OVERRIDE
1134 if(val != Odometry::RIGID_BODY_MOTION)
1135 throw std::runtime_error(
"Rigid Body Motion is the only accepted transformation type"
1136 " for this odometry method");
1141 checkParams() const CV_OVERRIDE;
1145 const
Mat& initRt) const CV_OVERRIDE;
1150 float angleThreshold;
This type is very similar to InputArray except that it is used for input/output and output function p...
Definition: mat.hpp:295
This is a base class for all more or less complex algorithms in OpenCV
Definition: core.hpp:3091
n-dimensional dense array class
Definition: mat.hpp:802
Template class for specifying the size of an image or rectangle.
Definition: core/types.hpp:316
Definition: depth.hpp:187
DEPTH_CLEANER_METHOD
Definition: depth.hpp:194
CV_WRAP_AS(apply) void operator()(InputArray points
CV_WRAP void initialize() const
DepthCleaner(int depth, int window_size=5, int method=DepthCleaner::DEPTH_CLEANER_NIL)
Definition: depth.hpp:1040
FastICPOdometry(const Mat &cameraMatrix, float maxDistDiff=Odometry::DEFAULT_MAX_DEPTH_DIFF(), float angleThreshold=(float)(30. *CV_PI/180.), float sigmaDepth=0.04f, float sigmaSpatial=4.5f, int kernelSize=7, const std::vector< int > &iterCounts=std::vector< int >())
Definition: depth.hpp:760
ICPOdometry(const Mat &cameraMatrix, float minDepth=Odometry::DEFAULT_MIN_DEPTH(), float maxDepth=Odometry::DEFAULT_MAX_DEPTH(), float maxDepthDiff=Odometry::DEFAULT_MAX_DEPTH_DIFF(), float maxPointsPart=Odometry::DEFAULT_MAX_POINTS_PART(), const std::vector< int > &iterCounts=std::vector< int >(), int transformType=Odometry::RIGID_BODY_MOTION)
Definition: depth.hpp:525
CV_WRAP bool compute(const Mat &srcImage, const Mat &srcDepth, const Mat &srcMask, const Mat &dstImage, const Mat &dstDepth, const Mat &dstMask, OutputArray Rt, const Mat &initRt=Mat()) const
CV_WRAP_AS(compute2) bool compute(Ptr< OdometryFrame > &srcFrame
Definition: depth.hpp:888
RgbdICPOdometry(const Mat &cameraMatrix, float minDepth=Odometry::DEFAULT_MIN_DEPTH(), float maxDepth=Odometry::DEFAULT_MAX_DEPTH(), float maxDepthDiff=Odometry::DEFAULT_MAX_DEPTH_DIFF(), float maxPointsPart=Odometry::DEFAULT_MAX_POINTS_PART(), const std::vector< int > &iterCounts=std::vector< int >(), const std::vector< float > &minGradientMagnitudes=std::vector< float >(), int transformType=Odometry::RIGID_BODY_MOTION)
CV_WRAP void initialize() const
RgbdNormals(int rows, int cols, int depth, InputArray K, int window_size=5, int method=RgbdNormals::RGBD_NORMALS_METHOD_FALS)
CV_WRAP_AS(apply) void operator()(InputArray points
Definition: depth.hpp:625
RgbdOdometry(const Mat &cameraMatrix, float minDepth=Odometry::DEFAULT_MIN_DEPTH(), float maxDepth=Odometry::DEFAULT_MAX_DEPTH(), float maxDepthDiff=Odometry::DEFAULT_MAX_DEPTH_DIFF(), const std::vector< int > &iterCounts=std::vector< int >(), const std::vector< float > &minGradientMagnitudes=std::vector< float >(), float maxPointsPart=Odometry::DEFAULT_MAX_POINTS_PART(), int transformType=Odometry::RIGID_BODY_MOTION)
Definition: depth.hpp:330
RgbdPlane(int method, int block_size, int min_size, double threshold, double sensor_error_a=0, double sensor_error_b=0, double sensor_error_c=0)
CV_WRAP_AS(apply) void operator()(InputArray points3d
CV_EXPORTS_W void max(InputArray src1, InputArray src2, OutputArray dst)
Calculates per-element maximum of two arrays or an array and a scalar.
CV_EXPORTS_W void min(InputArray src1, InputArray src2, OutputArray dst)
Calculates per-element minimum of two arrays or an array and a scalar.
CV_INLINE int cvIsNaN(double value)
Determines if the argument is Not A Number.
Definition: fast_math.hpp:273
CV_EXPORTS_W double threshold(InputArray src, OutputArray dst, double thresh, double maxval, int type)
Applies a fixed-level threshold to each array element.
CV_EXPORTS_W void depthTo3d(InputArray depth, InputArray K, OutputArray points3d, InputArray mask=noArray())
CV_EXPORTS_W void warpFrame(const Mat &image, const Mat &depth, const Mat &mask, const Mat &Rt, const Mat &cameraMatrix, const Mat &distCoeff, OutputArray warpedImage, OutputArray warpedDepth=noArray(), OutputArray warpedMask=noArray())
CV_EXPORTS_W void rescaleDepth(InputArray in, int depth, OutputArray out, double depth_factor=1000.0)
CV_EXPORTS_W void registerDepth(InputArray unregisteredCameraMatrix, InputArray registeredCameraMatrix, InputArray registeredDistCoeffs, InputArray Rt, InputArray unregisteredDepth, const Size &outputImagePlaneSize, OutputArray registeredDepth, bool depthDilation=false)
CV_EXPORTS bool isValidDepth(const float &depth)
Definition: depth.hpp:27
CV_EXPORTS_W void depthTo3dSparse(InputArray depth, InputArray in_K, InputArray in_points, OutputArray points3d)
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75
Definition: cvstd_wrapper.hpp:74
Definition: depth.hpp:484
Definition: depth.hpp:462