39 #include <opencv2/imgproc/imgproc_c.h> 40 #include <opencv2/core/version.hpp> 41 #include <opencv2/opencv_modules.hpp> 43 #ifdef RTABMAP_ORB_OCTREE 47 #ifdef RTABMAP_SUPERPOINT_TORCH 51 #if CV_MAJOR_VERSION < 3 53 #ifdef HAVE_OPENCV_GPU 54 #include <opencv2/gpu/gpu.hpp> 57 #include <opencv2/core/cuda.hpp> 60 #ifdef HAVE_OPENCV_NONFREE 61 #if CV_MAJOR_VERSION == 2 && CV_MINOR_VERSION >=4 62 #include <opencv2/nonfree/gpu.hpp> 63 #include <opencv2/nonfree/features2d.hpp> 66 #ifdef HAVE_OPENCV_XFEATURES2D 67 #include <opencv2/xfeatures2d.hpp> 68 #include <opencv2/xfeatures2d/nonfree.hpp> 69 #include <opencv2/xfeatures2d/cuda.hpp> 71 #ifdef HAVE_OPENCV_CUDAFEATURES2D 72 #include <opencv2/cudafeatures2d.hpp> 82 std::vector<cv::KeyPoint> & keypoints,
83 const cv::Mat & depth,
92 std::vector<cv::KeyPoint> & keypoints,
93 cv::Mat & descriptors,
94 const cv::Mat & depth,
99 UASSERT(maxDepth <= 0.0f || maxDepth > minDepth);
100 if(!depth.empty() && (descriptors.empty() || descriptors.rows == (int)keypoints.size()))
102 std::vector<cv::KeyPoint> output(keypoints.size());
103 std::vector<int> indexes(keypoints.size(), 0);
105 bool isInMM = depth.type() == CV_16UC1;
106 for(
unsigned int i=0; i<keypoints.size(); ++i)
108 int u = int(keypoints[i].pt.x+0.5f);
109 int v = int(keypoints[i].pt.y+0.5f);
110 if(u >=0 && u<depth.cols && v >=0 && v<depth.rows)
112 float d = isInMM?(float)depth.at<
uint16_t>(v,u)*0.001f:depth.at<
float>(v,u);
113 if(
uIsFinite(d) && d>minDepth && (maxDepth <= 0.0f || d < maxDepth))
115 output[oi++] = keypoints[i];
123 if(!descriptors.empty() && (int)keypoints.size() != descriptors.rows)
125 if(keypoints.size() == 0)
127 descriptors = cv::Mat();
131 cv::Mat newDescriptors((
int)keypoints.size(), descriptors.cols, descriptors.type());
133 for(
unsigned int i=0; i<indexes.size(); ++i)
137 if(descriptors.type() == CV_32FC1)
139 memcpy(newDescriptors.ptr<
float>(di++), descriptors.ptr<
float>(i), descriptors.cols*
sizeof(
float));
143 memcpy(newDescriptors.ptr<
char>(di++), descriptors.ptr<
char>(i), descriptors.cols*
sizeof(
char));
147 descriptors = newDescriptors;
154 std::vector<cv::KeyPoint> & keypoints,
155 cv::Mat & descriptors,
156 std::vector<cv::Point3f> & keypoints3D,
162 UASSERT(((
int)keypoints.size() == descriptors.rows || descriptors.empty()) &&
163 keypoints3D.size() == keypoints.size());
164 std::vector<cv::KeyPoint> validKeypoints(keypoints.size());
165 std::vector<cv::Point3f> validKeypoints3D(keypoints.size());
166 cv::Mat validDescriptors(descriptors.size(), descriptors.type());
169 float minDepthSqr = minDepth * minDepth;
170 float maxDepthSqr = maxDepth * maxDepth;
171 for(
unsigned int i=0; i<keypoints3D.size(); ++i)
173 cv::Point3f & pt = keypoints3D[i];
176 float distSqr = pt.x*pt.x+pt.y*pt.y+pt.z*pt.z;
177 if(distSqr >= minDepthSqr && (maxDepthSqr==0.0
f || distSqr <= maxDepthSqr))
179 validKeypoints[oi] = keypoints[i];
180 validKeypoints3D[oi] = pt;
181 if(!descriptors.empty())
183 descriptors.row(i).copyTo(validDescriptors.row(oi));
189 UDEBUG(
"Removed %d invalid 3D points", (
int)keypoints3D.size()-oi);
190 validKeypoints.resize(oi);
191 validKeypoints3D.resize(oi);
192 keypoints = validKeypoints;
193 keypoints3D = validKeypoints3D;
194 if(!descriptors.empty())
196 descriptors = validDescriptors.rowRange(0, oi).clone();
201 std::vector<cv::KeyPoint> & keypoints,
202 const cv::Mat & disparity,
210 std::vector<cv::KeyPoint> & keypoints,
211 cv::Mat & descriptors,
212 const cv::Mat & disparity,
215 if(!disparity.empty() && minDisparity > 0.0f && (descriptors.empty() || descriptors.rows == (int)keypoints.size()))
217 std::vector<cv::KeyPoint> output(keypoints.size());
218 std::vector<int> indexes(keypoints.size(), 0);
220 for(
unsigned int i=0; i<keypoints.size(); ++i)
222 int u = int(keypoints[i].pt.x+0.5f);
223 int v = int(keypoints[i].pt.y+0.5f);
224 if(u >=0 && u<disparity.cols && v >=0 && v<disparity.rows)
226 float d = disparity.type() == CV_16SC1?float(disparity.at<
short>(v,u))/16.0f:disparity.at<
float>(v,u);
227 if(d!=0.0
f &&
uIsFinite(d) && d >= minDisparity)
229 output[oi++] = keypoints[i];
237 if(!descriptors.empty() && (int)keypoints.size() != descriptors.rows)
239 if(keypoints.size() == 0)
241 descriptors = cv::Mat();
245 cv::Mat newDescriptors((
int)keypoints.size(), descriptors.cols, descriptors.type());
247 for(
unsigned int i=0; i<indexes.size(); ++i)
251 if(descriptors.type() == CV_32FC1)
253 memcpy(newDescriptors.ptr<
float>(di++), descriptors.ptr<
float>(i), descriptors.cols*
sizeof(
float));
257 memcpy(newDescriptors.ptr<
char>(di++), descriptors.ptr<
char>(i), descriptors.cols*
sizeof(
char));
261 descriptors = newDescriptors;
275 std::vector<cv::Point3f> keypoints3D;
276 limitKeypoints(keypoints, keypoints3D, descriptors, maxKeypoints);
279 void Feature2D::limitKeypoints(std::vector<cv::KeyPoint> & keypoints, std::vector<cv::Point3f> & keypoints3D, cv::Mat & descriptors,
int maxKeypoints)
281 UASSERT_MSG((
int)keypoints.size() == descriptors.rows || descriptors.rows == 0,
uFormat(
"keypoints=%d descriptors=%d", (
int)keypoints.size(), descriptors.rows).c_str());
282 UASSERT_MSG(keypoints.size() == keypoints3D.size() || keypoints3D.size() == 0,
uFormat(
"keypoints=%d keypoints3D=%d", (
int)keypoints.size(), (int)keypoints3D.size()).c_str());
283 if(maxKeypoints > 0 && (
int)keypoints.size() > maxKeypoints)
286 ULOGGER_DEBUG(
"too much words (%d), removing words with the hessian threshold", keypoints.size());
290 std::multimap<float, int> hessianMap;
291 for(
unsigned int i = 0; i <keypoints.size(); ++i)
294 hessianMap.insert(std::pair<float, int>(fabs(keypoints[i].response), i));
298 int removed = (int)hessianMap.size()-maxKeypoints;
299 std::multimap<float, int>::reverse_iterator iter = hessianMap.rbegin();
300 std::vector<cv::KeyPoint> kptsTmp(maxKeypoints);
301 std::vector<cv::Point3f> kpts3DTmp(maxKeypoints);
302 cv::Mat descriptorsTmp;
305 descriptorsTmp = cv::Mat(maxKeypoints, descriptors.cols, descriptors.type());
307 for(
unsigned int k=0; k < kptsTmp.size() && iter!=hessianMap.rend(); ++k, ++iter)
309 kptsTmp[k] = keypoints[iter->second];
310 if(keypoints3D.size())
312 kpts3DTmp[k] = keypoints3D[iter->second];
316 if(descriptors.type() == CV_32FC1)
318 memcpy(descriptorsTmp.ptr<
float>(k), descriptors.ptr<
float>(iter->second), descriptors.cols*
sizeof(
float));
322 memcpy(descriptorsTmp.ptr<
char>(k), descriptors.ptr<
char>(iter->second), descriptors.cols*
sizeof(
char));
326 ULOGGER_DEBUG(
"%d keypoints removed, (kept %d), minimum response=%f", removed, (
int)kptsTmp.size(), kptsTmp.size()?kptsTmp.back().response:0.0f);
329 keypoints3D = kpts3DTmp;
332 descriptors = descriptorsTmp;
339 if(maxKeypoints > 0 && (
int)keypoints.size() > maxKeypoints)
342 ULOGGER_DEBUG(
"too much words (%d), removing words with the hessian threshold", (
int)keypoints.size());
346 std::multimap<float, int> hessianMap;
347 for(
unsigned int i = 0; i <keypoints.size(); ++i)
350 hessianMap.insert(std::pair<float, int>(fabs(keypoints[i].response), i));
354 int removed = (int)hessianMap.size()-maxKeypoints;
355 std::multimap<float, int>::reverse_iterator iter = hessianMap.rbegin();
356 inliers.resize(keypoints.size(),
false);
357 float minimumHessian = 0.0f;
358 for(
int k=0; k < maxKeypoints && iter!=hessianMap.rend(); ++k, ++iter)
360 inliers[iter->second] =
true;
361 minimumHessian = iter->first;
363 ULOGGER_DEBUG(
"%d keypoints removed, (kept %d), minimum response=%f", removed, maxKeypoints, minimumHessian);
368 ULOGGER_DEBUG(
"keeping all %d keypoints", (
int)keypoints.size());
369 inliers.resize(keypoints.size(),
true);
373 void Feature2D::limitKeypoints(
const std::vector<cv::KeyPoint> & keypoints, std::vector<bool> & inliers,
int maxKeypoints,
const cv::Size & imageSize,
int gridRows,
int gridCols)
375 if(maxKeypoints <= 0 || (
int)keypoints.size() <= maxKeypoints)
377 inliers.resize(keypoints.size(),
true);
380 UASSERT(gridCols>=1 && gridRows >=1);
381 UASSERT(imageSize.height>gridRows && imageSize.width>gridCols);
382 int rowSize = imageSize.height / gridRows;
383 int colSize = imageSize.width / gridCols;
384 int maxKeypointsPerCell = maxKeypoints / (gridRows * gridCols);
385 std::vector<std::vector<cv::KeyPoint> > keypointsPerCell(gridRows * gridCols);
386 std::vector<std::vector<int> > indexesPerCell(gridRows * gridCols);
387 for(
size_t i=0; i<keypoints.size(); ++i)
389 int cellRow = int(keypoints[i].pt.y)/rowSize;
390 int cellCol = int(keypoints[i].pt.x)/colSize;
391 UASSERT(cellRow >=0 && cellRow < gridRows);
392 UASSERT(cellCol >=0 && cellCol < gridCols);
394 keypointsPerCell[cellRow*gridCols + cellCol].push_back(keypoints[i]);
395 indexesPerCell[cellRow*gridCols + cellCol].push_back(i);
397 inliers.resize(keypoints.size(),
false);
398 for(
size_t i=0; i<keypointsPerCell.size(); ++i)
400 std::vector<bool> inliersCell;
401 limitKeypoints(keypointsPerCell[i], inliersCell, maxKeypointsPerCell);
402 for(
size_t j=0; j<inliersCell.size(); ++j)
406 inliers.at(indexesPerCell[i][j]) =
true;
459 ParametersMap::const_iterator iter;
460 if((iter=parameters.find(Parameters::kKpRoiRatios())) != parameters.end())
462 std::list<std::string> strValues =
uSplit(iter->second,
' ');
463 if(strValues.size() != 4)
465 ULOGGER_ERROR(
"The number of values must be 4 (roi=\"%s\")", iter->second.c_str());
469 std::vector<float> tmpValues(4);
471 for(std::list<std::string>::iterator jter = strValues.begin(); jter!=strValues.end(); ++jter)
477 if(tmpValues[0] >= 0 && tmpValues[0] < 1 && tmpValues[0] < 1.0
f-tmpValues[1] &&
478 tmpValues[1] >= 0 && tmpValues[1] < 1 && tmpValues[1] < 1.0
f-tmpValues[0] &&
479 tmpValues[2] >= 0 && tmpValues[2] < 1 && tmpValues[2] < 1.0
f-tmpValues[3] &&
480 tmpValues[3] >= 0 && tmpValues[3] < 1 && tmpValues[3] < 1.0
f-tmpValues[2])
486 ULOGGER_ERROR(
"The roi ratios are not valid (roi=\"%s\")", iter->second.c_str());
493 if((iter=parameters.find(Parameters::kStereoOpticalFlow())) != parameters.end())
505 int type = Parameters::defaultKpDetectorStrategy();
513 #if CV_MAJOR_VERSION < 3 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION <= 3) || (CV_MAJOR_VERSION == 3 && (CV_MINOR_VERSION < 4 || (CV_MINOR_VERSION==4 && CV_SUBMINOR_VERSION<11))) 515 #ifndef RTABMAP_NONFREE 518 #if CV_MAJOR_VERSION < 3 519 UWARN(
"SURF and SIFT features cannot be used because OpenCV was not built with nonfree module. GFTT/ORB is used instead.");
521 UWARN(
"SURF and SIFT features cannot be used because OpenCV was not built with xfeatures2d module. GFTT/ORB is used instead.");
527 #else // >= 4.4.0 >= 3.4.11 529 #ifndef RTABMAP_NONFREE 532 UWARN(
"SURF features cannot be used because OpenCV was not built with nonfree module. SIFT is used instead.");
537 UWARN(
"SURF detector cannot be used because OpenCV was not built with nonfree module. GFTT/ORB is used instead.");
542 #endif // >= 4.4.0 >= 3.4.11 544 #if !defined(HAVE_OPENCV_XFEATURES2D) && CV_MAJOR_VERSION >= 3 553 UWARN(
"BRIEF, FREAK and DAISY features cannot be used because OpenCV was not built with xfeatures2d module. GFTT/ORB is used instead.");
556 #elif CV_MAJOR_VERSION < 3 559 #ifdef RTABMAP_NONFREE 560 UWARN(
"KAZE detector/descriptor can be used only with OpenCV3. SURF is used instead.");
563 UWARN(
"KAZE detector/descriptor can be used only with OpenCV3. GFTT/ORB is used instead.");
569 UWARN(
"DAISY detector/descriptor can be used only with OpenCV3. GFTT/BRIEF is used instead.");
575 #ifndef RTABMAP_ORB_OCTREE 578 UWARN(
"ORB OcTree feature cannot be used as RTAB-Map is not built with the option enabled. GFTT/ORB is used instead.");
583 #ifndef RTABMAP_SUPERPOINT_TORCH 586 UWARN(
"SupertPoint Torch feature cannot be used as RTAB-Map is not built with the option enabled. GFTT/ORB is used instead.");
595 feature2D =
new SURF(parameters);
598 feature2D =
new SIFT(parameters);
601 feature2D =
new ORB(parameters);
616 feature2D =
new GFTT_ORB(parameters);
619 feature2D =
new BRISK(parameters);
622 feature2D =
new KAZE(parameters);
627 #ifdef RTABMAP_SUPERPOINT_TORCH 641 #ifdef RTABMAP_NONFREE 643 feature2D =
new SURF(parameters);
648 feature2D =
new ORB(parameters);
660 UASSERT(image.type() == CV_8UC1);
665 if(maskIn.type()==CV_16UC1 || maskIn.type() == CV_32FC1)
667 mask = cv::Mat::zeros(maskIn.rows, maskIn.cols, CV_8UC1);
668 for(
int i=0; i<(int)mask.total(); ++i)
671 if(maskIn.type()==CV_16UC1)
673 if(((
unsigned short*)maskIn.data)[i] > 0 &&
676 value = float(((
unsigned short*)maskIn.data)[i])*0.001f;
681 value = ((
float*)maskIn.data)[i];
688 ((
unsigned char*)mask.data)[i] = 255;
692 else if(maskIn.type()==CV_8UC1)
699 UERROR(
"Wrong mask type (%d)! Should be 8UC1, 16UC1 or 32FC1.", maskIn.type());
703 UASSERT(mask.empty() || (mask.cols == image.cols && mask.rows == image.rows));
705 std::vector<cv::KeyPoint> keypoints;
708 if(!(globalRoi.width && globalRoi.height))
710 globalRoi = cv::Rect(0,0,image.cols, image.rows);
714 int rowSize = globalRoi.height /
gridRows_;
715 int colSize = globalRoi.width /
gridCols_;
721 cv::Rect roi(globalRoi.x + j*colSize, globalRoi.y + i*rowSize, colSize, rowSize);
722 std::vector<cv::KeyPoint> sub_keypoints;
728 for(std::vector<cv::KeyPoint>::iterator iter=sub_keypoints.begin(); iter!=sub_keypoints.end(); ++iter)
734 keypoints.insert( keypoints.end(), sub_keypoints.begin(), sub_keypoints.end() );
737 UDEBUG(
"Keypoints extraction time = %f s, keypoints extracted = %d (grid=%dx%d, mask empty=%d)",
742 std::vector<cv::Point2f> corners;
743 cv::KeyPoint::convert(keypoints, corners);
744 cv::cornerSubPix( image, corners,
749 for(
unsigned int i=0;i<corners.size(); ++i)
751 keypoints[i].pt = corners[i];
760 const cv::Mat & image,
761 std::vector<cv::KeyPoint> & keypoints)
const 767 UASSERT(image.type() == CV_8UC1);
769 UASSERT_MSG(descriptors.rows == (
int)keypoints.size(),
uFormat(
"descriptors=%d, keypoints=%d", descriptors.rows, (
int)keypoints.size()).c_str());
770 UDEBUG(
"Descriptors extracted = %d, remaining kpts=%d", descriptors.rows, (
int)keypoints.size());
777 const std::vector<cv::KeyPoint> & keypoints)
const 779 std::vector<cv::Point3f> keypoints3D;
789 cv::cvtColor(data.
imageRaw(), imageMono, cv::COLOR_BGR2GRAY);
796 std::vector<cv::Point2f> leftCorners;
797 cv::KeyPoint::convert(keypoints, leftCorners);
798 std::vector<unsigned char> status;
800 std::vector<cv::Point2f> rightCorners;
833 hessianThreshold_(
Parameters::defaultSURFHessianThreshold()),
835 nOctaveLayers_(
Parameters::defaultSURFOctaveLayers()),
838 gpuKeypointsRatio_(
Parameters::defaultSURFGpuKeypointsRatio()),
839 gpuVersion_(
Parameters::defaultSURFGpuVersion())
860 #ifdef RTABMAP_NONFREE 861 #if CV_MAJOR_VERSION < 3 862 if(
gpuVersion_ && cv::gpu::getCudaEnabledDeviceCount() == 0)
864 UWARN(
"GPU version of SURF not available! Using CPU version instead...");
868 if(
gpuVersion_ && cv::cuda::getCudaEnabledDeviceCount() == 0)
870 UWARN(
"GPU version of SURF not available! Using CPU version instead...");
880 #if CV_MAJOR_VERSION < 3 887 UWARN(
"RTAB-Map is not built with OpenCV nonfree module so SURF cannot be used!");
893 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
894 std::vector<cv::KeyPoint> keypoints;
896 #ifdef RTABMAP_NONFREE 897 cv::Mat imgRoi(image, roi);
901 maskRoi = cv::Mat(mask, roi);
905 #if CV_MAJOR_VERSION < 3 906 cv::gpu::GpuMat imgGpu(imgRoi);
907 cv::gpu::GpuMat maskGpu(maskRoi);
908 (*
_gpuSurf.obj)(imgGpu, maskGpu, keypoints);
910 cv::cuda::GpuMat imgGpu(imgRoi);
911 cv::cuda::GpuMat maskGpu(maskRoi);
912 (*
_gpuSurf.get())(imgGpu, maskGpu, keypoints);
917 _surf->detect(imgRoi, keypoints, maskRoi);
920 UWARN(
"RTAB-Map is not built with OpenCV nonfree module so SURF cannot be used!");
927 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
929 #ifdef RTABMAP_NONFREE 932 #if CV_MAJOR_VERSION < 3 933 cv::gpu::GpuMat imgGpu(image);
934 cv::gpu::GpuMat descriptorsGPU;
935 (*
_gpuSurf.obj)(imgGpu, cv::gpu::GpuMat(), keypoints, descriptorsGPU,
true);
937 cv::cuda::GpuMat imgGpu(image);
938 cv::cuda::GpuMat descriptorsGPU;
939 (*
_gpuSurf.get())(imgGpu, cv::cuda::GpuMat(), keypoints, descriptorsGPU,
true);
943 if (descriptorsGPU.empty())
944 descriptors = cv::Mat();
947 UASSERT(descriptorsGPU.type() == CV_32F);
948 descriptors = cv::Mat(descriptorsGPU.size(), CV_32F);
949 descriptorsGPU.download(descriptors);
954 _surf->compute(image, keypoints, descriptors);
957 UWARN(
"RTAB-Map is not built with OpenCV nonfree module so SURF cannot be used!");
968 contrastThreshold_(
Parameters::defaultSIFTContrastThreshold()),
969 edgeThreshold_(
Parameters::defaultSIFTEdgeThreshold()),
990 #if CV_MAJOR_VERSION < 3 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION <= 3) || (CV_MAJOR_VERSION == 3 && (CV_MINOR_VERSION < 4 || (CV_MINOR_VERSION==4 && CV_SUBMINOR_VERSION<11))) 991 #ifdef RTABMAP_NONFREE 992 #if CV_MAJOR_VERSION < 3 998 UWARN(
"RTAB-Map is not built with OpenCV nonfree module so SIFT cannot be used!");
1000 #else // >=4.4, >=3.4.11 1007 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
1008 std::vector<cv::KeyPoint> keypoints;
1009 cv::Mat imgRoi(image, roi);
1013 maskRoi = cv::Mat(mask, roi);
1015 #if CV_MAJOR_VERSION < 3 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION <= 3) || (CV_MAJOR_VERSION == 3 && (CV_MINOR_VERSION < 4 || (CV_MINOR_VERSION==4 && CV_SUBMINOR_VERSION<11))) 1016 #ifdef RTABMAP_NONFREE 1017 _sift->detect(imgRoi, keypoints, maskRoi);
1019 UWARN(
"RTAB-Map is not built with OpenCV nonfree module so SIFT cannot be used!");
1021 #else // >=4.4, >=3.4.11 1022 _sift->detect(imgRoi, keypoints, maskRoi);
1029 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
1030 cv::Mat descriptors;
1031 #if CV_MAJOR_VERSION < 3 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION <= 3) || (CV_MAJOR_VERSION == 3 && (CV_MINOR_VERSION < 4 || (CV_MINOR_VERSION==4 && CV_SUBMINOR_VERSION<11))) 1032 #ifdef RTABMAP_NONFREE 1033 _sift->compute(image, keypoints, descriptors);
1035 UWARN(
"RTAB-Map is not built with OpenCV nonfree module so SIFT cannot be used!");
1037 #else // >=4.4, >=3.4.11 1038 _sift->compute(image, keypoints, descriptors);
1042 UDEBUG(
"Performing RootSIFT...");
1046 for(
int i=0; i<descriptors.rows; ++i)
1051 descriptors.row(i) = descriptors.row(i) / cv::sum(descriptors.row(i))[0];
1052 cv::sqrt(descriptors.row(i), descriptors.row(i));
1062 scaleFactor_(
Parameters::defaultORBScaleFactor()),
1065 firstLevel_(
Parameters::defaultORBFirstLevel()),
1067 scoreType_(
Parameters::defaultORBScoreType()),
1068 patchSize_(
Parameters::defaultORBPatchSize()),
1070 fastThreshold_(
Parameters::defaultFASTThreshold()),
1071 nonmaxSuppresion_(
Parameters::defaultFASTNonmaxSuppression())
1096 #if CV_MAJOR_VERSION < 3 1097 #ifdef HAVE_OPENCV_GPU 1098 if(
gpu_ && cv::gpu::getCudaEnabledDeviceCount() == 0)
1100 UWARN(
"GPU version of ORB not available! Using CPU version instead...");
1106 UWARN(
"GPU version of ORB not available (OpenCV not built with gpu/cuda module)! Using CPU version instead...");
1111 #ifndef HAVE_OPENCV_CUDAFEATURES2D 1114 UWARN(
"GPU version of ORB not available (OpenCV cudafeatures2d module)! Using CPU version instead...");
1118 if(
gpu_ && cv::cuda::getCudaEnabledDeviceCount() == 0)
1120 UWARN(
"GPU version of ORB not available (no GPU found)! Using CPU version instead...");
1126 #if CV_MAJOR_VERSION < 3 1127 #ifdef HAVE_OPENCV_GPU 1131 UFATAL(
"not supposed to be here");
1134 #ifdef HAVE_OPENCV_CUDAFEATURES2D 1141 #if CV_MAJOR_VERSION < 3 1143 #elif CV_MAJOR_VERSION > 3 1153 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
1154 std::vector<cv::KeyPoint> keypoints;
1155 cv::Mat imgRoi(image, roi);
1159 maskRoi = cv::Mat(mask, roi);
1164 #if CV_MAJOR_VERSION < 3 1165 #ifdef HAVE_OPENCV_GPU 1166 cv::gpu::GpuMat imgGpu(imgRoi);
1167 cv::gpu::GpuMat maskGpu(maskRoi);
1168 (*
_gpuOrb.obj)(imgGpu, maskGpu, keypoints);
1170 UERROR(
"Cannot use ORBGPU because OpenCV is not built with gpu module.");
1173 #ifdef HAVE_OPENCV_CUDAFEATURES2D 1174 cv::cuda::GpuMat d_image(imgRoi);
1175 cv::cuda::GpuMat d_mask(maskRoi);
1177 _gpuOrb->detectAndCompute(d_image, d_mask, keypoints, cv::cuda::GpuMat(),
false);
1178 }
catch (cv::Exception&
e) {
1179 const char* err_msg = e.what();
1180 UWARN(
"OpenCV exception caught: %s", err_msg);
1187 _orb->detect(imgRoi, keypoints, maskRoi);
1195 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
1196 cv::Mat descriptors;
1204 #if CV_MAJOR_VERSION < 3 1205 #ifdef HAVE_OPENCV_GPU 1206 cv::gpu::GpuMat imgGpu(image);
1207 cv::gpu::GpuMat descriptorsGPU;
1208 (*
_gpuOrb.obj)(imgGpu, cv::gpu::GpuMat(), keypoints, descriptorsGPU);
1210 if (descriptorsGPU.empty())
1211 descriptors = cv::Mat();
1214 UASSERT(descriptorsGPU.type() == CV_32F);
1215 descriptors = cv::Mat(descriptorsGPU.size(), CV_32F);
1216 descriptorsGPU.download(descriptors);
1219 UERROR(
"GPU version of ORB not available (OpenCV not built with gpu/cuda module)! Using CPU version instead...");
1222 #ifdef HAVE_OPENCV_CUDAFEATURES2D 1223 cv::cuda::GpuMat d_image(image);
1224 cv::cuda::GpuMat d_descriptors;
1226 _gpuOrb->detectAndCompute(d_image, cv::cuda::GpuMat(), keypoints, d_descriptors,
true);
1227 }
catch (cv::Exception&
e) {
1228 const char* err_msg = e.what();
1229 UWARN(
"OpenCV exception caught: %s", err_msg);
1232 if (d_descriptors.empty())
1233 descriptors = cv::Mat();
1236 UASSERT(d_descriptors.type() == CV_32F || d_descriptors.type() == CV_8U);
1237 d_descriptors.download(descriptors);
1244 _orb->compute(image, keypoints, descriptors);
1254 threshold_(
Parameters::defaultFASTThreshold()),
1255 nonmaxSuppression_(
Parameters::defaultFASTNonmaxSuppression()),
1257 gpuKeypointsRatio_(
Parameters::defaultFASTGpuKeypointsRatio()),
1258 minThreshold_(
Parameters::defaultFASTMinThreshold()),
1259 maxThreshold_(
Parameters::defaultFASTMaxThreshold()),
1264 fastCVMaxFeatures_(10000),
1265 fastCVLastImageHeight_(0)
1267 #ifdef RTABMAP_FASTCV 1268 char sVersion[128] = { 0 };
1269 fcvGetVersion(sVersion, 128);
1270 UINFO(
"fastcv version = %s", sVersion);
1272 if ((ix = fcvSetOperationMode(FASTCV_OP_PERFORMANCE)))
1274 UERROR(
"fcvSetOperationMode return=%d, OpenCV FAST will be used instead!", ix);
1284 UERROR(
"could not alloc fastcv mem, using opencv fast instead!");
1308 #ifdef RTABMAP_FASTCV 1343 #if CV_MAJOR_VERSION < 3 1344 #ifdef HAVE_OPENCV_GPU 1345 if(
gpu_ && cv::gpu::getCudaEnabledDeviceCount() == 0)
1347 UWARN(
"GPU version of FAST not available! Using CPU version instead...");
1353 UWARN(
"GPU version of FAST not available (OpenCV not built with gpu/cuda module)! Using CPU version instead...");
1358 #ifdef HAVE_OPENCV_CUDAFEATURES2D 1359 if(
gpu_ && cv::cuda::getCudaEnabledDeviceCount() == 0)
1361 UWARN(
"GPU version of FAST not available! Using CPU version instead...");
1367 UWARN(
"GPU version of FAST not available (OpenCV cudafeatures2d module)! Using CPU version instead...");
1374 #if CV_MAJOR_VERSION < 3 1375 #ifdef HAVE_OPENCV_GPU 1378 UFATAL(
"not supposed to be here!");
1381 #ifdef HAVE_OPENCV_CUDAFEATURES2D 1382 UFATAL(
"not implemented");
1388 #if CV_MAJOR_VERSION < 3 1399 UWARN(
"Parameter \"%s\" is set (value=%d) but not \"%s\"! Grid adaptor will not be added.",
1400 Parameters::kFASTGridRows().c_str(),
gridRows_, Parameters::kFASTGridCols().c_str());
1404 UWARN(
"Parameter \"%s\" is set (value=%d) but not \"%s\"! Grid adaptor will not be added.",
1405 Parameters::kFASTGridCols().c_str(),
gridCols_, Parameters::kFASTGridRows().c_str());
1417 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
1418 std::vector<cv::KeyPoint> keypoints;
1420 #ifdef RTABMAP_FASTCV 1438 UERROR(
"could not alloc fastcv mem for temp buf (%s=true)", Parameters::kFASTNonmaxSuppression().c_str());
1450 fcvCornerFast10Scoreu8(image.data, image.cols, image.rows, 0,
threshold_, 0,
fastCVCorners_,
fastCVCornerScores_,
fastCVMaxFeatures_, &nCorners,
nonmaxSuppression_?1:0,
fastCVTempBuf_);
1454 fcvCornerFast9Scoreu8_v2(image.data, image.cols, image.rows, image.step1(),
threshold_, 0,
fastCVCorners_,
fastCVCornerScores_,
fastCVMaxFeatures_, &nCorners,
nonmaxSuppression_?1:0,
fastCVTempBuf_);
1456 UDEBUG(
"number of corners found = %d:", nCorners);
1457 keypoints.resize(nCorners);
1458 for (
uint32_t i = 0; i < nCorners; i++)
1462 keypoints[i].size = 3;
1476 UWARN(
"RTAB-Map is not built with FastCV support. OpenCV's FAST is used instead. " 1477 "Please set %s to 0. This message will only appear once.",
1478 Parameters::kFASTCV().c_str());
1482 cv::Mat imgRoi(image, roi);
1486 maskRoi = cv::Mat(mask, roi);
1490 #if CV_MAJOR_VERSION < 3 1491 #ifdef HAVE_OPENCV_GPU 1492 cv::gpu::GpuMat imgGpu(imgRoi);
1493 cv::gpu::GpuMat maskGpu(maskRoi);
1494 (*
_gpuFast.obj)(imgGpu, maskGpu, keypoints);
1496 UERROR(
"Cannot use FAST GPU because OpenCV is not built with gpu module.");
1499 #ifdef HAVE_OPENCV_CUDAFEATURES2D 1500 UFATAL(
"not implemented");
1506 _fast->detect(imgRoi, keypoints, maskRoi);
1530 #if CV_MAJOR_VERSION < 3 1533 #ifdef HAVE_OPENCV_XFEATURES2D 1536 UWARN(
"RTAB-Map is not built with OpenCV xfeatures2d module so Brief cannot be used!");
1543 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
1544 cv::Mat descriptors;
1545 #if CV_MAJOR_VERSION < 3 1546 _brief->compute(image, keypoints, descriptors);
1548 #ifdef HAVE_OPENCV_XFEATURES2D 1549 _brief->compute(image, keypoints, descriptors);
1551 UWARN(
"RTAB-Map is not built with OpenCV xfeatures2d module so Brief cannot be used!");
1562 orientationNormalized_(
Parameters::defaultFREAKOrientationNormalized()),
1563 scaleNormalized_(
Parameters::defaultFREAKScaleNormalized()),
1564 patternScale_(
Parameters::defaultFREAKPatternScale()),
1565 nOctaves_(
Parameters::defaultFREAKNOctaves())
1583 #if CV_MAJOR_VERSION < 3 1586 #ifdef HAVE_OPENCV_XFEATURES2D 1589 UWARN(
"RTAB-Map is not built with OpenCV xfeatures2d module so Freak cannot be used!");
1596 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
1597 cv::Mat descriptors;
1598 #if CV_MAJOR_VERSION < 3 1599 _freak->compute(image, keypoints, descriptors);
1601 #ifdef HAVE_OPENCV_XFEATURES2D 1602 _freak->compute(image, keypoints, descriptors);
1604 UWARN(
"RTAB-Map is not built with OpenCV xfeatures2d module so Freak cannot be used!");
1614 _qualityLevel(
Parameters::defaultGFTTQualityLevel()),
1615 _minDistance(
Parameters::defaultGFTTMinDistance()),
1616 _blockSize(
Parameters::defaultGFTTBlockSize()),
1617 _useHarrisDetector(
Parameters::defaultGFTTUseHarrisDetector()),
1637 #if CV_MAJOR_VERSION < 3 1646 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
1647 std::vector<cv::KeyPoint> keypoints;
1648 cv::Mat imgRoi(image, roi);
1652 maskRoi = cv::Mat(mask, roi);
1654 _gftt->detect(imgRoi, keypoints, maskRoi);
1677 #if CV_MAJOR_VERSION < 3 1680 #ifdef HAVE_OPENCV_XFEATURES2D 1683 UWARN(
"RTAB-Map is not built with OpenCV xfeatures2d module so Brief cannot be used!");
1690 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
1691 cv::Mat descriptors;
1692 #if CV_MAJOR_VERSION < 3 1693 _brief->compute(image, keypoints, descriptors);
1695 #ifdef HAVE_OPENCV_XFEATURES2D 1696 _brief->compute(image, keypoints, descriptors);
1698 UWARN(
"RTAB-Map is not built with OpenCV xfeatures2d module so Brief cannot be used!");
1709 orientationNormalized_(
Parameters::defaultFREAKOrientationNormalized()),
1710 scaleNormalized_(
Parameters::defaultFREAKScaleNormalized()),
1711 patternScale_(
Parameters::defaultFREAKPatternScale()),
1712 nOctaves_(
Parameters::defaultFREAKNOctaves())
1730 #if CV_MAJOR_VERSION < 3 1733 #ifdef HAVE_OPENCV_XFEATURES2D 1736 UWARN(
"RTAB-Map is not built with OpenCV xfeatures2d module so Freak cannot be used!");
1743 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
1744 cv::Mat descriptors;
1745 #if CV_MAJOR_VERSION < 3 1746 _freak->compute(image, keypoints, descriptors);
1748 #ifdef HAVE_OPENCV_XFEATURES2D 1749 _freak->compute(image, keypoints, descriptors);
1751 UWARN(
"RTAB-Map is not built with OpenCV xfeatures2d module so Freak cannot be used!");
1783 #if CV_MAJOR_VERSION < 3 1786 #ifdef HAVE_OPENCV_XFEATURES2D 1789 UWARN(
"RTAB-Map is not built with OpenCV xfeatures2d module so Freak cannot be used!");
1796 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
1797 cv::Mat descriptors;
1798 #if CV_MAJOR_VERSION < 3 1799 _freak->compute(image, keypoints, descriptors);
1801 #ifdef HAVE_OPENCV_XFEATURES2D 1802 _freak->compute(image, keypoints, descriptors);
1804 UWARN(
"RTAB-Map is not built with OpenCV xfeatures2d module so Freak cannot be used!");
1832 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
1842 patternScale_(
Parameters::defaultBRISKPatternScale())
1859 #if CV_MAJOR_VERSION < 3 1868 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
1869 std::vector<cv::KeyPoint> keypoints;
1870 cv::Mat imgRoi(image, roi);
1874 maskRoi = cv::Mat(mask, roi);
1876 brisk_->detect(imgRoi, keypoints, maskRoi);
1882 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
1883 cv::Mat descriptors;
1884 brisk_->compute(image, keypoints, descriptors);
1892 extended_(
Parameters::defaultKAZEExtended()),
1894 threshold_(
Parameters::defaultKAZEThreshold()),
1895 nOctaves_(
Parameters::defaultKAZENOctaves()),
1896 nOctaveLayers_(
Parameters::defaultKAZENOctaveLayers()),
1897 diffusivity_(
Parameters::defaultKAZEDiffusivity())
1917 #if CV_MAJOR_VERSION > 3 1919 #elif CV_MAJOR_VERSION > 2 1922 UWARN(
"RTAB-Map is not built with OpenCV3 so Kaze feature cannot be used!");
1928 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
1929 std::vector<cv::KeyPoint> keypoints;
1930 #if CV_MAJOR_VERSION > 2 1931 cv::Mat imgRoi(image, roi);
1935 maskRoi = cv::Mat(mask, roi);
1937 kaze_->detect(imgRoi, keypoints, maskRoi);
1939 UWARN(
"RTAB-Map is not built with OpenCV3 so Kaze feature cannot be used!");
1946 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
1947 cv::Mat descriptors;
1948 #if CV_MAJOR_VERSION > 2 1949 kaze_->compute(image, keypoints, descriptors);
1951 UWARN(
"RTAB-Map is not built with OpenCV3 so Kaze feature cannot be used!");
1960 scaleFactor_(
Parameters::defaultORBScaleFactor()),
1962 patchSize_(
Parameters::defaultORBPatchSize()),
1963 edgeThreshold_(
Parameters::defaultORBEdgeThreshold()),
1964 fastThreshold_(
Parameters::defaultFASTThreshold()),
1965 fastMinThreshold_(
Parameters::defaultFASTMinThreshold())
1986 #ifdef RTABMAP_ORB_OCTREE 1989 UWARN(
"RTAB-Map is not built with ORB OcTree option enabled so ORB OcTree feature cannot be used!");
1995 std::vector<cv::KeyPoint> keypoints;
1997 #ifdef RTABMAP_ORB_OCTREE 1998 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
1999 cv::Mat imgRoi(image, roi);
2003 maskRoi = cv::Mat(mask, roi);
2013 UWARN(
"RTAB-Map is not built with ORB OcTree option enabled so ORB OcTree feature cannot be used!");
2020 #ifdef RTABMAP_ORB_OCTREE 2023 UWARN(
"RTAB-Map is not built with ORB OcTree option enabled so ORB OcTree feature cannot be used!");
2032 path_(
Parameters::defaultSuperPointModelPath()),
2033 threshold_(
Parameters::defaultSuperPointThreshold()),
2035 minDistance_(
Parameters::defaultSuperPointNMSRadius()),
2049 std::string previousPath =
path_;
2050 #ifdef RTABMAP_SUPERPOINT_TORCH 2051 bool previousCuda =
cuda_;
2059 #ifdef RTABMAP_SUPERPOINT_TORCH 2071 UWARN(
"RTAB-Map is not built with SuperPoint Torch support so SuperPoint Torch feature cannot be used!");
2077 #ifdef RTABMAP_SUPERPOINT_TORCH 2078 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
2079 UASSERT_MSG(roi.x==0 && roi.y ==0,
"Not supporting ROI");
2082 UWARN(
"RTAB-Map is not built with SuperPoint Torch support so SuperPoint Torch feature cannot be used!");
2083 return std::vector<cv::KeyPoint>();
2089 #ifdef RTABMAP_SUPERPOINT_TORCH 2090 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
2093 UWARN(
"RTAB-Map is not built with SuperPoint Torch support so SuperPoint Torch feature cannot be used!");
2104 orientationNormalized_(
Parameters::defaultFREAKOrientationNormalized()),
2105 scaleNormalized_(
Parameters::defaultFREAKScaleNormalized()),
2106 patternScale_(
Parameters::defaultFREAKPatternScale()),
2107 nOctaves_(
Parameters::defaultFREAKNOctaves())
2125 #ifdef HAVE_OPENCV_XFEATURES2D 2126 _daisy = CV_DAISY::create();
2128 UWARN(
"RTAB-Map is not built with OpenCV xfeatures2d module so DAISY cannot be used!");
2134 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
2135 cv::Mat descriptors;
2136 #ifdef HAVE_OPENCV_XFEATURES2D 2137 _daisy->compute(image, keypoints, descriptors);
2139 UWARN(
"RTAB-Map is not built with OpenCV xfeatures2d module so DAISY cannot be used!");
2170 #ifdef HAVE_OPENCV_XFEATURES2D 2171 _daisy = CV_DAISY::create();
2173 UWARN(
"RTAB-Map is not built with OpenCV xfeatures2d module so DAISY cannot be used!");
2179 UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
2180 cv::Mat descriptors;
2181 #ifdef HAVE_OPENCV_XFEATURES2D 2182 _daisy->compute(image, keypoints, descriptors);
2184 UWARN(
"RTAB-Map is not built with OpenCV xfeatures2d module so DAISY cannot be used!");
GLM_FUNC_DECL genIType mask(genIType const &count)
virtual std::vector< cv::KeyPoint > generateKeypointsImpl(const cv::Mat &image, const cv::Rect &roi, const cv::Mat &mask=cv::Mat())
bool RTABMAP_EXP isFinite(const cv::Point3f &pt)
int fastCVLastImageHeight_
static bool parse(const ParametersMap ¶meters, const std::string &key, bool &value)
virtual cv::Mat generateDescriptorsImpl(const cv::Mat &image, std::vector< cv::KeyPoint > &keypoints) const
virtual cv::Mat generateDescriptorsImpl(const cv::Mat &image, std::vector< cv::KeyPoint > &keypoints) const =0
virtual void parseParameters(const ParametersMap ¶meters)
static void limitKeypoints(std::vector< cv::KeyPoint > &keypoints, int maxKeypoints)
virtual std::vector< cv::KeyPoint > generateKeypointsImpl(const cv::Mat &image, const cv::Rect &roi, const cv::Mat &mask=cv::Mat())
std::vector< cv::Point3f > generateKeypoints3D(const SensorData &data, const std::vector< cv::KeyPoint > &keypoints) const
double gpuKeypointsRatio_
FAST_BRIEF(const ParametersMap ¶meters=ParametersMap())
GFTT_DAISY(const ParametersMap ¶meters=ParametersMap())
virtual cv::Mat generateDescriptorsImpl(const cv::Mat &image, std::vector< cv::KeyPoint > &keypoints) const
virtual void parseParameters(const ParametersMap ¶meters)
SURF_DAISY(const ParametersMap ¶meters=ParametersMap())
cv::Mat generateDescriptors(const cv::Mat &image, std::vector< cv::KeyPoint > &keypoints) const
virtual void parseParameters(const ParametersMap ¶meters)
cv::Ptr< CV_FREAK > _freak
GFTT_FREAK(const ParametersMap ¶meters=ParametersMap())
GLM_FUNC_DECL vecType< T, P > sqrt(vecType< T, P > const &x)
uint32_t * fastCVCornerScores_
virtual cv::Mat generateDescriptorsImpl(const cv::Mat &image, std::vector< cv::KeyPoint > &keypoints) const
virtual void parseParameters(const ParametersMap ¶meters)
virtual void parseParameters(const ParametersMap ¶meters)
cv::Ptr< CV_FREAK > _freak
cv::BriefDescriptorExtractor CV_BRIEF
cv::Ptr< ORBextractor > _orb
virtual cv::Mat generateDescriptorsImpl(const cv::Mat &image, std::vector< cv::KeyPoint > &keypoints) const
GLM_FUNC_DECL genType e()
virtual std::vector< cv::KeyPoint > generateKeypointsImpl(const cv::Mat &image, const cv::Rect &roi, const cv::Mat &mask=cv::Mat())
float UTILITE_EXP uStr2Float(const std::string &str)
virtual cv::Mat generateDescriptorsImpl(const cv::Mat &image, std::vector< cv::KeyPoint > &keypoints) const
uint32_t * fastCVCorners_
std::map< std::string, std::string > ParametersMap
double contrastThreshold_
std::vector< float > _roiRatios
Basic mathematics functions.
cv::Ptr< CV_BRISK > brisk_
cv::Ptr< CV_ORB_GPU > _gpuOrb
Some conversion functions.
cv::FastFeatureDetector CV_FAST
const cv::Mat & imageRaw() const
Feature2D(const ParametersMap ¶meters=ParametersMap())
virtual cv::Mat generateDescriptorsImpl(const cv::Mat &image, std::vector< cv::KeyPoint > &keypoints) const
virtual cv::Mat generateDescriptorsImpl(const cv::Mat &image, std::vector< cv::KeyPoint > &keypoints) const
std::vector< cv::KeyPoint > generateKeypoints(const cv::Mat &image, const cv::Mat &mask=cv::Mat())
int getMaxFeatures() const
bool orientationNormalized_
SuperPointTorch(const ParametersMap ¶meters=ParametersMap())
virtual cv::Mat generateDescriptorsImpl(const cv::Mat &image, std::vector< cv::KeyPoint > &keypoints) const
std::list< std::string > uSplit(const std::string &str, char separator= ' ')
bool uIsFinite(const T &value)
cv::Ptr< CV_FAST_GPU > _gpuFast
#define UASSERT(condition)
virtual void parseParameters(const ParametersMap ¶meters)
Wrappers of STL for convenient functions.
virtual std::vector< cv::KeyPoint > generateKeypointsImpl(const cv::Mat &image, const cv::Rect &roi, const cv::Mat &mask=cv::Mat())
static void filterKeypointsByDisparity(std::vector< cv::KeyPoint > &keypoints, const cv::Mat &disparity, float minDisparity)
virtual std::vector< cv::Point2f > computeCorrespondences(const cv::Mat &leftImage, const cv::Mat &rightImage, const std::vector< cv::Point2f > &leftCorners, std::vector< unsigned char > &status) const
bool isValidForProjection() const
BRISK(const ParametersMap ¶meters=ParametersMap())
cv::Ptr< SPDetector > superPoint_
static Feature2D * create(const ParametersMap ¶meters=ParametersMap())
#define ULOGGER_DEBUG(...)
virtual void parseParameters(const ParametersMap ¶meters)
#define UASSERT_MSG(condition, msg_str)
bool orientationNormalized_
virtual void parseParameters(const ParametersMap ¶meters)
cv::Ptr< CV_FREAK > _freak
SURF_FREAK(const ParametersMap ¶meters=ParametersMap())
cv::Rect RTABMAP_EXP computeRoi(const cv::Mat &image, const std::string &roiRatios)
FAST(const ParametersMap ¶meters=ParametersMap())
virtual void parseParameters(const ParametersMap ¶meters)
virtual cv::Mat generateDescriptorsImpl(const cv::Mat &image, std::vector< cv::KeyPoint > &keypoints) const
virtual void parseParameters(const ParametersMap ¶meters)
virtual void parseParameters(const ParametersMap ¶meters)
static void filterKeypointsByDepth(std::vector< cv::KeyPoint > &keypoints, const cv::Mat &depth, float minDepth, float maxDepth)
bool orientationNormalized_
virtual std::vector< cv::KeyPoint > generateKeypointsImpl(const cv::Mat &image, const cv::Rect &roi, const cv::Mat &mask=cv::Mat())
virtual void parseParameters(const ParametersMap ¶meters)
virtual cv::Mat generateDescriptorsImpl(const cv::Mat &image, std::vector< cv::KeyPoint > &keypoints) const
KAZE(const ParametersMap ¶meters=ParametersMap())
const cv::Mat & depthOrRightRaw() const
cv::gpu::SURF_GPU CV_SURF_GPU
static cv::Rect computeRoi(const cv::Mat &image, const std::string &roiRatios)
SIFT(const ParametersMap ¶meters=ParametersMap())
static Stereo * create(const ParametersMap ¶meters=ParametersMap())
virtual std::vector< cv::KeyPoint > generateKeypointsImpl(const cv::Mat &image, const cv::Rect &roi, const cv::Mat &mask=cv::Mat())
cv::Ptr< CV_BRIEF > _brief
virtual cv::Mat generateDescriptorsImpl(const cv::Mat &image, std::vector< cv::KeyPoint > &keypoints) const
const std::vector< CameraModel > & cameraModels() const
FAST_FREAK(const ParametersMap ¶meters=ParametersMap())
GLM_FUNC_DECL genType max(genType const &x, genType const &y)
bool orientationNormalized_
virtual void parseParameters(const ParametersMap ¶meters)
virtual cv::Mat generateDescriptorsImpl(const cv::Mat &image, std::vector< cv::KeyPoint > &keypoints) const
ORBOctree(const ParametersMap ¶meters=ParametersMap())
ORB(const ParametersMap ¶meters=ParametersMap())
cv::Ptr< CV_BRIEF > _brief
virtual void parseParameters(const ParametersMap ¶meters)
virtual cv::Mat generateDescriptorsImpl(const cv::Mat &image, std::vector< cv::KeyPoint > &keypoints) const
virtual void parseParameters(const ParametersMap ¶meters)
GFTT(const ParametersMap ¶meters=ParametersMap())
ULogger class and convenient macros.
const StereoCameraModel & stereoCameraModel() const
SURF(const ParametersMap ¶meters=ParametersMap())
virtual void parseParameters(const ParametersMap ¶meters)
virtual cv::Mat generateDescriptorsImpl(const cv::Mat &image, std::vector< cv::KeyPoint > &keypoints) const
GFTT_BRIEF(const ParametersMap ¶meters=ParametersMap())
virtual cv::Mat generateDescriptorsImpl(const cv::Mat &image, std::vector< cv::KeyPoint > &keypoints) const
virtual std::vector< cv::KeyPoint > generateKeypointsImpl(const cv::Mat &image, const cv::Rect &roi, const cv::Mat &mask=cv::Mat())
cv::gpu::ORB_GPU CV_ORB_GPU
virtual std::vector< cv::KeyPoint > generateKeypointsImpl(const cv::Mat &image, const cv::Rect &roi, const cv::Mat &mask=cv::Mat())=0
virtual void parseParameters(const ParametersMap ¶meters)
GFTT_ORB(const ParametersMap ¶meters=ParametersMap())
bool orientationNormalized_
virtual ~SuperPointTorch()
cv::gpu::FAST_GPU CV_FAST_GPU
virtual std::vector< cv::KeyPoint > generateKeypointsImpl(const cv::Mat &image, const cv::Rect &roi, const cv::Mat &mask=cv::Mat())
virtual std::vector< cv::KeyPoint > generateKeypointsImpl(const cv::Mat &image, const cv::Rect &roi, const cv::Mat &mask=cv::Mat())
#define ULOGGER_ERROR(...)
std::vector< cv::Point3f > RTABMAP_EXP generateKeypoints3DDepth(const std::vector< cv::KeyPoint > &keypoints, const cv::Mat &depth, const CameraModel &cameraModel, float minDepth=0, float maxDepth=0)
cv::Ptr< cv::FeatureDetector > _fast
std::string UTILITE_EXP uFormat(const char *fmt,...)
ParametersMap parameters_
void uInsert(std::map< K, V > &map, const std::pair< K, V > &pair)
virtual void parseParameters(const ParametersMap ¶meters)
virtual void parseParameters(const ParametersMap ¶meters)
std::vector< cv::Point3f > RTABMAP_EXP generateKeypoints3DStereo(const std::vector< cv::Point2f > &leftCorners, const std::vector< cv::Point2f > &rightCorners, const StereoCameraModel &model, const std::vector< unsigned char > &mask=std::vector< unsigned char >(), float minDepth=0, float maxDepth=0)
cv::Ptr< CV_SURF_GPU > _gpuSurf