36 #include <visp3/core/vpConfig.h>
38 #if ((VISP_HAVE_OPENCV_VERSION < 0x050000) && defined(HAVE_OPENCV_CALIB3D) && defined(HAVE_OPENCV_FEATURES2D)) || \
39 ((VISP_HAVE_OPENCV_VERSION >= 0x050000) && defined(HAVE_OPENCV_3D) && defined(HAVE_OPENCV_FEATURES))
51 #include <visp3/core/vpDisplay.h>
52 #include <visp3/core/vpImageConvert.h>
53 #include <visp3/core/vpPixelMeterConversion.h>
54 #include <visp3/core/vpPlane.h>
55 #include <visp3/core/vpPoint.h>
56 #include <visp3/vision/vpBasicKeyPoint.h>
57 #include <visp3/vision/vpPose.h>
58 #ifdef VISP_HAVE_MODULE_IO
59 #include <visp3/io/vpImageIo.h>
61 #include <visp3/core/vpConvert.h>
62 #include <visp3/core/vpCylinder.h>
63 #include <visp3/core/vpMeterPixelConversion.h>
64 #include <visp3/core/vpPolygon.h>
65 #include <visp3/vision/vpXmlConfigParserKeyPoint.h>
67 #include <opencv2/core/core.hpp>
69 #if defined(HAVE_OPENCV_FEATURES2D)
70 #include <opencv2/features2d/features2d.hpp>
73 #if defined(HAVE_OPENCV_XFEATURES2D)
74 #include <opencv2/xfeatures2d.hpp>
77 #if defined(HAVE_OPENCV_IMGPROC)
78 #include <opencv2/imgproc/imgproc.hpp>
81 #if defined(HAVE_OPENCV_NONFREE)
82 #include <opencv2/nonfree/nonfree.hpp>
272 constantFactorDistanceThreshold,
274 stdDistanceThreshold,
276 ratioDistanceThreshold,
279 stdAndRatioDistanceThreshold,
306 #if (VISP_HAVE_OPENCV_VERSION >= 0x050000)
307 # if defined(HAVE_OPENCV_FEATURES)
315 # if defined(HAVE_OPENCV_XFEATURES2D)
323 # if defined(OPENCV_ENABLE_NONFREE) && defined(HAVE_OPENCV_XFEATURES2D)
327 # if defined(HAVE_OPENCV_FEATURES2D)
334 # if (VISP_HAVE_OPENCV_VERSION >= 0x030000)
340 # if (VISP_HAVE_OPENCV_VERSION >= 0x030100) && defined(VISP_HAVE_OPENCV_XFEATURES2D)
343 # if ((VISP_HAVE_OPENCV_VERSION >= 0x030411 && CV_MAJOR_VERSION < 4) || (VISP_HAVE_OPENCV_VERSION >= 0x040400)) && defined(HAVE_OPENCV_FEATURES2D)
346 #if (VISP_HAVE_OPENCV_VERSION < 0x030000) || (defined(VISP_HAVE_OPENCV_XFEATURES2D))
349 # if defined(OPENCV_ENABLE_NONFREE) && defined(HAVE_OPENCV_XFEATURES2D)
360 #if (VISP_HAVE_OPENCV_VERSION >= 0x050000)
361 # if defined(HAVE_OPENCV_FEATURES)
365 # if defined(HAVE_OPENCV_XFEATURES2D)
368 DESCRIPTOR_BoostDesc,
376 # if defined(OPENCV_ENABLE_NONFREE) && defined(HAVE_OPENCV_XFEATURES2D)
380 # if defined(HAVE_OPENCV_FEATURES2D)
383 # if (VISP_HAVE_OPENCV_VERSION >= 0x030000)
388 # if defined(HAVE_OPENCV_XFEATURES2D)
394 # if ((VISP_HAVE_OPENCV_VERSION >= 0x030411 && CV_MAJOR_VERSION < 4) || (VISP_HAVE_OPENCV_VERSION >= 0x040400)) && defined(HAVE_OPENCV_FEATURES2D)
397 # if defined(OPENCV_ENABLE_NONFREE) && defined(HAVE_OPENCV_XFEATURES2D)
400 #if (VISP_HAVE_OPENCV_VERSION >= 0x030200) && defined(VISP_HAVE_OPENCV_XFEATURES2D)
401 DESCRIPTOR_BoostDesc,
418 vpKeyPoint(
const vpFeatureDetectorType &detectorType,
const vpFeatureDescriptorType &descriptorType,
419 const std::string &matcherName,
const vpFilterMatchingType &filterType = ratioDistanceThreshold);
430 vpKeyPoint(
const std::string &detectorName =
"ORB",
const std::string &extractorName =
"ORB",
431 const std::string &matcherName =
"BruteForce-Hamming",
432 const vpFilterMatchingType &filterType = ratioDistanceThreshold);
443 vpKeyPoint(
const std::vector<std::string> &detectorNames,
const std::vector<std::string> &extractorNames,
444 const std::string &matcherName =
"BruteForce",
445 const vpFilterMatchingType &filterType = ratioDistanceThreshold);
488 std::vector<cv::Point3f> &points3f,
bool append =
false,
int class_id = -1);
504 const cv::Mat &trainDescriptors,
const std::vector<cv::Point3f> &points3f,
505 bool append =
false,
int class_id = -1);
548 std::vector<cv::Point3f> &points3f,
bool append =
false,
int class_id = -1);
563 const cv::Mat &trainDescriptors,
const std::vector<cv::Point3f> &points3f,
564 bool append =
false,
int class_id = -1);
581 static void compute3D(
const cv::KeyPoint &candidate,
const std::vector<vpPoint> &roi,
const vpCameraParameters &cam,
619 std::vector<cv::KeyPoint> &candidates,
620 const std::vector<vpPolygon> &polygons,
621 const std::vector<std::vector<vpPoint> > &roisPt,
622 std::vector<cv::Point3f> &points, cv::Mat *descriptors =
nullptr);
641 std::vector<vpImagePoint> &candidates,
642 const std::vector<vpPolygon> &polygons,
643 const std::vector<std::vector<vpPoint> > &roisPt,
644 std::vector<vpPoint> &points, cv::Mat *descriptors =
nullptr);
663 std::vector<cv::KeyPoint> &candidates,
const std::vector<vpCylinder> &cylinders,
664 const std::vector<std::vector<std::vector<vpImagePoint> > > &vectorOfCylinderRois,
665 std::vector<cv::Point3f> &points, cv::Mat *descriptors =
nullptr);
684 std::vector<vpImagePoint> &candidates,
const std::vector<vpCylinder> &cylinders,
685 const std::vector<std::vector<std::vector<vpImagePoint> > > &vectorOfCylinderRois,
686 std::vector<vpPoint> &points, cv::Mat *descriptors =
nullptr);
701 bool computePose(
const std::vector<cv::Point2f> &imagePoints,
const std::vector<cv::Point3f> &objectPoints,
717 bool computePose(
const std::vector<vpPoint> &objectVpPoints,
vpHomogeneousMatrix &cMo, std::vector<vpPoint> &inliers,
733 bool computePose(
const std::vector<vpPoint> &objectVpPoints,
vpHomogeneousMatrix &cMo, std::vector<vpPoint> &inliers,
734 std::vector<unsigned int> &inlierIndex,
double &elapsedTime,
806 void detect(
const cv::Mat &matImg, std::vector<cv::KeyPoint> &keyPoints,
const cv::Mat &mask = cv::Mat());
827 void detect(
const vpImage<vpRGBa> &I_color, std::vector<cv::KeyPoint> &keyPoints,
double &elapsedTime,
838 void detect(
const cv::Mat &matImg, std::vector<cv::KeyPoint> &keyPoints,
double &elapsedTime,
839 const cv::Mat &mask = cv::Mat());
855 void detectExtractAffine(
const vpImage<unsigned char> &I, std::vector<std::vector<cv::KeyPoint> > &listOfKeypoints,
856 std::vector<cv::Mat> &listOfDescriptors,
921 const std::vector<vpImagePoint> &ransacInliers = std::vector<vpImagePoint>(),
922 unsigned int crossSize = 3,
unsigned int lineThickness = 1);
964 const std::vector<vpImagePoint> &ransacInliers = std::vector<vpImagePoint>(),
965 unsigned int crossSize = 3,
unsigned int lineThickness = 1);
978 std::vector<cv::Point3f> *trainPoints =
nullptr);
990 void extract(
const vpImage<vpRGBa> &I_color, std::vector<cv::KeyPoint> &keyPoints, cv::Mat &descriptors,
991 std::vector<cv::Point3f> *trainPoints =
nullptr);
1003 void extract(
const cv::Mat &matImg, std::vector<cv::KeyPoint> &keyPoints, cv::Mat &descriptors,
1004 std::vector<cv::Point3f> *trainPoints =
nullptr);
1017 void extract(
const vpImage<unsigned char> &I, std::vector<cv::KeyPoint> &keyPoints, cv::Mat &descriptors,
1018 double &elapsedTime, std::vector<cv::Point3f> *trainPoints =
nullptr);
1031 void extract(
const vpImage<vpRGBa> &I_color, std::vector<cv::KeyPoint> &keyPoints, cv::Mat &descriptors,
1032 double &elapsedTime, std::vector<cv::Point3f> *trainPoints =
nullptr);
1045 void extract(
const cv::Mat &matImg, std::vector<cv::KeyPoint> &keyPoints, cv::Mat &descriptors,
double &elapsedTime,
1046 std::vector<cv::Point3f> *trainPoints =
nullptr);
1059 if (!m_computeCovariance) {
1060 std::cout <<
"Warning : The covariance matrix has not been computed. "
1061 <<
"See setCovarianceComputation() to do it."
1066 if (m_computeCovariance && !m_useRansacVVS) {
1067 std::cout <<
"Warning : The covariance matrix can only be computed "
1068 <<
"with a Virtual Visual Servoing approach." << std::endl
1069 <<
"Use setUseRansacVVS(true) to choose to use a pose "
1070 <<
"estimation method based on a Virtual Visual Servoing approach." << std::endl;
1074 return m_covarianceMatrix;
1093 std::map<vpFeatureDetectorType, std::string>::const_iterator it_name = m_mapOfDetectorNames.find(type);
1094 if (it_name == m_mapOfDetectorNames.end()) {
1095 std::cerr <<
"Internal problem with the feature type and the corresponding name!" << std::endl;
1098 std::map<std::string, cv::Ptr<cv::FeatureDetector> >::const_iterator findDetector =
1099 m_detectors.find(it_name->second);
1100 if (findDetector != m_detectors.end()) {
1101 return findDetector->second;
1104 std::cerr <<
"Cannot find: " << it_name->second << std::endl;
1105 return cv::Ptr<cv::FeatureDetector>();
1115 inline cv::Ptr<cv::FeatureDetector>
getDetector(
const std::string &name)
const
1117 std::map<std::string, cv::Ptr<cv::FeatureDetector> >::const_iterator findDetector = m_detectors.find(name);
1118 if (findDetector != m_detectors.end()) {
1119 return findDetector->second;
1122 std::cerr <<
"Cannot find: " << name << std::endl;
1123 return cv::Ptr<cv::FeatureDetector>();
1129 inline std::map<vpFeatureDetectorType, std::string>
getDetectorNames()
const {
return m_mapOfDetectorNames; }
1147 std::map<vpFeatureDescriptorType, std::string>::const_iterator it_name = m_mapOfDescriptorNames.find(type);
1148 if (it_name == m_mapOfDescriptorNames.end()) {
1149 std::cerr <<
"Internal problem with the feature type and the corresponding name!" << std::endl;
1152 std::map<std::string, cv::Ptr<cv::DescriptorExtractor> >::const_iterator findExtractor =
1153 m_extractors.find(it_name->second);
1154 if (findExtractor != m_extractors.end()) {
1155 return findExtractor->second;
1158 std::cerr <<
"Cannot find: " << it_name->second << std::endl;
1159 return cv::Ptr<cv::DescriptorExtractor>();
1169 inline cv::Ptr<cv::DescriptorExtractor>
getExtractor(
const std::string &name)
const
1171 std::map<std::string, cv::Ptr<cv::DescriptorExtractor> >::const_iterator findExtractor = m_extractors.find(name);
1172 if (findExtractor != m_extractors.end()) {
1173 return findExtractor->second;
1176 std::cerr <<
"Cannot find: " << name << std::endl;
1177 return cv::Ptr<cv::DescriptorExtractor>();
1183 inline std::map<vpFeatureDescriptorType, std::string>
getExtractorNames()
const {
return m_mapOfDescriptorNames; }
1204 inline cv::Ptr<cv::DescriptorMatcher>
getMatcher()
const {
return m_matcher; }
1212 inline std::vector<cv::DMatch>
getMatches()
const {
return m_filteredMatches; }
1223 std::vector<std::pair<cv::KeyPoint, cv::KeyPoint> > matchQueryToTrainKeyPoints(m_filteredMatches.size());
1224 for (
size_t i = 0; i < m_filteredMatches.size(); i++) {
1225 matchQueryToTrainKeyPoints.push_back(
1226 std::pair<cv::KeyPoint, cv::KeyPoint>(m_queryFilteredKeyPoints[(
size_t)m_filteredMatches[i].queryIdx],
1227 m_trainKeyPoints[(
size_t)m_filteredMatches[i].trainIdx]));
1229 return matchQueryToTrainKeyPoints;
1237 inline unsigned int getNbImages()
const {
return static_cast<unsigned int>(m_mapOfImages.size()); }
1246 void getObjectPoints(std::vector<cv::Point3f> &objectPoints)
const;
1255 void getObjectPoints(std::vector<vpPoint> &objectPoints)
const;
1280 void getQueryKeyPoints(std::vector<cv::KeyPoint> &keyPoints,
bool matches =
true)
const;
1290 void getQueryKeyPoints(std::vector<vpImagePoint> &keyPoints,
bool matches =
true)
const;
1319 void getTrainKeyPoints(std::vector<cv::KeyPoint> &keyPoints)
const;
1326 void getTrainKeyPoints(std::vector<vpImagePoint> &keyPoints)
const;
1334 void getTrainPoints(std::vector<cv::Point3f> &points)
const;
1342 void getTrainPoints(std::vector<vpPoint> &points)
const;
1349 void initMatcher(
const std::string &matcherName);
1395 void loadConfigFile(
const std::string &configFile);
1405 void loadLearningData(
const std::string &filename,
bool binaryMode =
false,
bool append =
false);
1415 void match(
const cv::Mat &trainDescriptors,
const cv::Mat &queryDescriptors, std::vector<cv::DMatch> &matches,
1416 double &elapsedTime);
1438 unsigned int width);
1458 unsigned int matchPoint(
const std::vector<cv::KeyPoint> &queryKeyPoints,
const cv::Mat &queryDescriptors);
1515 const bool isPlanarObject =
true, std::vector<vpImagePoint> *imPts1 =
nullptr,
1516 std::vector<vpImagePoint> *imPts2 =
nullptr,
double *meanDescriptorDistance =
nullptr,
1517 double *detectionScore =
nullptr,
const vpRect &rectangle =
vpRect());
1539 double &error,
double &elapsedTime,
vpRect &boundingBox,
vpImagePoint ¢erOfGravity,
1562 unsigned int width);
1621 void saveLearningData(
const std::string &filename,
bool binaryMode =
false,
bool saveTrainingImages =
true);
1631 m_computeCovariance = flag;
1632 if (!m_useRansacVVS) {
1633 std::cout <<
"Warning : The covariance matrix can only be computed "
1634 <<
"with a Virtual Visual Servoing approach." << std::endl
1635 <<
"Use setUseRansacVVS(true) to choose to use a pose "
1636 <<
"estimation method based on a Virtual "
1637 <<
"Visual Servoing approach." << std::endl;
1655 m_detectorNames.clear();
1656 m_detectorNames.push_back(m_mapOfDetectorNames[detectorType]);
1657 m_detectors.clear();
1658 initDetector(m_mapOfDetectorNames[detectorType]);
1668 m_detectorNames.clear();
1669 m_detectorNames.push_back(detectorName);
1670 m_detectors.clear();
1671 initDetector(detectorName);
1674 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400 && VISP_HAVE_OPENCV_VERSION < 0x030000)
1683 template <
typename T1,
typename T2,
typename T3>
1684 inline void setDetectorParameter(
const T1 detectorName,
const T2 parameterName,
const T3 value)
1686 if (m_detectors.find(detectorName) != m_detectors.end()) {
1687 m_detectors[detectorName]->set(parameterName, value);
1700 m_detectorNames.clear();
1701 m_detectors.clear();
1702 m_detectorNames = detectorNames;
1703 initDetectors(m_detectorNames);
1713 m_extractorNames.clear();
1714 m_extractorNames.push_back(m_mapOfDescriptorNames[extractorType]);
1715 m_extractors.clear();
1716 initExtractor(m_mapOfDescriptorNames[extractorType]);
1727 m_extractorNames.clear();
1728 m_extractorNames.push_back(extractorName);
1729 m_extractors.clear();
1730 initExtractor(extractorName);
1733 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400 && VISP_HAVE_OPENCV_VERSION < 0x030000)
1742 template <
typename T1,
typename T2,
typename T3>
1743 inline void setExtractorParameter(
const T1 extractorName,
const T2 parameterName,
const T3 value)
1745 if (m_extractors.find(extractorName) != m_extractors.end()) {
1746 m_extractors[extractorName]->set(parameterName, value);
1759 m_extractorNames.clear();
1760 m_extractorNames = extractorNames;
1761 m_extractors.clear();
1762 initExtractors(m_extractorNames);
1789 m_matcherName = matcherName;
1790 initMatcher(m_matcherName);
1817 m_filterType = filterType;
1821 if (filterType == ratioDistanceThreshold || filterType == stdAndRatioDistanceThreshold) {
1824 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400 && VISP_HAVE_OPENCV_VERSION < 0x030000)
1825 if (m_matcher !=
nullptr && m_matcherName ==
"BruteForce") {
1828 m_matcher->set(
"crossCheck",
false);
1835 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400 && VISP_HAVE_OPENCV_VERSION < 0x030000)
1836 if (m_matcher !=
nullptr && m_matcherName ==
"BruteForce") {
1839 m_matcher->set(
"crossCheck", m_useBruteForceCrossCheck);
1854 m_matchingFactorThreshold = factor;
1868 if (ratio > 0.0 && (ratio < 1.0 || std::fabs(ratio - 1.0) < std::numeric_limits<double>::epsilon())) {
1869 m_matchingRatioThreshold = ratio;
1884 if (percentage > 0.0 &&
1885 (percentage < 100.0 || std::fabs(percentage - 100.0) < std::numeric_limits<double>::epsilon())) {
1886 m_ransacConsensusPercentage = percentage;
1907 m_nbRansacIterations = nbIter;
1938 if (reprojectionError > 0.0) {
1939 m_ransacReprojectionError = reprojectionError;
1943 "threshold must be positive "
1944 "as we deal with distance.");
1956 m_nbRansacMinInlierCount = minCount;
1971 if (threshold > 0.0) {
1972 m_ransacThreshold = threshold;
1988 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400 && VISP_HAVE_OPENCV_VERSION < 0x030000)
1995 inline void setUseBruteForceCrossCheck(
bool useCrossCheck)
1999 if (m_matcher !=
nullptr && !m_useKnn && m_matcherName ==
"BruteForce") {
2000 m_matcher->set(
"crossCheck", useCrossCheck);
2002 else if (m_matcher !=
nullptr && m_useKnn && m_matcherName ==
"BruteForce") {
2003 std::cout <<
"Warning, you try to set the crossCheck parameter with a "
2004 <<
"BruteForce matcher but knn is enabled"
2005 <<
" (the filtering method uses a ratio constraint)" << std::endl;
2047 bool m_computeCovariance;
2051 int m_currentImageId;
2054 vpDetectionMethodType m_detectionMethod;
2056 double m_detectionScore;
2059 double m_detectionThreshold;
2061 double m_detectionTime;
2063 std::vector<std::string> m_detectorNames;
2067 std::map<std::string, cv::Ptr<cv::FeatureDetector> > m_detectors;
2069 double m_extractionTime;
2071 std::vector<std::string> m_extractorNames;
2075 std::map<std::string, cv::Ptr<cv::DescriptorExtractor> > m_extractors;
2077 std::vector<cv::DMatch> m_filteredMatches;
2079 vpFilterMatchingType m_filterType;
2081 vpImageFormatType m_imageFormat;
2084 std::vector<std::vector<cv::DMatch> > m_knnMatches;
2086 std::map<vpFeatureDescriptorType, std::string> m_mapOfDescriptorNames;
2088 std::map<vpFeatureDetectorType, std::string> m_mapOfDetectorNames;
2091 std::map<int, int> m_mapOfImageId;
2094 std::map<int, vpImage<unsigned char> > m_mapOfImages;
2097 cv::Ptr<cv::DescriptorMatcher> m_matcher;
2099 std::string m_matcherName;
2101 std::vector<cv::DMatch> m_matches;
2103 double m_matchingFactorThreshold;
2105 double m_matchingRatioThreshold;
2107 double m_matchingTime;
2109 std::vector<std::pair<cv::KeyPoint, cv::Point3f> > m_matchRansacKeyPointsToPoints;
2111 int m_nbRansacIterations;
2113 int m_nbRansacMinInlierCount;
2116 std::vector<cv::Point3f> m_objectFilteredPoints;
2121 cv::Mat m_queryDescriptors;
2123 std::vector<cv::KeyPoint> m_queryFilteredKeyPoints;
2125 std::vector<cv::KeyPoint> m_queryKeyPoints;
2128 double m_ransacConsensusPercentage;
2132 std::vector<vpImagePoint> m_ransacInliers;
2134 std::vector<vpImagePoint> m_ransacOutliers;
2136 bool m_ransacParallel;
2138 unsigned int m_ransacParallelNbThreads;
2141 double m_ransacReprojectionError;
2144 double m_ransacThreshold;
2148 cv::Mat m_trainDescriptors;
2150 std::vector<cv::KeyPoint> m_trainKeyPoints;
2153 std::vector<cv::Point3f> m_trainPoints;
2156 std::vector<vpPoint> m_trainVpPoints;
2159 bool m_useAffineDetection;
2160 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400 && VISP_HAVE_OPENCV_VERSION < 0x030000)
2164 bool m_useBruteForceCrossCheck;
2168 bool m_useConsensusPercentage;
2175 bool m_useMatchTrainToQuery;
2177 bool m_useRansacVVS;
2180 bool m_useSingleMatchFilter;
2194 void affineSkew(
double tilt,
double phi, cv::Mat &img, cv::Mat &mask, cv::Mat &Ai);
2210 double computePoseEstimationError(
const std::vector<std::pair<cv::KeyPoint, cv::Point3f> > &matchKeyPoints,
2216 void filterMatches();
2229 void initDetector(
const std::string &detectorNames);
2237 void initDetectors(
const std::vector<std::string> &detectorNames);
2244 void initExtractor(
const std::string &extractorName);
2252 void initExtractors(
const std::vector<std::string> &extractorNames);
2257 void initFeatureNames();
2259 inline size_t myKeypointHash(
const cv::KeyPoint &kp)
2261 size_t _Val = 2166136261U, scale = 16777619U;
2264 _Val = (scale * _Val) ^ u.u;
2266 _Val = (scale * _Val) ^ u.u;
2268 _Val = (scale * _Val) ^ u.u;
2274 _Val = (scale * _Val) ^ u.u;
2275 _Val = (scale * _Val) ^ ((
size_t)kp.octave);
2276 _Val = (scale * _Val) ^ ((
size_t)kp.class_id);
2280 #if (VISP_HAVE_OPENCV_VERSION >= 0x030000)
2286 class PyramidAdaptedFeatureDetector :
public cv::FeatureDetector
2290 PyramidAdaptedFeatureDetector(
const cv::Ptr<cv::FeatureDetector> &detector,
int maxLevel = 2);
2293 virtual bool empty()
const;
2296 virtual void detect(cv::InputArray image, CV_OUT std::vector<cv::KeyPoint> &keypoints,
2297 cv::InputArray mask = cv::noArray());
2298 virtual void detectImpl(
const cv::Mat &image, std::vector<cv::KeyPoint> &keypoints,
2299 const cv::Mat &mask = cv::Mat())
const;
2301 cv::Ptr<cv::FeatureDetector> m_detector;
2311 class KeyPointsFilter
2314 KeyPointsFilter() { }
2319 static void runByImageBorder(std::vector<cv::KeyPoint> &keypoints, cv::Size imageSize,
int borderSize);
2323 static void runByKeypointSize(std::vector<cv::KeyPoint> &keypoints,
float minSize,
float maxSize = FLT_MAX);
2327 static void runByPixelsMask(std::vector<cv::KeyPoint> &keypoints,
const cv::Mat &mask);
2331 static void removeDuplicated(std::vector<cv::KeyPoint> &keypoints);
2337 static void retainBest(std::vector<cv::KeyPoint> &keypoints,
int npoints);
class that defines what is a keypoint. This class provides all the basic elements to implement classe...
virtual unsigned int buildReference(const vpImage< unsigned char > &I)=0
virtual unsigned int matchPoint(const vpImage< unsigned char > &I)=0
virtual void display(const vpImage< unsigned char > &Iref, const vpImage< unsigned char > &Icurrent, unsigned int size=3)=0
Generic class defining intrinsic camera parameters.
Class to define RGB colors available for display functionalities.
static const vpColor green
error that can be emitted by ViSP classes.
@ badValue
Used to indicate that a value is not in the allowed range.
Implementation of an homogeneous matrix and operations on such kind of matrices.
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Class that allows keypoints 2D features detection (and descriptors extraction) and matching thanks to...
double getDetectionTime() const
std::vector< vpImagePoint > getRansacInliers() const
void setMatchingFactorThreshold(const double factor)
void setRansacConsensusPercentage(double percentage)
cv::Ptr< cv::DescriptorMatcher > getMatcher() const
void setRansacParallel(bool parallel)
void setRansacReprojectionError(double reprojectionError)
void setExtractor(const std::string &extractorName)
void setUseSingleMatchFilter(bool singleMatchFilter)
void setFilterMatchingType(const vpFilterMatchingType &filterType)
void setRansacParallelNbThreads(unsigned int nthreads)
double getExtractionTime() const
void setUseRansacVVS(bool ransacVVS)
void setDetectors(const std::vector< std::string > &detectorNames)
void setExtractors(const std::vector< std::string > &extractorNames)
cv::Mat getTrainDescriptors() const
@ DETECTOR_KAZE
KAZE detector.
@ DETECTOR_BRISK
BRISK detector.
@ DETECTOR_AKAZE
AKAZE detector.
@ DETECTOR_MSER
MSER detector.
@ DETECTOR_AGAST
AGAST detector.
@ DETECTOR_FAST
FAST detector.
@ DETECTOR_GFTT
GFTT detector.
@ DETECTOR_ORB
ORB detector.
@ DETECTOR_SimpleBlob
SimpleBlob detector.
void setExtractor(const vpFeatureDescriptorType &extractorType)
void setImageFormat(const vpImageFormatType &imageFormat)
void setRansacThreshold(double threshold)
void setRansacMinInlierCount(int minCount)
void setRansacFilterFlag(const vpPose::RANSAC_FILTER_FLAGS &flag)
double getPoseTime() const
std::map< vpFeatureDetectorType, std::string > getDetectorNames() const
unsigned int getNbImages() const
double getMatchingTime() const
std::vector< vpImagePoint > getRansacOutliers() const
@ DESCRIPTOR_LATCH
LATCH descriptor.
@ DESCRIPTOR_AKAZE
AKAZE descriptor.
@ DESCRIPTOR_BRIEF
BRIEF descriptor.
@ DESCRIPTOR_FREAK
FREAK descriptor.
@ DESCRIPTOR_ORB
ORB descriptor.
@ DESCRIPTOR_KAZE
KAZE descriptor.
@ DESCRIPTOR_DAISY
DAISY descriptor.
@ DESCRIPTOR_BRISK
BRISK descriptor.
std::vector< cv::DMatch > getMatches() const
std::map< vpFeatureDescriptorType, std::string > getExtractorNames() const
void setMatcher(const std::string &matcherName)
vpImageFormatType getImageFormat() const
cv::Ptr< cv::DescriptorExtractor > getExtractor(const std::string &name) const
void setUseAffineDetection(bool useAffine)
void setUseRansacConsensusPercentage(bool usePercentage)
void setMatchingRatioThreshold(double ratio)
void setCovarianceComputation(const bool &flag)
void setDetector(const vpFeatureDetectorType &detectorType)
cv::Ptr< cv::DescriptorExtractor > getExtractor(const vpFeatureDescriptorType &type) const
void setUseMatchTrainToQuery(bool useMatchTrainToQuery)
vpMatrix getCovarianceMatrix() const
void setDetectionMethod(const vpDetectionMethodType &method)
cv::Ptr< cv::FeatureDetector > getDetector(const std::string &name) const
void setDetector(const std::string &detectorName)
void setMaxFeatures(int maxFeatures)
std::vector< std::pair< cv::KeyPoint, cv::KeyPoint > > getMatchQueryToTrainKeyPoints() const
cv::Ptr< cv::FeatureDetector > getDetector(const vpFeatureDetectorType &type) const
void setRansacIteration(int nbIter)
cv::Mat getQueryDescriptors() const
Implementation of a matrix and operations on matrices.
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Defines a rectangle in the plane.