Visual Servoing Platform  version 3.6.1 under development (2024-11-15)
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 
76 BEGIN_VISP_NAMESPACE
220 class VISP_EXPORT vpKeyPoint : public vpBasicKeyPoint
221 {
222 public:
225  {
226  constantFactorDistanceThreshold,
228  stdDistanceThreshold,
230  ratioDistanceThreshold,
233  stdAndRatioDistanceThreshold,
235  noFilterMatching
236  };
237 
240  {
241  detectionThreshold,
243  detectionScore
246  };
247 
249  typedef enum
250  {
254  pgmImageFormat
255  } vpImageFormatType;
256 
259  {
260 #if (VISP_HAVE_OPENCV_VERSION >= 0x020403)
267 #if (VISP_HAVE_OPENCV_VERSION < 0x030000) || (defined(VISP_HAVE_OPENCV_XFEATURES2D))
268  DETECTOR_STAR,
269 #endif
270 #if defined(VISP_HAVE_OPENCV_NONFREE) || defined(VISP_HAVE_OPENCV_XFEATURES2D) || \
271  (VISP_HAVE_OPENCV_VERSION >= 0x030411 && CV_MAJOR_VERSION < 4) || (VISP_HAVE_OPENCV_VERSION >= 0x040400)
273 #endif
274 #if defined(VISP_HAVE_OPENCV_NONFREE) || defined(VISP_HAVE_OPENCV_XFEATURES2D)
276 #endif
277 #if (VISP_HAVE_OPENCV_VERSION >= 0x030000)
281 #endif
282 #if (VISP_HAVE_OPENCV_VERSION >= 0x030100) && defined(VISP_HAVE_OPENCV_XFEATURES2D)
283  DETECTOR_MSD,
284 #endif
285 #endif
286  DETECTOR_TYPE_SIZE
287  };
288 
291  {
292 #if (VISP_HAVE_OPENCV_VERSION >= 0x020403)
295 #if (VISP_HAVE_OPENCV_VERSION < 0x030000) || (defined(VISP_HAVE_OPENCV_XFEATURES2D))
296  DESCRIPTOR_FREAK,
297  DESCRIPTOR_BRIEF,
298 #endif
299 #if defined(VISP_HAVE_OPENCV_NONFREE) || defined(VISP_HAVE_OPENCV_XFEATURES2D) || \
300  (VISP_HAVE_OPENCV_VERSION >= 0x030411 && CV_MAJOR_VERSION < 4) || (VISP_HAVE_OPENCV_VERSION >= 0x040400)
302 #endif
303 #if defined(VISP_HAVE_OPENCV_NONFREE) || defined(VISP_HAVE_OPENCV_XFEATURES2D)
305 #endif
306 #if (VISP_HAVE_OPENCV_VERSION >= 0x030000)
309 #if defined(VISP_HAVE_OPENCV_XFEATURES2D)
310  DESCRIPTOR_DAISY,
311  DESCRIPTOR_LATCH,
312 #endif
313 #endif
314 #if (VISP_HAVE_OPENCV_VERSION >= 0x030200) && defined(VISP_HAVE_OPENCV_XFEATURES2D)
315  DESCRIPTOR_VGG,
316  DESCRIPTOR_BoostDesc,
317 #endif
318 #endif
319  DESCRIPTOR_TYPE_SIZE
320  };
321 
331  vpKeyPoint(const vpFeatureDetectorType &detectorType, const vpFeatureDescriptorType &descriptorType,
332  const std::string &matcherName, const vpFilterMatchingType &filterType = ratioDistanceThreshold);
333 
343  vpKeyPoint(const std::string &detectorName = "ORB", const std::string &extractorName = "ORB",
344  const std::string &matcherName = "BruteForce-Hamming",
345  const vpFilterMatchingType &filterType = ratioDistanceThreshold);
346 
356  vpKeyPoint(const std::vector<std::string> &detectorNames, const std::vector<std::string> &extractorNames,
357  const std::string &matcherName = "BruteForce",
358  const vpFilterMatchingType &filterType = ratioDistanceThreshold);
359 
366  unsigned int buildReference(const vpImage<unsigned char> &I);
367 
377  unsigned int buildReference(const vpImage<unsigned char> &I, const vpImagePoint &iP, unsigned int height,
378  unsigned int width);
379 
387  unsigned int buildReference(const vpImage<unsigned char> &I, const vpRect &rectangle);
388 
400  unsigned int buildReference(const vpImage<unsigned char> &I, std::vector<cv::KeyPoint> &trainKeyPoints,
401  std::vector<cv::Point3f> &points3f, bool append = false, int class_id = -1);
402 
416  unsigned int buildReference(const vpImage<unsigned char> &I, const std::vector<cv::KeyPoint> &trainKeyPoints,
417  const cv::Mat &trainDescriptors, const std::vector<cv::Point3f> &points3f,
418  bool append = false, int class_id = -1);
419 
426  unsigned int buildReference(const vpImage<vpRGBa> &I_color);
427 
437  unsigned int buildReference(const vpImage<vpRGBa> &I_color, const vpImagePoint &iP, unsigned int height,
438  unsigned int width);
439 
447  unsigned int buildReference(const vpImage<vpRGBa> &I_color, const vpRect &rectangle);
448 
460  unsigned int buildReference(const vpImage<vpRGBa> &I_color, std::vector<cv::KeyPoint> &trainKeyPoints,
461  std::vector<cv::Point3f> &points3f, bool append = false, int class_id = -1);
462 
475  unsigned int buildReference(const vpImage<vpRGBa> &I_color, const std::vector<cv::KeyPoint> &trainKeyPoints,
476  const cv::Mat &trainDescriptors, const std::vector<cv::Point3f> &points3f,
477  bool append = false, int class_id = -1);
478 
494  static void compute3D(const cv::KeyPoint &candidate, const std::vector<vpPoint> &roi, const vpCameraParameters &cam,
495  const vpHomogeneousMatrix &cMo, cv::Point3f &point);
496 
512  static void compute3D(const vpImagePoint &candidate, const std::vector<vpPoint> &roi, const vpCameraParameters &cam,
513  const vpHomogeneousMatrix &cMo, vpPoint &point);
514 
531  static void compute3DForPointsInPolygons(const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
532  std::vector<cv::KeyPoint> &candidates,
533  const std::vector<vpPolygon> &polygons,
534  const std::vector<std::vector<vpPoint> > &roisPt,
535  std::vector<cv::Point3f> &points, cv::Mat *descriptors = nullptr);
536 
553  static void compute3DForPointsInPolygons(const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
554  std::vector<vpImagePoint> &candidates,
555  const std::vector<vpPolygon> &polygons,
556  const std::vector<std::vector<vpPoint> > &roisPt,
557  std::vector<vpPoint> &points, cv::Mat *descriptors = nullptr);
558 
574  static void
575  compute3DForPointsOnCylinders(const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
576  std::vector<cv::KeyPoint> &candidates, const std::vector<vpCylinder> &cylinders,
577  const std::vector<std::vector<std::vector<vpImagePoint> > > &vectorOfCylinderRois,
578  std::vector<cv::Point3f> &points, cv::Mat *descriptors = nullptr);
579 
595  static void
596  compute3DForPointsOnCylinders(const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
597  std::vector<vpImagePoint> &candidates, const std::vector<vpCylinder> &cylinders,
598  const std::vector<std::vector<std::vector<vpImagePoint> > > &vectorOfCylinderRois,
599  std::vector<vpPoint> &points, cv::Mat *descriptors = nullptr);
600 
614  bool computePose(const std::vector<cv::Point2f> &imagePoints, const std::vector<cv::Point3f> &objectPoints,
615  const vpCameraParameters &cam, vpHomogeneousMatrix &cMo, std::vector<int> &inlierIndex,
616  double &elapsedTime, bool (*func)(const vpHomogeneousMatrix &) = nullptr);
617 
630  bool computePose(const std::vector<vpPoint> &objectVpPoints, vpHomogeneousMatrix &cMo, std::vector<vpPoint> &inliers,
631  double &elapsedTime, bool (*func)(const vpHomogeneousMatrix &) = nullptr);
632 
646  bool computePose(const std::vector<vpPoint> &objectVpPoints, vpHomogeneousMatrix &cMo, std::vector<vpPoint> &inliers,
647  std::vector<unsigned int> &inlierIndex, double &elapsedTime,
648  bool (*func)(const vpHomogeneousMatrix &) = nullptr);
649 
658  void createImageMatching(vpImage<unsigned char> &IRef, vpImage<unsigned char> &ICurrent,
659  vpImage<unsigned char> &IMatching);
660 
670  void createImageMatching(vpImage<unsigned char> &ICurrent, vpImage<unsigned char> &IMatching);
671 
680  void createImageMatching(vpImage<unsigned char> &IRef, vpImage<vpRGBa> &ICurrent, vpImage<vpRGBa> &IMatching);
681 
691  void createImageMatching(vpImage<vpRGBa> &ICurrent, vpImage<vpRGBa> &IMatching);
692 
700  void detect(const vpImage<unsigned char> &I, std::vector<cv::KeyPoint> &keyPoints,
701  const vpRect &rectangle = vpRect());
702 
710  void detect(const vpImage<vpRGBa> &I_color, std::vector<cv::KeyPoint> &keyPoints, const vpRect &rectangle = vpRect());
711 
719  void detect(const cv::Mat &matImg, std::vector<cv::KeyPoint> &keyPoints, const cv::Mat &mask = cv::Mat());
720 
729  void detect(const vpImage<unsigned char> &I, std::vector<cv::KeyPoint> &keyPoints, double &elapsedTime,
730  const vpRect &rectangle = vpRect());
731 
740  void detect(const vpImage<vpRGBa> &I_color, std::vector<cv::KeyPoint> &keyPoints, double &elapsedTime,
741  const vpRect &rectangle = vpRect());
742 
751  void detect(const cv::Mat &matImg, std::vector<cv::KeyPoint> &keyPoints, double &elapsedTime,
752  const cv::Mat &mask = cv::Mat());
753 
768  void detectExtractAffine(const vpImage<unsigned char> &I, std::vector<std::vector<cv::KeyPoint> > &listOfKeypoints,
769  std::vector<cv::Mat> &listOfDescriptors,
770  std::vector<vpImage<unsigned char> > *listOfAffineI = nullptr);
771 
779  void display(const vpImage<unsigned char> &IRef, const vpImage<unsigned char> &ICurrent, unsigned int size = 3);
780 
788  void display(const vpImage<unsigned char> &ICurrent, unsigned int size = 3, const vpColor &color = vpColor::green);
789 
797  void display(const vpImage<vpRGBa> &IRef, const vpImage<vpRGBa> &ICurrent, unsigned int size = 3);
798 
806  void display(const vpImage<vpRGBa> &ICurrent, unsigned int size = 3, const vpColor &color = vpColor::green);
807 
819  void displayMatching(const vpImage<unsigned char> &IRef, vpImage<unsigned char> &IMatching, unsigned int crossSize,
820  unsigned int lineThickness = 1, const vpColor &color = vpColor::green);
821 
833  void displayMatching(const vpImage<unsigned char> &ICurrent, vpImage<unsigned char> &IMatching,
834  const std::vector<vpImagePoint> &ransacInliers = std::vector<vpImagePoint>(),
835  unsigned int crossSize = 3, unsigned int lineThickness = 1);
836 
848  void displayMatching(const vpImage<unsigned char> &IRef, vpImage<vpRGBa> &IMatching, unsigned int crossSize,
849  unsigned int lineThickness = 1, const vpColor &color = vpColor::green);
850 
862  void displayMatching(const vpImage<vpRGBa> &IRef, vpImage<vpRGBa> &IMatching, unsigned int crossSize,
863  unsigned int lineThickness = 1, const vpColor &color = vpColor::green);
864 
876  void displayMatching(const vpImage<vpRGBa> &ICurrent, vpImage<vpRGBa> &IMatching,
877  const std::vector<vpImagePoint> &ransacInliers = std::vector<vpImagePoint>(),
878  unsigned int crossSize = 3, unsigned int lineThickness = 1);
879 
890  void extract(const vpImage<unsigned char> &I, std::vector<cv::KeyPoint> &keyPoints, cv::Mat &descriptors,
891  std::vector<cv::Point3f> *trainPoints = nullptr);
892 
903  void extract(const vpImage<vpRGBa> &I_color, std::vector<cv::KeyPoint> &keyPoints, cv::Mat &descriptors,
904  std::vector<cv::Point3f> *trainPoints = nullptr);
905 
916  void extract(const cv::Mat &matImg, std::vector<cv::KeyPoint> &keyPoints, cv::Mat &descriptors,
917  std::vector<cv::Point3f> *trainPoints = nullptr);
918 
930  void extract(const vpImage<unsigned char> &I, std::vector<cv::KeyPoint> &keyPoints, cv::Mat &descriptors,
931  double &elapsedTime, std::vector<cv::Point3f> *trainPoints = nullptr);
932 
944  void extract(const vpImage<vpRGBa> &I_color, std::vector<cv::KeyPoint> &keyPoints, cv::Mat &descriptors,
945  double &elapsedTime, std::vector<cv::Point3f> *trainPoints = nullptr);
946 
958  void extract(const cv::Mat &matImg, std::vector<cv::KeyPoint> &keyPoints, cv::Mat &descriptors, double &elapsedTime,
959  std::vector<cv::Point3f> *trainPoints = nullptr);
960 
971  {
972  if (!m_computeCovariance) {
973  std::cout << "Warning : The covariance matrix has not been computed. "
974  "See setCovarianceComputation() to do it."
975  << std::endl;
976  return vpMatrix();
977  }
978 
979  if (m_computeCovariance && !m_useRansacVVS) {
980  std::cout << "Warning : The covariance matrix can only be computed "
981  "with a Virtual Visual Servoing approach."
982  << std::endl
983  << "Use setUseRansacVVS(true) to choose to use a pose "
984  "estimation method based on a Virtual Visual Servoing "
985  "approach."
986  << std::endl;
987  return vpMatrix();
988  }
989 
990  return m_covarianceMatrix;
991  }
992 
998  inline double getDetectionTime() const { return m_detectionTime; }
999 
1007  inline cv::Ptr<cv::FeatureDetector> getDetector(const vpFeatureDetectorType &type) const
1008  {
1009  std::map<vpFeatureDetectorType, std::string>::const_iterator it_name = m_mapOfDetectorNames.find(type);
1010  if (it_name == m_mapOfDetectorNames.end()) {
1011  std::cerr << "Internal problem with the feature type and the "
1012  "corresponding name!"
1013  << std::endl;
1014  }
1015 
1016  std::map<std::string, cv::Ptr<cv::FeatureDetector> >::const_iterator findDetector =
1017  m_detectors.find(it_name->second);
1018  if (findDetector != m_detectors.end()) {
1019  return findDetector->second;
1020  }
1021 
1022  std::cerr << "Cannot find: " << it_name->second << std::endl;
1023  return cv::Ptr<cv::FeatureDetector>();
1024  }
1025 
1033  inline cv::Ptr<cv::FeatureDetector> getDetector(const std::string &name) const
1034  {
1035  std::map<std::string, cv::Ptr<cv::FeatureDetector> >::const_iterator findDetector = m_detectors.find(name);
1036  if (findDetector != m_detectors.end()) {
1037  return findDetector->second;
1038  }
1039 
1040  std::cerr << "Cannot find: " << name << std::endl;
1041  return cv::Ptr<cv::FeatureDetector>();
1042  }
1043 
1047  inline std::map<vpFeatureDetectorType, std::string> getDetectorNames() const { return m_mapOfDetectorNames; }
1048 
1054  inline double getExtractionTime() const { return m_extractionTime; }
1055 
1063  inline cv::Ptr<cv::DescriptorExtractor> getExtractor(const vpFeatureDescriptorType &type) const
1064  {
1065  std::map<vpFeatureDescriptorType, std::string>::const_iterator it_name = m_mapOfDescriptorNames.find(type);
1066  if (it_name == m_mapOfDescriptorNames.end()) {
1067  std::cerr << "Internal problem with the feature type and the "
1068  "corresponding name!"
1069  << std::endl;
1070  }
1071 
1072  std::map<std::string, cv::Ptr<cv::DescriptorExtractor> >::const_iterator findExtractor =
1073  m_extractors.find(it_name->second);
1074  if (findExtractor != m_extractors.end()) {
1075  return findExtractor->second;
1076  }
1077 
1078  std::cerr << "Cannot find: " << it_name->second << std::endl;
1079  return cv::Ptr<cv::DescriptorExtractor>();
1080  }
1081 
1089  inline cv::Ptr<cv::DescriptorExtractor> getExtractor(const std::string &name) const
1090  {
1091  std::map<std::string, cv::Ptr<cv::DescriptorExtractor> >::const_iterator findExtractor = m_extractors.find(name);
1092  if (findExtractor != m_extractors.end()) {
1093  return findExtractor->second;
1094  }
1095 
1096  std::cerr << "Cannot find: " << name << std::endl;
1097  return cv::Ptr<cv::DescriptorExtractor>();
1098  }
1099 
1103  inline std::map<vpFeatureDescriptorType, std::string> getExtractorNames() const { return m_mapOfDescriptorNames; }
1104 
1110  inline vpImageFormatType getImageFormat() const { return m_imageFormat; }
1111 
1117  inline double getMatchingTime() const { return m_matchingTime; }
1118 
1124  inline cv::Ptr<cv::DescriptorMatcher> getMatcher() const { return m_matcher; }
1125 
1132  inline std::vector<cv::DMatch> getMatches() const { return m_filteredMatches; }
1133 
1141  inline std::vector<std::pair<cv::KeyPoint, cv::KeyPoint> > getMatchQueryToTrainKeyPoints() const
1142  {
1143  std::vector<std::pair<cv::KeyPoint, cv::KeyPoint> > matchQueryToTrainKeyPoints(m_filteredMatches.size());
1144  for (size_t i = 0; i < m_filteredMatches.size(); i++) {
1145  matchQueryToTrainKeyPoints.push_back(
1146  std::pair<cv::KeyPoint, cv::KeyPoint>(m_queryFilteredKeyPoints[(size_t)m_filteredMatches[i].queryIdx],
1147  m_trainKeyPoints[(size_t)m_filteredMatches[i].trainIdx]));
1148  }
1149  return matchQueryToTrainKeyPoints;
1150  }
1151 
1157  inline unsigned int getNbImages() const { return static_cast<unsigned int>(m_mapOfImages.size()); }
1158 
1166  void getObjectPoints(std::vector<cv::Point3f> &objectPoints) const;
1167 
1175  void getObjectPoints(std::vector<vpPoint> &objectPoints) const;
1176 
1182  inline double getPoseTime() const { return m_poseTime; }
1183 
1190  inline cv::Mat getQueryDescriptors() const { return m_queryDescriptors; }
1191 
1200  void getQueryKeyPoints(std::vector<cv::KeyPoint> &keyPoints, bool matches = true) const;
1201 
1210  void getQueryKeyPoints(std::vector<vpImagePoint> &keyPoints, bool matches = true) const;
1211 
1217  inline std::vector<vpImagePoint> getRansacInliers() const { return m_ransacInliers; }
1218 
1224  inline std::vector<vpImagePoint> getRansacOutliers() const { return m_ransacOutliers; }
1225 
1232  inline cv::Mat getTrainDescriptors() const { return m_trainDescriptors; }
1233 
1239  void getTrainKeyPoints(std::vector<cv::KeyPoint> &keyPoints) const;
1240 
1246  void getTrainKeyPoints(std::vector<vpImagePoint> &keyPoints) const;
1247 
1254  void getTrainPoints(std::vector<cv::Point3f> &points) const;
1255 
1262  void getTrainPoints(std::vector<vpPoint> &points) const;
1263 
1269  void initMatcher(const std::string &matcherName);
1270 
1279  void insertImageMatching(const vpImage<unsigned char> &IRef, const vpImage<unsigned char> &ICurrent,
1280  vpImage<unsigned char> &IMatching);
1281 
1289  void insertImageMatching(const vpImage<unsigned char> &ICurrent, vpImage<unsigned char> &IMatching);
1290 
1299  void insertImageMatching(const vpImage<vpRGBa> &IRef, const vpImage<vpRGBa> &ICurrent, vpImage<vpRGBa> &IMatching);
1300 
1308  void insertImageMatching(const vpImage<vpRGBa> &ICurrent, vpImage<vpRGBa> &IMatching);
1309 
1315  void loadConfigFile(const std::string &configFile);
1316 
1325  void loadLearningData(const std::string &filename, bool binaryMode = false, bool append = false);
1326 
1335  void match(const cv::Mat &trainDescriptors, const cv::Mat &queryDescriptors, std::vector<cv::DMatch> &matches,
1336  double &elapsedTime);
1337 
1345  unsigned int matchPoint(const vpImage<unsigned char> &I);
1346 
1357  unsigned int matchPoint(const vpImage<unsigned char> &I, const vpImagePoint &iP, unsigned int height,
1358  unsigned int width);
1359 
1368  unsigned int matchPoint(const vpImage<unsigned char> &I, const vpRect &rectangle);
1369 
1378  unsigned int matchPoint(const std::vector<cv::KeyPoint> &queryKeyPoints, const cv::Mat &queryDescriptors);
1379 
1393  bool (*func)(const vpHomogeneousMatrix &) = nullptr, const vpRect &rectangle = vpRect());
1394 
1411  double &error, double &elapsedTime, bool (*func)(const vpHomogeneousMatrix &) = nullptr,
1412  const vpRect &rectangle = vpRect());
1413 
1434  bool matchPointAndDetect(const vpImage<unsigned char> &I, vpRect &boundingBox, vpImagePoint &centerOfGravity,
1435  const bool isPlanarObject = true, std::vector<vpImagePoint> *imPts1 = nullptr,
1436  std::vector<vpImagePoint> *imPts2 = nullptr, double *meanDescriptorDistance = nullptr,
1437  double *detectionScore = nullptr, const vpRect &rectangle = vpRect());
1438 
1458  bool matchPointAndDetect(const vpImage<unsigned char> &I, const vpCameraParameters &cam, vpHomogeneousMatrix &cMo,
1459  double &error, double &elapsedTime, vpRect &boundingBox, vpImagePoint &centerOfGravity,
1460  bool (*func)(const vpHomogeneousMatrix &) = nullptr, const vpRect &rectangle = vpRect());
1461 
1469  unsigned int matchPoint(const vpImage<vpRGBa> &I_color);
1470 
1481  unsigned int matchPoint(const vpImage<vpRGBa> &I_color, const vpImagePoint &iP, unsigned int height,
1482  unsigned int width);
1483 
1492  unsigned int matchPoint(const vpImage<vpRGBa> &I_color, const vpRect &rectangle);
1493 
1506  bool matchPoint(const vpImage<vpRGBa> &I_color, const vpCameraParameters &cam, vpHomogeneousMatrix &cMo,
1507  bool (*func)(const vpHomogeneousMatrix &) = nullptr, const vpRect &rectangle = vpRect());
1508 
1524  bool matchPoint(const vpImage<vpRGBa> &I_color, const vpCameraParameters &cam, vpHomogeneousMatrix &cMo,
1525  double &error, double &elapsedTime, bool (*func)(const vpHomogeneousMatrix &) = nullptr,
1526  const vpRect &rectangle = vpRect());
1527 
1531  void reset();
1532 
1541  void saveLearningData(const std::string &filename, bool binaryMode = false, bool saveTrainingImages = true);
1542 
1549  inline void setCovarianceComputation(const bool &flag)
1550  {
1551  m_computeCovariance = flag;
1552  if (!m_useRansacVVS) {
1553  std::cout << "Warning : The covariance matrix can only be computed "
1554  "with a Virtual Visual Servoing approach."
1555  << std::endl
1556  << "Use setUseRansacVVS(true) to choose to use a pose "
1557  "estimation method based on a Virtual "
1558  "Visual Servoing approach."
1559  << std::endl;
1560  }
1561  }
1562 
1568  inline void setDetectionMethod(const vpDetectionMethodType &method) { m_detectionMethod = method; }
1569 
1575  inline void setDetector(const vpFeatureDetectorType &detectorType)
1576  {
1577  m_detectorNames.clear();
1578  m_detectorNames.push_back(m_mapOfDetectorNames[detectorType]);
1579  m_detectors.clear();
1580  initDetector(m_mapOfDetectorNames[detectorType]);
1581  }
1582 
1588  inline void setDetector(const std::string &detectorName)
1589  {
1590  m_detectorNames.clear();
1591  m_detectorNames.push_back(detectorName);
1592  m_detectors.clear();
1593  initDetector(detectorName);
1594  }
1595 
1596 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400 && VISP_HAVE_OPENCV_VERSION < 0x030000)
1605  template <typename T1, typename T2, typename T3>
1606  inline void setDetectorParameter(const T1 detectorName, const T2 parameterName, const T3 value)
1607  {
1608  if (m_detectors.find(detectorName) != m_detectors.end()) {
1609  m_detectors[detectorName]->set(parameterName, value);
1610  }
1611  }
1612 #endif
1613 
1620  inline void setDetectors(const std::vector<std::string> &detectorNames)
1621  {
1622  m_detectorNames.clear();
1623  m_detectors.clear();
1624  m_detectorNames = detectorNames;
1625  initDetectors(m_detectorNames);
1626  }
1627 
1633  inline void setExtractor(const vpFeatureDescriptorType &extractorType)
1634  {
1635  m_extractorNames.clear();
1636  m_extractorNames.push_back(m_mapOfDescriptorNames[extractorType]);
1637  m_extractors.clear();
1638  initExtractor(m_mapOfDescriptorNames[extractorType]);
1639  }
1640 
1647  inline void setExtractor(const std::string &extractorName)
1648  {
1649  m_extractorNames.clear();
1650  m_extractorNames.push_back(extractorName);
1651  m_extractors.clear();
1652  initExtractor(extractorName);
1653  }
1654 
1655 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400 && VISP_HAVE_OPENCV_VERSION < 0x030000)
1664  template <typename T1, typename T2, typename T3>
1665  inline void setExtractorParameter(const T1 extractorName, const T2 parameterName, const T3 value)
1666  {
1667  if (m_extractors.find(extractorName) != m_extractors.end()) {
1668  m_extractors[extractorName]->set(parameterName, value);
1669  }
1670  }
1671 #endif
1672 
1679  inline void setExtractors(const std::vector<std::string> &extractorNames)
1680  {
1681  m_extractorNames.clear();
1682  m_extractorNames = extractorNames;
1683  m_extractors.clear();
1684  initExtractors(m_extractorNames);
1685  }
1686 
1692  inline void setImageFormat(const vpImageFormatType &imageFormat) { m_imageFormat = imageFormat; }
1693 
1709  inline void setMatcher(const std::string &matcherName)
1710  {
1711  m_matcherName = matcherName;
1712  initMatcher(m_matcherName);
1713  }
1714 
1720  void setMaxFeatures(int maxFeatures) { m_maxFeatures = maxFeatures; }
1721 
1737  inline void setFilterMatchingType(const vpFilterMatchingType &filterType)
1738  {
1739  m_filterType = filterType;
1740 
1741  // Use k-nearest neighbors (knn) to retrieve the two best matches for a
1742  // keypoint So this is useful only for ratioDistanceThreshold method
1743  if (filterType == ratioDistanceThreshold || filterType == stdAndRatioDistanceThreshold) {
1744  m_useKnn = true;
1745 
1746 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400 && VISP_HAVE_OPENCV_VERSION < 0x030000)
1747  if (m_matcher != nullptr && m_matcherName == "BruteForce") {
1748  // if a matcher is already initialized, disable the crossCheck
1749  // because it will not work with knnMatch
1750  m_matcher->set("crossCheck", false);
1751  }
1752 #endif
1753  }
1754  else {
1755  m_useKnn = false;
1756 
1757 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400 && VISP_HAVE_OPENCV_VERSION < 0x030000)
1758  if (m_matcher != nullptr && m_matcherName == "BruteForce") {
1759  // if a matcher is already initialized, set the crossCheck mode if
1760  // necessary
1761  m_matcher->set("crossCheck", m_useBruteForceCrossCheck);
1762  }
1763 #endif
1764  }
1765  }
1766 
1773  inline void setMatchingFactorThreshold(const double factor)
1774  {
1775  if (factor > 0.0) {
1776  m_matchingFactorThreshold = factor;
1777  }
1778  else {
1779  throw vpException(vpException::badValue, "The factor must be positive.");
1780  }
1781  }
1782 
1788  inline void setMatchingRatioThreshold(double ratio)
1789  {
1790  if (ratio > 0.0 && (ratio < 1.0 || std::fabs(ratio - 1.0) < std::numeric_limits<double>::epsilon())) {
1791  m_matchingRatioThreshold = ratio;
1792  }
1793  else {
1794  throw vpException(vpException::badValue, "The ratio must be in the interval ]0 ; 1].");
1795  }
1796  }
1797 
1804  inline void setRansacConsensusPercentage(double percentage)
1805  {
1806  if (percentage > 0.0 &&
1807  (percentage < 100.0 || std::fabs(percentage - 100.0) < std::numeric_limits<double>::epsilon())) {
1808  m_ransacConsensusPercentage = percentage;
1809  }
1810  else {
1811  throw vpException(vpException::badValue, "The percentage must be in the interval ]0 ; 100].");
1812  }
1813  }
1814 
1818  inline void setRansacFilterFlag(const vpPose::RANSAC_FILTER_FLAGS &flag) { m_ransacFilterFlag = flag; }
1819 
1826  inline void setRansacIteration(int nbIter)
1827  {
1828  if (nbIter > 0) {
1829  m_nbRansacIterations = nbIter;
1830  }
1831  else {
1832  throw vpException(vpException::badValue, "The number of iterations must be greater than zero.");
1833  }
1834  }
1835 
1841  inline void setRansacParallel(bool parallel) { m_ransacParallel = parallel; }
1842 
1849  inline void setRansacParallelNbThreads(unsigned int nthreads) { m_ransacParallelNbThreads = nthreads; }
1850 
1858  inline void setRansacReprojectionError(double reprojectionError)
1859  {
1860  if (reprojectionError > 0.0) {
1861  m_ransacReprojectionError = reprojectionError;
1862  }
1863  else {
1864  throw vpException(vpException::badValue, "The Ransac reprojection "
1865  "threshold must be positive "
1866  "as we deal with distance.");
1867  }
1868  }
1869 
1875  inline void setRansacMinInlierCount(int minCount)
1876  {
1877  if (minCount > 0) {
1878  m_nbRansacMinInlierCount = minCount;
1879  }
1880  else {
1881  throw vpException(vpException::badValue, "The minimum number of inliers must be greater than zero.");
1882  }
1883  }
1884 
1891  inline void setRansacThreshold(double threshold)
1892  {
1893  if (threshold > 0.0) {
1894  m_ransacThreshold = threshold;
1895  }
1896  else {
1897  throw vpException(vpException::badValue, "The Ransac threshold must be positive as we deal with distance.");
1898  }
1899  }
1900 
1908  inline void setUseAffineDetection(bool useAffine) { m_useAffineDetection = useAffine; }
1909 
1910 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400 && VISP_HAVE_OPENCV_VERSION < 0x030000)
1917  inline void setUseBruteForceCrossCheck(bool useCrossCheck)
1918  {
1919  // Only available with BruteForce and with k=1 (i.e not used with a
1920  // ratioDistanceThreshold method)
1921  if (m_matcher != nullptr && !m_useKnn && m_matcherName == "BruteForce") {
1922  m_matcher->set("crossCheck", useCrossCheck);
1923  }
1924  else if (m_matcher != nullptr && m_useKnn && m_matcherName == "BruteForce") {
1925  std::cout << "Warning, you try to set the crossCheck parameter with a "
1926  "BruteForce matcher but knn is enabled";
1927  std::cout << " (the filtering method uses a ratio constraint)" << std::endl;
1928  }
1929  }
1930 #endif
1931 
1938  inline void setUseMatchTrainToQuery(bool useMatchTrainToQuery) { m_useMatchTrainToQuery = useMatchTrainToQuery; }
1939 
1947  inline void setUseRansacConsensusPercentage(bool usePercentage) { m_useConsensusPercentage = usePercentage; }
1948 
1956  inline void setUseRansacVVS(bool ransacVVS) { m_useRansacVVS = ransacVVS; }
1957 
1964  inline void setUseSingleMatchFilter(bool singleMatchFilter) { m_useSingleMatchFilter = singleMatchFilter; }
1965 
1966 private:
1969  bool m_computeCovariance;
1971  vpMatrix m_covarianceMatrix;
1973  int m_currentImageId;
1976  vpDetectionMethodType m_detectionMethod;
1978  double m_detectionScore;
1981  double m_detectionThreshold;
1983  double m_detectionTime;
1985  std::vector<std::string> m_detectorNames;
1988  // with a key based upon the detector name.
1989  std::map<std::string, cv::Ptr<cv::FeatureDetector> > m_detectors;
1991  double m_extractionTime;
1993  std::vector<std::string> m_extractorNames;
1996  // with a key based upon the extractor name.
1997  std::map<std::string, cv::Ptr<cv::DescriptorExtractor> > m_extractors;
1999  std::vector<cv::DMatch> m_filteredMatches;
2001  vpFilterMatchingType m_filterType;
2003  vpImageFormatType m_imageFormat;
2006  std::vector<std::vector<cv::DMatch> > m_knnMatches;
2008  std::map<vpFeatureDescriptorType, std::string> m_mapOfDescriptorNames;
2010  std::map<vpFeatureDetectorType, std::string> m_mapOfDetectorNames;
2013  std::map<int, int> m_mapOfImageId;
2016  std::map<int, vpImage<unsigned char> > m_mapOfImages;
2019  cv::Ptr<cv::DescriptorMatcher> m_matcher;
2021  std::string m_matcherName;
2023  std::vector<cv::DMatch> m_matches;
2025  double m_matchingFactorThreshold;
2027  double m_matchingRatioThreshold;
2029  double m_matchingTime;
2031  std::vector<std::pair<cv::KeyPoint, cv::Point3f> > m_matchRansacKeyPointsToPoints;
2033  int m_nbRansacIterations;
2035  int m_nbRansacMinInlierCount;
2038  std::vector<cv::Point3f> m_objectFilteredPoints;
2040  double m_poseTime;
2043  cv::Mat m_queryDescriptors;
2045  std::vector<cv::KeyPoint> m_queryFilteredKeyPoints;
2047  std::vector<cv::KeyPoint> m_queryKeyPoints;
2050  double m_ransacConsensusPercentage;
2052  vpPose::RANSAC_FILTER_FLAGS m_ransacFilterFlag;
2054  std::vector<vpImagePoint> m_ransacInliers;
2056  std::vector<vpImagePoint> m_ransacOutliers;
2058  bool m_ransacParallel;
2060  unsigned int m_ransacParallelNbThreads;
2063  double m_ransacReprojectionError;
2066  double m_ransacThreshold;
2069  // detected in the train images).
2070  cv::Mat m_trainDescriptors;
2072  std::vector<cv::KeyPoint> m_trainKeyPoints;
2075  std::vector<cv::Point3f> m_trainPoints;
2078  std::vector<vpPoint> m_trainVpPoints;
2081  bool m_useAffineDetection;
2082 #if (VISP_HAVE_OPENCV_VERSION >= 0x020400 && VISP_HAVE_OPENCV_VERSION < 0x030000)
2086  bool m_useBruteForceCrossCheck;
2087 #endif
2090  bool m_useConsensusPercentage;
2092  bool m_useKnn;
2097  bool m_useMatchTrainToQuery;
2099  bool m_useRansacVVS;
2102  bool m_useSingleMatchFilter;
2106  int m_maxFeatures;
2107 
2116  void affineSkew(double tilt, double phi, cv::Mat &img, cv::Mat &mask, cv::Mat &Ai);
2117 
2132  double computePoseEstimationError(const std::vector<std::pair<cv::KeyPoint, cv::Point3f> > &matchKeyPoints,
2133  const vpCameraParameters &cam, const vpHomogeneousMatrix &cMo_est);
2134 
2138  void filterMatches();
2139 
2144  void init();
2145 
2151  void initDetector(const std::string &detectorNames);
2152 
2159  void initDetectors(const std::vector<std::string> &detectorNames);
2160 
2166  void initExtractor(const std::string &extractorName);
2167 
2174  void initExtractors(const std::vector<std::string> &extractorNames);
2175 
2179  void initFeatureNames();
2180 
2181  inline size_t myKeypointHash(const cv::KeyPoint &kp)
2182  {
2183  size_t _Val = 2166136261U, scale = 16777619U;
2184  Cv32suf u;
2185  u.f = kp.pt.x;
2186  _Val = (scale * _Val) ^ u.u;
2187  u.f = kp.pt.y;
2188  _Val = (scale * _Val) ^ u.u;
2189  u.f = kp.size;
2190  _Val = (scale * _Val) ^ u.u;
2191  // As the keypoint angle can be computed for certain type of keypoint only
2192  // when extracting the corresponding descriptor, the angle field is not
2193  // taking into account for the hash
2194  // u.f = kp.angle; _Val = (scale * _Val) ^ u.u;
2195  u.f = kp.response;
2196  _Val = (scale * _Val) ^ u.u;
2197  _Val = (scale * _Val) ^ ((size_t)kp.octave);
2198  _Val = (scale * _Val) ^ ((size_t)kp.class_id);
2199  return _Val;
2200  }
2201 
2202 #if (VISP_HAVE_OPENCV_VERSION >= 0x030000)
2203  /*
2204  * Adapts a detector to detect points over multiple levels of a Gaussian
2205  * pyramid. Useful for detectors that are not inherently scaled.
2206  * From OpenCV 2.4.11 source code.
2207  */
2208  class PyramidAdaptedFeatureDetector : public cv::FeatureDetector
2209  {
2210  public:
2211  // maxLevel - The 0-based index of the last pyramid layer
2212  PyramidAdaptedFeatureDetector(const cv::Ptr<cv::FeatureDetector> &detector, int maxLevel = 2);
2213 
2214  // TODO implement read/write
2215  virtual bool empty() const;
2216 
2217  protected:
2218  virtual void detect(cv::InputArray image, CV_OUT std::vector<cv::KeyPoint> &keypoints,
2219  cv::InputArray mask = cv::noArray());
2220  virtual void detectImpl(const cv::Mat &image, std::vector<cv::KeyPoint> &keypoints,
2221  const cv::Mat &mask = cv::Mat()) const;
2222 
2223  cv::Ptr<cv::FeatureDetector> m_detector;
2224  int m_maxLevel;
2225  };
2226 
2227  /*
2228  * A class filters a vector of keypoints.
2229  * Because now it is difficult to provide a convenient interface for all
2230  * usage scenarios of the keypoints filter class, it has only several needed
2231  * by now static methods.
2232  */
2233  class KeyPointsFilter
2234  {
2235  public:
2236  KeyPointsFilter() { }
2237 
2238  /*
2239  * Remove keypoints within borderPixels of an image edge.
2240  */
2241  static void runByImageBorder(std::vector<cv::KeyPoint> &keypoints, cv::Size imageSize, int borderSize);
2242  /*
2243  * Remove keypoints of sizes out of range.
2244  */
2245  static void runByKeypointSize(std::vector<cv::KeyPoint> &keypoints, float minSize, float maxSize = FLT_MAX);
2246  /*
2247  * Remove keypoints from some image by mask for pixels of this image.
2248  */
2249  static void runByPixelsMask(std::vector<cv::KeyPoint> &keypoints, const cv::Mat &mask);
2250  /*
2251  * Remove duplicated keypoints.
2252  */
2253  static void removeDuplicated(std::vector<cv::KeyPoint> &keypoints);
2254 
2255  /*
2256  * Retain the specified number of the best keypoints (according to the
2257  * response)
2258  */
2259  static void retainBest(std::vector<cv::KeyPoint> &keypoints, int npoints);
2260  };
2261 
2262 #endif
2263 };
2264 END_VISP_NAMESPACE
2265 #endif
2266 #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:157
static const vpColor green
Definition: vpColor.h:220
error that can be emitted by ViSP classes.
Definition: vpException.h:60
@ badValue
Used to indicate that a value is not in the allowed range.
Definition: vpException.h:73
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:221
double getDetectionTime() const
Definition: vpKeyPoint.h:998
std::vector< vpImagePoint > getRansacInliers() const
Definition: vpKeyPoint.h:1217
void setMatchingFactorThreshold(const double factor)
Definition: vpKeyPoint.h:1773
void setRansacConsensusPercentage(double percentage)
Definition: vpKeyPoint.h:1804
cv::Ptr< cv::DescriptorMatcher > getMatcher() const
Definition: vpKeyPoint.h:1124
vpDetectionMethodType
Definition: vpKeyPoint.h:240
void setRansacParallel(bool parallel)
Definition: vpKeyPoint.h:1841
void setRansacReprojectionError(double reprojectionError)
Definition: vpKeyPoint.h:1858
void setExtractor(const std::string &extractorName)
Definition: vpKeyPoint.h:1647
void setUseSingleMatchFilter(bool singleMatchFilter)
Definition: vpKeyPoint.h:1964
void setFilterMatchingType(const vpFilterMatchingType &filterType)
Definition: vpKeyPoint.h:1737
void setRansacParallelNbThreads(unsigned int nthreads)
Definition: vpKeyPoint.h:1849
double getExtractionTime() const
Definition: vpKeyPoint.h:1054
void setUseRansacVVS(bool ransacVVS)
Definition: vpKeyPoint.h:1956
void setDetectors(const std::vector< std::string > &detectorNames)
Definition: vpKeyPoint.h:1620
void setExtractors(const std::vector< std::string > &extractorNames)
Definition: vpKeyPoint.h:1679
cv::Mat getTrainDescriptors() const
Definition: vpKeyPoint.h:1232
vpFeatureDetectorType
Definition: vpKeyPoint.h:259
@ DETECTOR_KAZE
KAZE detector.
Definition: vpKeyPoint.h:278
@ DETECTOR_BRISK
BRISK detector.
Definition: vpKeyPoint.h:264
@ DETECTOR_AKAZE
AKAZE detector.
Definition: vpKeyPoint.h:279
@ DETECTOR_MSER
MSER detector.
Definition: vpKeyPoint.h:262
@ DETECTOR_SURF
SURF detector.
Definition: vpKeyPoint.h:275
@ DETECTOR_AGAST
AGAST detector.
Definition: vpKeyPoint.h:280
@ DETECTOR_SIFT
SIFT detector.
Definition: vpKeyPoint.h:272
@ DETECTOR_FAST
FAST detector.
Definition: vpKeyPoint.h:261
@ DETECTOR_GFTT
GFTT detector.
Definition: vpKeyPoint.h:265
@ DETECTOR_ORB
ORB detector.
Definition: vpKeyPoint.h:263
@ DETECTOR_SimpleBlob
SimpleBlob detector.
Definition: vpKeyPoint.h:266
void setExtractor(const vpFeatureDescriptorType &extractorType)
Definition: vpKeyPoint.h:1633
void setImageFormat(const vpImageFormatType &imageFormat)
Definition: vpKeyPoint.h:1692
void setRansacThreshold(double threshold)
Definition: vpKeyPoint.h:1891
void setRansacMinInlierCount(int minCount)
Definition: vpKeyPoint.h:1875
void setRansacFilterFlag(const vpPose::RANSAC_FILTER_FLAGS &flag)
Definition: vpKeyPoint.h:1818
double getPoseTime() const
Definition: vpKeyPoint.h:1182
std::map< vpFeatureDetectorType, std::string > getDetectorNames() const
Definition: vpKeyPoint.h:1047
unsigned int getNbImages() const
Definition: vpKeyPoint.h:1157
double getMatchingTime() const
Definition: vpKeyPoint.h:1117
std::vector< vpImagePoint > getRansacOutliers() const
Definition: vpKeyPoint.h:1224
vpFeatureDescriptorType
Definition: vpKeyPoint.h:291
@ DESCRIPTOR_AKAZE
AKAZE descriptor.
Definition: vpKeyPoint.h:308
@ DESCRIPTOR_ORB
ORB descriptor.
Definition: vpKeyPoint.h:293
@ DESCRIPTOR_KAZE
KAZE descriptor.
Definition: vpKeyPoint.h:307
@ DESCRIPTOR_SURF
SUFT descriptor.
Definition: vpKeyPoint.h:304
@ DESCRIPTOR_BRISK
BRISK descriptor.
Definition: vpKeyPoint.h:294
@ DESCRIPTOR_SIFT
SIFT descriptor.
Definition: vpKeyPoint.h:301
std::vector< cv::DMatch > getMatches() const
Definition: vpKeyPoint.h:1132
std::map< vpFeatureDescriptorType, std::string > getExtractorNames() const
Definition: vpKeyPoint.h:1103
void setMatcher(const std::string &matcherName)
Definition: vpKeyPoint.h:1709
vpImageFormatType getImageFormat() const
Definition: vpKeyPoint.h:1110
cv::Ptr< cv::DescriptorExtractor > getExtractor(const std::string &name) const
Definition: vpKeyPoint.h:1089
void setUseAffineDetection(bool useAffine)
Definition: vpKeyPoint.h:1908
void setUseRansacConsensusPercentage(bool usePercentage)
Definition: vpKeyPoint.h:1947
void setMatchingRatioThreshold(double ratio)
Definition: vpKeyPoint.h:1788
@ ppmImageFormat
Definition: vpKeyPoint.h:253
@ jpgImageFormat
Definition: vpKeyPoint.h:251
@ pngImageFormat
Definition: vpKeyPoint.h:252
vpFilterMatchingType
Definition: vpKeyPoint.h:225
void setCovarianceComputation(const bool &flag)
Definition: vpKeyPoint.h:1549
void setDetector(const vpFeatureDetectorType &detectorType)
Definition: vpKeyPoint.h:1575
cv::Ptr< cv::DescriptorExtractor > getExtractor(const vpFeatureDescriptorType &type) const
Definition: vpKeyPoint.h:1063
void setUseMatchTrainToQuery(bool useMatchTrainToQuery)
Definition: vpKeyPoint.h:1938
vpMatrix getCovarianceMatrix() const
Definition: vpKeyPoint.h:970
void setDetectionMethod(const vpDetectionMethodType &method)
Definition: vpKeyPoint.h:1568
cv::Ptr< cv::FeatureDetector > getDetector(const std::string &name) const
Definition: vpKeyPoint.h:1033
void setDetector(const std::string &detectorName)
Definition: vpKeyPoint.h:1588
void setMaxFeatures(int maxFeatures)
Definition: vpKeyPoint.h:1720
std::vector< std::pair< cv::KeyPoint, cv::KeyPoint > > getMatchQueryToTrainKeyPoints() const
Definition: vpKeyPoint.h:1141
cv::Ptr< cv::FeatureDetector > getDetector(const vpFeatureDetectorType &type) const
Definition: vpKeyPoint.h:1007
void setRansacIteration(int nbIter)
Definition: vpKeyPoint.h:1826
cv::Mat getQueryDescriptors() const
Definition: vpKeyPoint.h:1190
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:169
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Definition: vpPoint.h:79
RANSAC_FILTER_FLAGS
Definition: vpPose.h:107
Defines a rectangle in the plane.
Definition: vpRect.h:79