Visual Servoing Platform  version 3.6.1 under development (2024-02-13)
vpKeyPoint.h
1 /*
2  * ViSP, open source Visual Servoing Platform software.
3  * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
4  *
5  * This software is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See https://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * Key point functionalities.
32  */
33 #ifndef _vpKeyPoint_h_
34 #define _vpKeyPoint_h_
35 
36 #include <algorithm> // std::transform
37 #include <float.h> // DBL_MAX
38 #include <fstream> // std::ofstream
39 #include <limits>
40 #include <map> // std::map
41 #include <numeric> // std::accumulate
42 #include <stdlib.h> // srand, rand
43 #include <time.h> // time
44 #include <vector> // std::vector
45 
46 #include <visp3/core/vpConfig.h>
47 #include <visp3/core/vpDisplay.h>
48 #include <visp3/core/vpImageConvert.h>
49 #include <visp3/core/vpPixelMeterConversion.h>
50 #include <visp3/core/vpPlane.h>
51 #include <visp3/core/vpPoint.h>
52 #include <visp3/vision/vpBasicKeyPoint.h>
53 #include <visp3/vision/vpPose.h>
54 #ifdef VISP_HAVE_MODULE_IO
55 #include <visp3/io/vpImageIo.h>
56 #endif
57 #include <visp3/core/vpConvert.h>
58 #include <visp3/core/vpCylinder.h>
59 #include <visp3/core/vpMeterPixelConversion.h>
60 #include <visp3/core/vpPolygon.h>
61 #include <visp3/vision/vpXmlConfigParserKeyPoint.h>
62 
63 // Require at least OpenCV >= 2.1.1
64 #if defined(VISP_HAVE_OPENCV) && defined(HAVE_OPENCV_IMGPROC) && defined(HAVE_OPENCV_FEATURES2D)
65 #include <opencv2/features2d/features2d.hpp>
66 #include <opencv2/imgproc/imgproc.hpp>
67 #include <opencv2/imgproc/imgproc_c.h>
68 
69 #if defined(VISP_HAVE_OPENCV_XFEATURES2D) // OpenCV >= 3.0.0
70 #include <opencv2/xfeatures2d.hpp>
71 #elif defined(VISP_HAVE_OPENCV_NONFREE) && (VISP_HAVE_OPENCV_VERSION >= 0x020400) && \
72  (VISP_HAVE_OPENCV_VERSION < 0x030000)
73 #include <opencv2/nonfree/nonfree.hpp>
74 #endif
75 
211 class VISP_EXPORT vpKeyPoint : public vpBasicKeyPoint
212 {
213 public:
216  {
217  constantFactorDistanceThreshold,
219  stdDistanceThreshold,
221  ratioDistanceThreshold,
224  stdAndRatioDistanceThreshold,
226  noFilterMatching
227  };
228 
231  {
232  detectionThreshold,
234  detectionScore
237  };
238 
240  typedef enum
241  {
245  pgmImageFormat
246  } vpImageFormatType;
247 
250  {
251 #if (VISP_HAVE_OPENCV_VERSION >= 0x020403)
258 #if (VISP_HAVE_OPENCV_VERSION < 0x030000) || (defined(VISP_HAVE_OPENCV_XFEATURES2D))
259  DETECTOR_STAR,
260 #endif
261 #if defined(VISP_HAVE_OPENCV_NONFREE) || defined(VISP_HAVE_OPENCV_XFEATURES2D) || \
262  (VISP_HAVE_OPENCV_VERSION >= 0x030411 && CV_MAJOR_VERSION < 4) || (VISP_HAVE_OPENCV_VERSION >= 0x040400)
264 #endif
265 #if defined(VISP_HAVE_OPENCV_NONFREE) || defined(VISP_HAVE_OPENCV_XFEATURES2D)
267 #endif
268 #if (VISP_HAVE_OPENCV_VERSION >= 0x030000)
272 #endif
273 #if (VISP_HAVE_OPENCV_VERSION >= 0x030100) && defined(VISP_HAVE_OPENCV_XFEATURES2D)
274  DETECTOR_MSD,
275 #endif
276 #endif
277  DETECTOR_TYPE_SIZE
278  };
279 
282  {
283 #if (VISP_HAVE_OPENCV_VERSION >= 0x020403)
286 #if (VISP_HAVE_OPENCV_VERSION < 0x030000) || (defined(VISP_HAVE_OPENCV_XFEATURES2D))
287  DESCRIPTOR_FREAK,
288  DESCRIPTOR_BRIEF,
289 #endif
290 #if defined(VISP_HAVE_OPENCV_NONFREE) || defined(VISP_HAVE_OPENCV_XFEATURES2D) || \
291  (VISP_HAVE_OPENCV_VERSION >= 0x030411 && CV_MAJOR_VERSION < 4) || (VISP_HAVE_OPENCV_VERSION >= 0x040400)
293 #endif
294 #if defined(VISP_HAVE_OPENCV_NONFREE) || defined(VISP_HAVE_OPENCV_XFEATURES2D)
296 #endif
297 #if (VISP_HAVE_OPENCV_VERSION >= 0x030000)
300 #if defined(VISP_HAVE_OPENCV_XFEATURES2D)
301  DESCRIPTOR_DAISY,
302  DESCRIPTOR_LATCH,
303 #endif
304 #endif
305 #if (VISP_HAVE_OPENCV_VERSION >= 0x030200) && defined(VISP_HAVE_OPENCV_XFEATURES2D)
306  DESCRIPTOR_VGG,
307  DESCRIPTOR_BoostDesc,
308 #endif
309 #endif
310  DESCRIPTOR_TYPE_SIZE
311  };
312 
322  vpKeyPoint(const vpFeatureDetectorType &detectorType, const vpFeatureDescriptorType &descriptorType,
323  const std::string &matcherName, const vpFilterMatchingType &filterType = ratioDistanceThreshold);
324 
334  vpKeyPoint(const std::string &detectorName = "ORB", const std::string &extractorName = "ORB",
335  const std::string &matcherName = "BruteForce-Hamming",
336  const vpFilterMatchingType &filterType = ratioDistanceThreshold);
337 
347  vpKeyPoint(const std::vector<std::string> &detectorNames, const std::vector<std::string> &extractorNames,
348  const std::string &matcherName = "BruteForce",
349  const vpFilterMatchingType &filterType = ratioDistanceThreshold);
350 
357  unsigned int buildReference(const vpImage<unsigned char> &I);
358 
368  unsigned int buildReference(const vpImage<unsigned char> &I, const vpImagePoint &iP, unsigned int height,
369  unsigned int width);
370 
378  unsigned int buildReference(const vpImage<unsigned char> &I, const vpRect &rectangle);
379 
391  unsigned int buildReference(const vpImage<unsigned char> &I, std::vector<cv::KeyPoint> &trainKeyPoints,
392  std::vector<cv::Point3f> &points3f, bool append = false, int class_id = -1);
393 
407  unsigned int buildReference(const vpImage<unsigned char> &I, const std::vector<cv::KeyPoint> &trainKeyPoints,
408  const cv::Mat &trainDescriptors, const std::vector<cv::Point3f> &points3f,
409  bool append = false, int class_id = -1);
410 
417  unsigned int buildReference(const vpImage<vpRGBa> &I_color);
418 
428  unsigned int buildReference(const vpImage<vpRGBa> &I_color, const vpImagePoint &iP, unsigned int height,
429  unsigned int width);
430 
438  unsigned int buildReference(const vpImage<vpRGBa> &I_color, const vpRect &rectangle);
439 
451  unsigned int buildReference(const vpImage<vpRGBa> &I_color, std::vector<cv::KeyPoint> &trainKeyPoints,
452  std::vector<cv::Point3f> &points3f, bool append = false, int class_id = -1);
453 
466  unsigned int buildReference(const vpImage<vpRGBa> &I_color, const std::vector<cv::KeyPoint> &trainKeyPoints,
467  const cv::Mat &trainDescriptors, const std::vector<cv::Point3f> &points3f,
468  bool append = false, int class_id = -1);
469 
485  static void compute3D(const cv::KeyPoint &candidate, const std::vector<vpPoint> &roi, const vpCameraParameters &cam,
486  const vpHomogeneousMatrix &cMo, cv::Point3f &point);
487 
503  static void compute3D(const vpImagePoint &candidate, const std::vector<vpPoint> &roi, const vpCameraParameters &cam,
504  const vpHomogeneousMatrix &cMo, vpPoint &point);
505 
522  static void compute3DForPointsInPolygons(const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
523  std::vector<cv::KeyPoint> &candidates,
524  const std::vector<vpPolygon> &polygons,
525  const std::vector<std::vector<vpPoint> > &roisPt,
526  std::vector<cv::Point3f> &points, cv::Mat *descriptors = nullptr);
527 
544  static void compute3DForPointsInPolygons(const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
545  std::vector<vpImagePoint> &candidates,
546  const std::vector<vpPolygon> &polygons,
547  const std::vector<std::vector<vpPoint> > &roisPt,
548  std::vector<vpPoint> &points, cv::Mat *descriptors = nullptr);
549 
565  static void
566  compute3DForPointsOnCylinders(const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
567  std::vector<cv::KeyPoint> &candidates, const std::vector<vpCylinder> &cylinders,
568  const std::vector<std::vector<std::vector<vpImagePoint> > > &vectorOfCylinderRois,
569  std::vector<cv::Point3f> &points, cv::Mat *descriptors = nullptr);
570 
586  static void
587  compute3DForPointsOnCylinders(const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
588  std::vector<vpImagePoint> &candidates, const std::vector<vpCylinder> &cylinders,
589  const std::vector<std::vector<std::vector<vpImagePoint> > > &vectorOfCylinderRois,
590  std::vector<vpPoint> &points, cv::Mat *descriptors = nullptr);
591 
605  bool computePose(const std::vector<cv::Point2f> &imagePoints, const std::vector<cv::Point3f> &objectPoints,
606  const vpCameraParameters &cam, vpHomogeneousMatrix &cMo, std::vector<int> &inlierIndex,
607  double &elapsedTime, bool (*func)(const vpHomogeneousMatrix &) = nullptr);
608 
621  bool computePose(const std::vector<vpPoint> &objectVpPoints, vpHomogeneousMatrix &cMo, std::vector<vpPoint> &inliers,
622  double &elapsedTime, bool (*func)(const vpHomogeneousMatrix &) = nullptr);
623 
637  bool computePose(const std::vector<vpPoint> &objectVpPoints, vpHomogeneousMatrix &cMo, std::vector<vpPoint> &inliers,
638  std::vector<unsigned int> &inlierIndex, double &elapsedTime,
639  bool (*func)(const vpHomogeneousMatrix &) = nullptr);
640 
649  void createImageMatching(vpImage<unsigned char> &IRef, vpImage<unsigned char> &ICurrent,
650  vpImage<unsigned char> &IMatching);
651 
661  void createImageMatching(vpImage<unsigned char> &ICurrent, vpImage<unsigned char> &IMatching);
662 
671  void createImageMatching(vpImage<unsigned char> &IRef, vpImage<vpRGBa> &ICurrent, vpImage<vpRGBa> &IMatching);
672 
682  void createImageMatching(vpImage<vpRGBa> &ICurrent, vpImage<vpRGBa> &IMatching);
683 
691  void detect(const vpImage<unsigned char> &I, std::vector<cv::KeyPoint> &keyPoints,
692  const vpRect &rectangle = vpRect());
693 
701  void detect(const vpImage<vpRGBa> &I_color, std::vector<cv::KeyPoint> &keyPoints, const vpRect &rectangle = vpRect());
702 
710  void detect(const cv::Mat &matImg, std::vector<cv::KeyPoint> &keyPoints, const cv::Mat &mask = cv::Mat());
711 
720  void detect(const vpImage<unsigned char> &I, std::vector<cv::KeyPoint> &keyPoints, double &elapsedTime,
721  const vpRect &rectangle = vpRect());
722 
731  void detect(const vpImage<vpRGBa> &I_color, std::vector<cv::KeyPoint> &keyPoints, double &elapsedTime,
732  const vpRect &rectangle = vpRect());
733 
742  void detect(const cv::Mat &matImg, std::vector<cv::KeyPoint> &keyPoints, double &elapsedTime,
743  const cv::Mat &mask = cv::Mat());
744 
759  void detectExtractAffine(const vpImage<unsigned char> &I, std::vector<std::vector<cv::KeyPoint> > &listOfKeypoints,
760  std::vector<cv::Mat> &listOfDescriptors,
761  std::vector<vpImage<unsigned char> > *listOfAffineI = nullptr);
762 
770  void display(const vpImage<unsigned char> &IRef, const vpImage<unsigned char> &ICurrent, unsigned int size = 3);
771 
779  void display(const vpImage<unsigned char> &ICurrent, unsigned int size = 3, const vpColor &color = vpColor::green);
780 
788  void display(const vpImage<vpRGBa> &IRef, const vpImage<vpRGBa> &ICurrent, unsigned int size = 3);
789 
797  void display(const vpImage<vpRGBa> &ICurrent, unsigned int size = 3, const vpColor &color = vpColor::green);
798 
810  void displayMatching(const vpImage<unsigned char> &IRef, vpImage<unsigned char> &IMatching, unsigned int crossSize,
811  unsigned int lineThickness = 1, const vpColor &color = vpColor::green);
812 
824  void displayMatching(const vpImage<unsigned char> &ICurrent, vpImage<unsigned char> &IMatching,
825  const std::vector<vpImagePoint> &ransacInliers = std::vector<vpImagePoint>(),
826  unsigned int crossSize = 3, unsigned int lineThickness = 1);
827 
839  void displayMatching(const vpImage<unsigned char> &IRef, vpImage<vpRGBa> &IMatching, unsigned int crossSize,
840  unsigned int lineThickness = 1, const vpColor &color = vpColor::green);
841 
853  void displayMatching(const vpImage<vpRGBa> &IRef, vpImage<vpRGBa> &IMatching, unsigned int crossSize,
854  unsigned int lineThickness = 1, const vpColor &color = vpColor::green);
855 
867  void displayMatching(const vpImage<vpRGBa> &ICurrent, vpImage<vpRGBa> &IMatching,
868  const std::vector<vpImagePoint> &ransacInliers = std::vector<vpImagePoint>(),
869  unsigned int crossSize = 3, unsigned int lineThickness = 1);
870 
881  void extract(const vpImage<unsigned char> &I, std::vector<cv::KeyPoint> &keyPoints, cv::Mat &descriptors,
882  std::vector<cv::Point3f> *trainPoints = nullptr);
883 
894  void extract(const vpImage<vpRGBa> &I_color, std::vector<cv::KeyPoint> &keyPoints, cv::Mat &descriptors,
895  std::vector<cv::Point3f> *trainPoints = nullptr);
896 
907  void extract(const cv::Mat &matImg, std::vector<cv::KeyPoint> &keyPoints, cv::Mat &descriptors,
908  std::vector<cv::Point3f> *trainPoints = nullptr);
909 
921  void extract(const vpImage<unsigned char> &I, std::vector<cv::KeyPoint> &keyPoints, cv::Mat &descriptors,
922  double &elapsedTime, std::vector<cv::Point3f> *trainPoints = nullptr);
923 
935  void extract(const vpImage<vpRGBa> &I_color, std::vector<cv::KeyPoint> &keyPoints, cv::Mat &descriptors,
936  double &elapsedTime, std::vector<cv::Point3f> *trainPoints = nullptr);
937 
949  void extract(const cv::Mat &matImg, std::vector<cv::KeyPoint> &keyPoints, cv::Mat &descriptors, double &elapsedTime,
950  std::vector<cv::Point3f> *trainPoints = nullptr);
951 
962  {
963  if (!m_computeCovariance) {
964  std::cout << "Warning : The covariance matrix has not been computed. "
965  "See setCovarianceComputation() to do it."
966  << std::endl;
967  return vpMatrix();
968  }
969 
970  if (m_computeCovariance && !m_useRansacVVS) {
971  std::cout << "Warning : The covariance matrix can only be computed "
972  "with a Virtual Visual Servoing approach."
973  << std::endl
974  << "Use setUseRansacVVS(true) to choose to use a pose "
975  "estimation method based on a Virtual Visual Servoing "
976  "approach."
977  << std::endl;
978  return vpMatrix();
979  }
980 
981  return m_covarianceMatrix;
982  }
983 
989  inline double getDetectionTime() const { return m_detectionTime; }
990 
998  inline cv::Ptr<cv::FeatureDetector> getDetector(const vpFeatureDetectorType &type) const
999  {
1000  std::map<vpFeatureDetectorType, std::string>::const_iterator it_name = m_mapOfDetectorNames.find(type);
1001  if (it_name == m_mapOfDetectorNames.end()) {
1002  std::cerr << "Internal problem with the feature type and the "
1003  "corresponding name!"
1004  << std::endl;
1005  }
1006 
1007  std::map<std::string, cv::Ptr<cv::FeatureDetector> >::const_iterator findDetector =
1008  m_detectors.find(it_name->second);
1009  if (findDetector != m_detectors.end()) {
1010  return findDetector->second;
1011  }
1012 
1013  std::cerr << "Cannot find: " << it_name->second << std::endl;
1014  return cv::Ptr<cv::FeatureDetector>();
1015  }
1016 
1024  inline cv::Ptr<cv::FeatureDetector> getDetector(const std::string &name) const
1025  {
1026  std::map<std::string, cv::Ptr<cv::FeatureDetector> >::const_iterator findDetector = m_detectors.find(name);
1027  if (findDetector != m_detectors.end()) {
1028  return findDetector->second;
1029  }
1030 
1031  std::cerr << "Cannot find: " << name << std::endl;
1032  return cv::Ptr<cv::FeatureDetector>();
1033  }
1034 
1038  inline std::map<vpFeatureDetectorType, std::string> getDetectorNames() const { return m_mapOfDetectorNames; }
1039 
1045  inline double getExtractionTime() const { return m_extractionTime; }
1046 
1054  inline cv::Ptr<cv::DescriptorExtractor> getExtractor(const vpFeatureDescriptorType &type) const
1055  {
1056  std::map<vpFeatureDescriptorType, std::string>::const_iterator it_name = m_mapOfDescriptorNames.find(type);
1057  if (it_name == m_mapOfDescriptorNames.end()) {
1058  std::cerr << "Internal problem with the feature type and the "
1059  "corresponding name!"
1060  << std::endl;
1061  }
1062 
1063  std::map<std::string, cv::Ptr<cv::DescriptorExtractor> >::const_iterator findExtractor =
1064  m_extractors.find(it_name->second);
1065  if (findExtractor != m_extractors.end()) {
1066  return findExtractor->second;
1067  }
1068 
1069  std::cerr << "Cannot find: " << it_name->second << std::endl;
1070  return cv::Ptr<cv::DescriptorExtractor>();
1071  }
1072 
1080  inline cv::Ptr<cv::DescriptorExtractor> getExtractor(const std::string &name) const
1081  {
1082  std::map<std::string, cv::Ptr<cv::DescriptorExtractor> >::const_iterator findExtractor = m_extractors.find(name);
1083  if (findExtractor != m_extractors.end()) {
1084  return findExtractor->second;
1085  }
1086 
1087  std::cerr << "Cannot find: " << name << std::endl;
1088  return cv::Ptr<cv::DescriptorExtractor>();
1089  }
1090 
1094  inline std::map<vpFeatureDescriptorType, std::string> getExtractorNames() const { return m_mapOfDescriptorNames; }
1095 
1101  inline vpImageFormatType getImageFormat() const { return m_imageFormat; }
1102 
1108  inline double getMatchingTime() const { return m_matchingTime; }
1109 
1115  inline cv::Ptr<cv::DescriptorMatcher> getMatcher() const { return m_matcher; }
1116 
1123  inline std::vector<cv::DMatch> getMatches() const { return m_filteredMatches; }
1124 
1132  inline std::vector<std::pair<cv::KeyPoint, cv::KeyPoint> > getMatchQueryToTrainKeyPoints() const
1133  {
1134  std::vector<std::pair<cv::KeyPoint, cv::KeyPoint> > matchQueryToTrainKeyPoints(m_filteredMatches.size());
1135  for (size_t i = 0; i < m_filteredMatches.size(); i++) {
1136  matchQueryToTrainKeyPoints.push_back(
1137  std::pair<cv::KeyPoint, cv::KeyPoint>(m_queryFilteredKeyPoints[(size_t)m_filteredMatches[i].queryIdx],
1138  m_trainKeyPoints[(size_t)m_filteredMatches[i].trainIdx]));
1139  }
1140  return matchQueryToTrainKeyPoints;
1141  }
1142 
1148  inline unsigned int getNbImages() const { return static_cast<unsigned int>(m_mapOfImages.size()); }
1149 
1157  void getObjectPoints(std::vector<cv::Point3f> &objectPoints) const;
1158 
1166  void getObjectPoints(std::vector<vpPoint> &objectPoints) const;
1167 
1173  inline double getPoseTime() const { return m_poseTime; }
1174 
1181  inline cv::Mat getQueryDescriptors() const { return m_queryDescriptors; }
1182 
1191  void getQueryKeyPoints(std::vector<cv::KeyPoint> &keyPoints, bool matches = true) const;
1192 
1201  void getQueryKeyPoints(std::vector<vpImagePoint> &keyPoints, bool matches = true) const;
1202 
1208  inline std::vector<vpImagePoint> getRansacInliers() const { return m_ransacInliers; }
1209 
1215  inline std::vector<vpImagePoint> getRansacOutliers() const { return m_ransacOutliers; }
1216 
1223  inline cv::Mat getTrainDescriptors() const { return m_trainDescriptors; }
1224 
1230  void getTrainKeyPoints(std::vector<cv::KeyPoint> &keyPoints) const;
1231 
1237  void getTrainKeyPoints(std::vector<vpImagePoint> &keyPoints) const;
1238 
1245  void getTrainPoints(std::vector<cv::Point3f> &points) const;
1246 
1253  void getTrainPoints(std::vector<vpPoint> &points) const;
1254 
1260  void initMatcher(const std::string &matcherName);
1261 
1270  void insertImageMatching(const vpImage<unsigned char> &IRef, const vpImage<unsigned char> &ICurrent,
1271  vpImage<unsigned char> &IMatching);
1272 
1280  void insertImageMatching(const vpImage<unsigned char> &ICurrent, vpImage<unsigned char> &IMatching);
1281 
1290  void insertImageMatching(const vpImage<vpRGBa> &IRef, const vpImage<vpRGBa> &ICurrent, vpImage<vpRGBa> &IMatching);
1291 
1299  void insertImageMatching(const vpImage<vpRGBa> &ICurrent, vpImage<vpRGBa> &IMatching);
1300 
1306  void loadConfigFile(const std::string &configFile);
1307 
1316  void loadLearningData(const std::string &filename, bool binaryMode = false, bool append = false);
1317 
1326  void match(const cv::Mat &trainDescriptors, const cv::Mat &queryDescriptors, std::vector<cv::DMatch> &matches,
1327  double &elapsedTime);
1328 
1336  unsigned int matchPoint(const vpImage<unsigned char> &I);
1337 
1348  unsigned int matchPoint(const vpImage<unsigned char> &I, const vpImagePoint &iP, unsigned int height,
1349  unsigned int width);
1350 
1359  unsigned int matchPoint(const vpImage<unsigned char> &I, const vpRect &rectangle);
1360 
1369  unsigned int matchPoint(const std::vector<cv::KeyPoint> &queryKeyPoints, const cv::Mat &queryDescriptors);
1370 
1384  bool (*func)(const vpHomogeneousMatrix &) = nullptr, const vpRect &rectangle = vpRect());
1385 
1402  double &error, double &elapsedTime, bool (*func)(const vpHomogeneousMatrix &) = nullptr,
1403  const vpRect &rectangle = vpRect());
1404 
1425  bool matchPointAndDetect(const vpImage<unsigned char> &I, vpRect &boundingBox, vpImagePoint &centerOfGravity,
1426  const bool isPlanarObject = true, std::vector<vpImagePoint> *imPts1 = nullptr,
1427  std::vector<vpImagePoint> *imPts2 = nullptr, double *meanDescriptorDistance = nullptr,
1428  double *detectionScore = nullptr, const vpRect &rectangle = vpRect());
1429 
1449  bool matchPointAndDetect(const vpImage<unsigned char> &I, const vpCameraParameters &cam, vpHomogeneousMatrix &cMo,
1450  double &error, double &elapsedTime, vpRect &boundingBox, vpImagePoint &centerOfGravity,
1451  bool (*func)(const vpHomogeneousMatrix &) = nullptr, const vpRect &rectangle = vpRect());
1452 
1460  unsigned int matchPoint(const vpImage<vpRGBa> &I_color);
1461 
1472  unsigned int matchPoint(const vpImage<vpRGBa> &I_color, const vpImagePoint &iP, unsigned int height,
1473  unsigned int width);
1474 
1483  unsigned int matchPoint(const vpImage<vpRGBa> &I_color, const vpRect &rectangle);
1484 
1497  bool matchPoint(const vpImage<vpRGBa> &I_color, const vpCameraParameters &cam, vpHomogeneousMatrix &cMo,
1498  bool (*func)(const vpHomogeneousMatrix &) = nullptr, const vpRect &rectangle = vpRect());
1499 
1515  bool matchPoint(const vpImage<vpRGBa> &I_color, const vpCameraParameters &cam, vpHomogeneousMatrix &cMo,
1516  double &error, double &elapsedTime, bool (*func)(const vpHomogeneousMatrix &) = nullptr,
1517  const vpRect &rectangle = vpRect());
1518 
1522  void reset();
1523 
1532  void saveLearningData(const std::string &filename, bool binaryMode = false, bool saveTrainingImages = true);
1533 
1540  inline void setCovarianceComputation(const bool &flag)
1541  {
1542  m_computeCovariance = flag;
1543  if (!m_useRansacVVS) {
1544  std::cout << "Warning : The covariance matrix can only be computed "
1545  "with a Virtual Visual Servoing approach."
1546  << std::endl
1547  << "Use setUseRansacVVS(true) to choose to use a pose "
1548  "estimation method based on a Virtual "
1549  "Visual Servoing approach."
1550  << std::endl;
1551  }
1552  }
1553 
1559  inline void setDetectionMethod(const vpDetectionMethodType &method) { m_detectionMethod = method; }
1560 
1566  inline void setDetector(const vpFeatureDetectorType &detectorType)
1567  {
1568  m_detectorNames.clear();
1569  m_detectorNames.push_back(m_mapOfDetectorNames[detectorType]);
1570  m_detectors.clear();
1571  initDetector(m_mapOfDetectorNames[detectorType]);
1572  }
1573 
1579  inline void setDetector(const std::string &detectorName)
1580  {
1581  m_detectorNames.clear();
1582  m_detectorNames.push_back(detectorName);
1583  m_detectors.clear();
1584  initDetector(detectorName);
1585  }
1586 
1587 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400 && VISP_HAVE_OPENCV_VERSION < 0x030000)
1596  template <typename T1, typename T2, typename T3>
1597  inline void setDetectorParameter(const T1 detectorName, const T2 parameterName, const T3 value)
1598  {
1599  if (m_detectors.find(detectorName) != m_detectors.end()) {
1600  m_detectors[detectorName]->set(parameterName, value);
1601  }
1602  }
1603 #endif
1604 
1611  inline void setDetectors(const std::vector<std::string> &detectorNames)
1612  {
1613  m_detectorNames.clear();
1614  m_detectors.clear();
1615  m_detectorNames = detectorNames;
1616  initDetectors(m_detectorNames);
1617  }
1618 
1624  inline void setExtractor(const vpFeatureDescriptorType &extractorType)
1625  {
1626  m_extractorNames.clear();
1627  m_extractorNames.push_back(m_mapOfDescriptorNames[extractorType]);
1628  m_extractors.clear();
1629  initExtractor(m_mapOfDescriptorNames[extractorType]);
1630  }
1631 
1638  inline void setExtractor(const std::string &extractorName)
1639  {
1640  m_extractorNames.clear();
1641  m_extractorNames.push_back(extractorName);
1642  m_extractors.clear();
1643  initExtractor(extractorName);
1644  }
1645 
1646 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400 && VISP_HAVE_OPENCV_VERSION < 0x030000)
1655  template <typename T1, typename T2, typename T3>
1656  inline void setExtractorParameter(const T1 extractorName, const T2 parameterName, const T3 value)
1657  {
1658  if (m_extractors.find(extractorName) != m_extractors.end()) {
1659  m_extractors[extractorName]->set(parameterName, value);
1660  }
1661  }
1662 #endif
1663 
1670  inline void setExtractors(const std::vector<std::string> &extractorNames)
1671  {
1672  m_extractorNames.clear();
1673  m_extractorNames = extractorNames;
1674  m_extractors.clear();
1675  initExtractors(m_extractorNames);
1676  }
1677 
1683  inline void setImageFormat(const vpImageFormatType &imageFormat) { m_imageFormat = imageFormat; }
1684 
1700  inline void setMatcher(const std::string &matcherName)
1701  {
1702  m_matcherName = matcherName;
1703  initMatcher(m_matcherName);
1704  }
1705 
1711  void setMaxFeatures(int maxFeatures) { m_maxFeatures = maxFeatures; }
1712 
1728  inline void setFilterMatchingType(const vpFilterMatchingType &filterType)
1729  {
1730  m_filterType = filterType;
1731 
1732  // Use k-nearest neighbors (knn) to retrieve the two best matches for a
1733  // keypoint So this is useful only for ratioDistanceThreshold method
1734  if (filterType == ratioDistanceThreshold || filterType == stdAndRatioDistanceThreshold) {
1735  m_useKnn = true;
1736 
1737 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400 && VISP_HAVE_OPENCV_VERSION < 0x030000)
1738  if (m_matcher != nullptr && m_matcherName == "BruteForce") {
1739  // if a matcher is already initialized, disable the crossCheck
1740  // because it will not work with knnMatch
1741  m_matcher->set("crossCheck", false);
1742  }
1743 #endif
1744  }
1745  else {
1746  m_useKnn = false;
1747 
1748 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400 && VISP_HAVE_OPENCV_VERSION < 0x030000)
1749  if (m_matcher != nullptr && m_matcherName == "BruteForce") {
1750  // if a matcher is already initialized, set the crossCheck mode if
1751  // necessary
1752  m_matcher->set("crossCheck", m_useBruteForceCrossCheck);
1753  }
1754 #endif
1755  }
1756  }
1757 
1764  inline void setMatchingFactorThreshold(const double factor)
1765  {
1766  if (factor > 0.0) {
1767  m_matchingFactorThreshold = factor;
1768  }
1769  else {
1770  throw vpException(vpException::badValue, "The factor must be positive.");
1771  }
1772  }
1773 
1779  inline void setMatchingRatioThreshold(double ratio)
1780  {
1781  if (ratio > 0.0 && (ratio < 1.0 || std::fabs(ratio - 1.0) < std::numeric_limits<double>::epsilon())) {
1782  m_matchingRatioThreshold = ratio;
1783  }
1784  else {
1785  throw vpException(vpException::badValue, "The ratio must be in the interval ]0 ; 1].");
1786  }
1787  }
1788 
1795  inline void setRansacConsensusPercentage(double percentage)
1796  {
1797  if (percentage > 0.0 &&
1798  (percentage < 100.0 || std::fabs(percentage - 100.0) < std::numeric_limits<double>::epsilon())) {
1799  m_ransacConsensusPercentage = percentage;
1800  }
1801  else {
1802  throw vpException(vpException::badValue, "The percentage must be in the interval ]0 ; 100].");
1803  }
1804  }
1805 
1809  inline void setRansacFilterFlag(const vpPose::RANSAC_FILTER_FLAGS &flag) { m_ransacFilterFlag = flag; }
1810 
1817  inline void setRansacIteration(int nbIter)
1818  {
1819  if (nbIter > 0) {
1820  m_nbRansacIterations = nbIter;
1821  }
1822  else {
1823  throw vpException(vpException::badValue, "The number of iterations must be greater than zero.");
1824  }
1825  }
1826 
1832  inline void setRansacParallel(bool parallel) { m_ransacParallel = parallel; }
1833 
1840  inline void setRansacParallelNbThreads(unsigned int nthreads) { m_ransacParallelNbThreads = nthreads; }
1841 
1849  inline void setRansacReprojectionError(double reprojectionError)
1850  {
1851  if (reprojectionError > 0.0) {
1852  m_ransacReprojectionError = reprojectionError;
1853  }
1854  else {
1855  throw vpException(vpException::badValue, "The Ransac reprojection "
1856  "threshold must be positive "
1857  "as we deal with distance.");
1858  }
1859  }
1860 
1866  inline void setRansacMinInlierCount(int minCount)
1867  {
1868  if (minCount > 0) {
1869  m_nbRansacMinInlierCount = minCount;
1870  }
1871  else {
1872  throw vpException(vpException::badValue, "The minimum number of inliers must be greater than zero.");
1873  }
1874  }
1875 
1882  inline void setRansacThreshold(double threshold)
1883  {
1884  if (threshold > 0.0) {
1885  m_ransacThreshold = threshold;
1886  }
1887  else {
1888  throw vpException(vpException::badValue, "The Ransac threshold must be positive as we deal with distance.");
1889  }
1890  }
1891 
1899  inline void setUseAffineDetection(bool useAffine) { m_useAffineDetection = useAffine; }
1900 
1901 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400 && VISP_HAVE_OPENCV_VERSION < 0x030000)
1908  inline void setUseBruteForceCrossCheck(bool useCrossCheck)
1909  {
1910  // Only available with BruteForce and with k=1 (i.e not used with a
1911  // ratioDistanceThreshold method)
1912  if (m_matcher != nullptr && !m_useKnn && m_matcherName == "BruteForce") {
1913  m_matcher->set("crossCheck", useCrossCheck);
1914  }
1915  else if (m_matcher != nullptr && m_useKnn && m_matcherName == "BruteForce") {
1916  std::cout << "Warning, you try to set the crossCheck parameter with a "
1917  "BruteForce matcher but knn is enabled";
1918  std::cout << " (the filtering method uses a ratio constraint)" << std::endl;
1919  }
1920  }
1921 #endif
1922 
1929  inline void setUseMatchTrainToQuery(bool useMatchTrainToQuery) { m_useMatchTrainToQuery = useMatchTrainToQuery; }
1930 
1938  inline void setUseRansacConsensusPercentage(bool usePercentage) { m_useConsensusPercentage = usePercentage; }
1939 
1947  inline void setUseRansacVVS(bool ransacVVS) { m_useRansacVVS = ransacVVS; }
1948 
1955  inline void setUseSingleMatchFilter(bool singleMatchFilter) { m_useSingleMatchFilter = singleMatchFilter; }
1956 
1957 private:
1960  bool m_computeCovariance;
1962  vpMatrix m_covarianceMatrix;
1964  int m_currentImageId;
1967  vpDetectionMethodType m_detectionMethod;
1969  double m_detectionScore;
1972  double m_detectionThreshold;
1974  double m_detectionTime;
1976  std::vector<std::string> m_detectorNames;
1979  // with a key based upon the detector name.
1980  std::map<std::string, cv::Ptr<cv::FeatureDetector> > m_detectors;
1982  double m_extractionTime;
1984  std::vector<std::string> m_extractorNames;
1987  // with a key based upon the extractor name.
1988  std::map<std::string, cv::Ptr<cv::DescriptorExtractor> > m_extractors;
1990  std::vector<cv::DMatch> m_filteredMatches;
1992  vpFilterMatchingType m_filterType;
1994  vpImageFormatType m_imageFormat;
1997  std::vector<std::vector<cv::DMatch> > m_knnMatches;
1999  std::map<vpFeatureDescriptorType, std::string> m_mapOfDescriptorNames;
2001  std::map<vpFeatureDetectorType, std::string> m_mapOfDetectorNames;
2004  std::map<int, int> m_mapOfImageId;
2007  std::map<int, vpImage<unsigned char> > m_mapOfImages;
2010  cv::Ptr<cv::DescriptorMatcher> m_matcher;
2012  std::string m_matcherName;
2014  std::vector<cv::DMatch> m_matches;
2016  double m_matchingFactorThreshold;
2018  double m_matchingRatioThreshold;
2020  double m_matchingTime;
2022  std::vector<std::pair<cv::KeyPoint, cv::Point3f> > m_matchRansacKeyPointsToPoints;
2024  int m_nbRansacIterations;
2026  int m_nbRansacMinInlierCount;
2029  std::vector<cv::Point3f> m_objectFilteredPoints;
2031  double m_poseTime;
2034  cv::Mat m_queryDescriptors;
2036  std::vector<cv::KeyPoint> m_queryFilteredKeyPoints;
2038  std::vector<cv::KeyPoint> m_queryKeyPoints;
2041  double m_ransacConsensusPercentage;
2043  vpPose::RANSAC_FILTER_FLAGS m_ransacFilterFlag;
2045  std::vector<vpImagePoint> m_ransacInliers;
2047  std::vector<vpImagePoint> m_ransacOutliers;
2049  bool m_ransacParallel;
2051  unsigned int m_ransacParallelNbThreads;
2054  double m_ransacReprojectionError;
2057  double m_ransacThreshold;
2060  // detected in the train images).
2061  cv::Mat m_trainDescriptors;
2063  std::vector<cv::KeyPoint> m_trainKeyPoints;
2066  std::vector<cv::Point3f> m_trainPoints;
2069  std::vector<vpPoint> m_trainVpPoints;
2072  bool m_useAffineDetection;
2073 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400 && VISP_HAVE_OPENCV_VERSION < 0x030000)
2077  bool m_useBruteForceCrossCheck;
2078 #endif
2081  bool m_useConsensusPercentage;
2083  bool m_useKnn;
2088  bool m_useMatchTrainToQuery;
2090  bool m_useRansacVVS;
2093  bool m_useSingleMatchFilter;
2097  int m_maxFeatures;
2098 
2107  void affineSkew(double tilt, double phi, cv::Mat &img, cv::Mat &mask, cv::Mat &Ai);
2108 
2123  double computePoseEstimationError(const std::vector<std::pair<cv::KeyPoint, cv::Point3f> > &matchKeyPoints,
2124  const vpCameraParameters &cam, const vpHomogeneousMatrix &cMo_est);
2125 
2129  void filterMatches();
2130 
2135  void init();
2136 
2142  void initDetector(const std::string &detectorNames);
2143 
2150  void initDetectors(const std::vector<std::string> &detectorNames);
2151 
2157  void initExtractor(const std::string &extractorName);
2158 
2165  void initExtractors(const std::vector<std::string> &extractorNames);
2166 
2170  void initFeatureNames();
2171 
2172  inline size_t myKeypointHash(const cv::KeyPoint &kp)
2173  {
2174  size_t _Val = 2166136261U, scale = 16777619U;
2175  Cv32suf u;
2176  u.f = kp.pt.x;
2177  _Val = (scale * _Val) ^ u.u;
2178  u.f = kp.pt.y;
2179  _Val = (scale * _Val) ^ u.u;
2180  u.f = kp.size;
2181  _Val = (scale * _Val) ^ u.u;
2182  // As the keypoint angle can be computed for certain type of keypoint only
2183  // when extracting the corresponding descriptor, the angle field is not
2184  // taking into account for the hash
2185  // u.f = kp.angle; _Val = (scale * _Val) ^ u.u;
2186  u.f = kp.response;
2187  _Val = (scale * _Val) ^ u.u;
2188  _Val = (scale * _Val) ^ ((size_t)kp.octave);
2189  _Val = (scale * _Val) ^ ((size_t)kp.class_id);
2190  return _Val;
2191  }
2192 
2193 #if (VISP_HAVE_OPENCV_VERSION >= 0x030000)
2194  /*
2195  * Adapts a detector to detect points over multiple levels of a Gaussian
2196  * pyramid. Useful for detectors that are not inherently scaled.
2197  * From OpenCV 2.4.11 source code.
2198  */
2199  class PyramidAdaptedFeatureDetector : public cv::FeatureDetector
2200  {
2201  public:
2202  // maxLevel - The 0-based index of the last pyramid layer
2203  PyramidAdaptedFeatureDetector(const cv::Ptr<cv::FeatureDetector> &detector, int maxLevel = 2);
2204 
2205  // TODO implement read/write
2206  virtual bool empty() const;
2207 
2208  protected:
2209  virtual void detect(cv::InputArray image, CV_OUT std::vector<cv::KeyPoint> &keypoints,
2210  cv::InputArray mask = cv::noArray());
2211  virtual void detectImpl(const cv::Mat &image, std::vector<cv::KeyPoint> &keypoints,
2212  const cv::Mat &mask = cv::Mat()) const;
2213 
2214  cv::Ptr<cv::FeatureDetector> m_detector;
2215  int m_maxLevel;
2216  };
2217 
2218  /*
2219  * A class filters a vector of keypoints.
2220  * Because now it is difficult to provide a convenient interface for all
2221  * usage scenarios of the keypoints filter class, it has only several needed
2222  * by now static methods.
2223  */
2224  class KeyPointsFilter
2225  {
2226  public:
2227  KeyPointsFilter() { }
2228 
2229  /*
2230  * Remove keypoints within borderPixels of an image edge.
2231  */
2232  static void runByImageBorder(std::vector<cv::KeyPoint> &keypoints, cv::Size imageSize, int borderSize);
2233  /*
2234  * Remove keypoints of sizes out of range.
2235  */
2236  static void runByKeypointSize(std::vector<cv::KeyPoint> &keypoints, float minSize, float maxSize = FLT_MAX);
2237  /*
2238  * Remove keypoints from some image by mask for pixels of this image.
2239  */
2240  static void runByPixelsMask(std::vector<cv::KeyPoint> &keypoints, const cv::Mat &mask);
2241  /*
2242  * Remove duplicated keypoints.
2243  */
2244  static void removeDuplicated(std::vector<cv::KeyPoint> &keypoints);
2245 
2246  /*
2247  * Retain the specified number of the best keypoints (according to the
2248  * response)
2249  */
2250  static void retainBest(std::vector<cv::KeyPoint> &keypoints, int npoints);
2251  };
2252 
2253 #endif
2254 };
2255 
2256 #endif
2257 #endif
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.
Definition: vpColor.h:152
static const vpColor green
Definition: vpColor.h:214
error that can be emitted by ViSP classes.
Definition: vpException.h:59
@ badValue
Used to indicate that a value is not in the allowed range.
Definition: vpException.h:85
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 ...
Definition: vpImagePoint.h:82
Class that allows keypoints detection (and descriptors extraction) and matching thanks to OpenCV libr...
Definition: vpKeyPoint.h:212
double getDetectionTime() const
Definition: vpKeyPoint.h:989
std::vector< vpImagePoint > getRansacInliers() const
Definition: vpKeyPoint.h:1208
void setMatchingFactorThreshold(const double factor)
Definition: vpKeyPoint.h:1764
void setRansacConsensusPercentage(double percentage)
Definition: vpKeyPoint.h:1795
cv::Ptr< cv::DescriptorMatcher > getMatcher() const
Definition: vpKeyPoint.h:1115
vpDetectionMethodType
Definition: vpKeyPoint.h:231
void setRansacParallel(bool parallel)
Definition: vpKeyPoint.h:1832
void setRansacReprojectionError(double reprojectionError)
Definition: vpKeyPoint.h:1849
void setExtractor(const std::string &extractorName)
Definition: vpKeyPoint.h:1638
void setUseSingleMatchFilter(bool singleMatchFilter)
Definition: vpKeyPoint.h:1955
void setFilterMatchingType(const vpFilterMatchingType &filterType)
Definition: vpKeyPoint.h:1728
void setRansacParallelNbThreads(unsigned int nthreads)
Definition: vpKeyPoint.h:1840
double getExtractionTime() const
Definition: vpKeyPoint.h:1045
void setUseRansacVVS(bool ransacVVS)
Definition: vpKeyPoint.h:1947
void setDetectors(const std::vector< std::string > &detectorNames)
Definition: vpKeyPoint.h:1611
void setExtractors(const std::vector< std::string > &extractorNames)
Definition: vpKeyPoint.h:1670
cv::Mat getTrainDescriptors() const
Definition: vpKeyPoint.h:1223
vpFeatureDetectorType
Definition: vpKeyPoint.h:250
@ DETECTOR_KAZE
KAZE detector.
Definition: vpKeyPoint.h:269
@ DETECTOR_BRISK
BRISK detector.
Definition: vpKeyPoint.h:255
@ DETECTOR_AKAZE
AKAZE detector.
Definition: vpKeyPoint.h:270
@ DETECTOR_MSER
MSER detector.
Definition: vpKeyPoint.h:253
@ DETECTOR_SURF
SURF detector.
Definition: vpKeyPoint.h:266
@ DETECTOR_AGAST
AGAST detector.
Definition: vpKeyPoint.h:271
@ DETECTOR_SIFT
SIFT detector.
Definition: vpKeyPoint.h:263
@ DETECTOR_FAST
FAST detector.
Definition: vpKeyPoint.h:252
@ DETECTOR_GFTT
GFTT detector.
Definition: vpKeyPoint.h:256
@ DETECTOR_ORB
ORB detector.
Definition: vpKeyPoint.h:254
@ DETECTOR_SimpleBlob
SimpleBlob detector.
Definition: vpKeyPoint.h:257
void setExtractor(const vpFeatureDescriptorType &extractorType)
Definition: vpKeyPoint.h:1624
void setImageFormat(const vpImageFormatType &imageFormat)
Definition: vpKeyPoint.h:1683
void setRansacThreshold(double threshold)
Definition: vpKeyPoint.h:1882
void setRansacMinInlierCount(int minCount)
Definition: vpKeyPoint.h:1866
void setRansacFilterFlag(const vpPose::RANSAC_FILTER_FLAGS &flag)
Definition: vpKeyPoint.h:1809
double getPoseTime() const
Definition: vpKeyPoint.h:1173
std::map< vpFeatureDetectorType, std::string > getDetectorNames() const
Definition: vpKeyPoint.h:1038
unsigned int getNbImages() const
Definition: vpKeyPoint.h:1148
double getMatchingTime() const
Definition: vpKeyPoint.h:1108
std::vector< vpImagePoint > getRansacOutliers() const
Definition: vpKeyPoint.h:1215
vpFeatureDescriptorType
Definition: vpKeyPoint.h:282
@ DESCRIPTOR_AKAZE
AKAZE descriptor.
Definition: vpKeyPoint.h:299
@ DESCRIPTOR_ORB
ORB descriptor.
Definition: vpKeyPoint.h:284
@ DESCRIPTOR_KAZE
KAZE descriptor.
Definition: vpKeyPoint.h:298
@ DESCRIPTOR_SURF
SUFT descriptor.
Definition: vpKeyPoint.h:295
@ DESCRIPTOR_BRISK
BRISK descriptor.
Definition: vpKeyPoint.h:285
@ DESCRIPTOR_SIFT
SIFT descriptor.
Definition: vpKeyPoint.h:292
std::vector< cv::DMatch > getMatches() const
Definition: vpKeyPoint.h:1123
std::map< vpFeatureDescriptorType, std::string > getExtractorNames() const
Definition: vpKeyPoint.h:1094
void setMatcher(const std::string &matcherName)
Definition: vpKeyPoint.h:1700
vpImageFormatType getImageFormat() const
Definition: vpKeyPoint.h:1101
cv::Ptr< cv::DescriptorExtractor > getExtractor(const std::string &name) const
Definition: vpKeyPoint.h:1080
void setUseAffineDetection(bool useAffine)
Definition: vpKeyPoint.h:1899
void setUseRansacConsensusPercentage(bool usePercentage)
Definition: vpKeyPoint.h:1938
void setMatchingRatioThreshold(double ratio)
Definition: vpKeyPoint.h:1779
@ ppmImageFormat
Definition: vpKeyPoint.h:244
@ jpgImageFormat
Definition: vpKeyPoint.h:242
@ pngImageFormat
Definition: vpKeyPoint.h:243
vpFilterMatchingType
Definition: vpKeyPoint.h:216
void setCovarianceComputation(const bool &flag)
Definition: vpKeyPoint.h:1540
void setDetector(const vpFeatureDetectorType &detectorType)
Definition: vpKeyPoint.h:1566
cv::Ptr< cv::DescriptorExtractor > getExtractor(const vpFeatureDescriptorType &type) const
Definition: vpKeyPoint.h:1054
void setUseMatchTrainToQuery(bool useMatchTrainToQuery)
Definition: vpKeyPoint.h:1929
vpMatrix getCovarianceMatrix() const
Definition: vpKeyPoint.h:961
void setDetectionMethod(const vpDetectionMethodType &method)
Definition: vpKeyPoint.h:1559
cv::Ptr< cv::FeatureDetector > getDetector(const std::string &name) const
Definition: vpKeyPoint.h:1024
void setDetector(const std::string &detectorName)
Definition: vpKeyPoint.h:1579
void setMaxFeatures(int maxFeatures)
Definition: vpKeyPoint.h:1711
std::vector< std::pair< cv::KeyPoint, cv::KeyPoint > > getMatchQueryToTrainKeyPoints() const
Definition: vpKeyPoint.h:1132
cv::Ptr< cv::FeatureDetector > getDetector(const vpFeatureDetectorType &type) const
Definition: vpKeyPoint.h:998
void setRansacIteration(int nbIter)
Definition: vpKeyPoint.h:1817
cv::Mat getQueryDescriptors() const
Definition: vpKeyPoint.h:1181
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:146
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Definition: vpPoint.h:77
RANSAC_FILTER_FLAGS
Definition: vpPose.h:108
Defines a rectangle in the plane.
Definition: vpRect.h:76