EstervQrCode 1.1.1
Library for qr code manipulation
features2d.hpp
1 /*M///////////////////////////////////////////////////////////////////////////////////////
2 //
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
5 // By downloading, copying, installing or using the software you agree to this license.
6 // If you do not agree to this license, do not download, install,
7 // copy or use the software.
8 //
9 //
10 // License Agreement
11 // For Open Source Computer Vision Library
12 //
13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15 // Third party copyrights are property of their respective owners.
16 //
17 // Redistribution and use in source and binary forms, with or without modification,
18 // are permitted provided that the following conditions are met:
19 //
20 // * Redistribution's of source code must retain the above copyright notice,
21 // this list of conditions and the following disclaimer.
22 //
23 // * Redistribution's in binary form must reproduce the above copyright notice,
24 // this list of conditions and the following disclaimer in the documentation
25 // and/or other materials provided with the distribution.
26 //
27 // * The name of the copyright holders may not be used to endorse or promote products
28 // derived from this software without specific prior written permission.
29 //
30 // This software is provided by the copyright holders and contributors "as is" and
31 // any express or implied warranties, including, but not limited to, the implied
32 // warranties of merchantability and fitness for a particular purpose are disclaimed.
33 // In no event shall the Intel Corporation or contributors be liable for any direct,
34 // indirect, incidental, special, exemplary, or consequential damages
35 // (including, but not limited to, procurement of substitute goods or services;
36 // loss of use, data, or profits; or business interruption) however caused
37 // and on any theory of liability, whether in contract, strict liability,
38 // or tort (including negligence or otherwise) arising in any way out of
39 // the use of this software, even if advised of the possibility of such damage.
40 //
41 //M*/
42 
43 #ifndef OPENCV_FEATURES_2D_HPP
44 #define OPENCV_FEATURES_2D_HPP
45 
46 #include "opencv2/opencv_modules.hpp"
47 #include "opencv2/core.hpp"
48 
49 #ifdef HAVE_OPENCV_FLANN
50 #include "opencv2/flann/miniflann.hpp"
51 #endif
52 
76 namespace cv
77 {
78 
81 
82 // //! writes vector of keypoints to the file storage
83 // CV_EXPORTS void write(FileStorage& fs, const String& name, const std::vector<KeyPoint>& keypoints);
84 // //! reads vector of keypoints from the specified file storage node
85 // CV_EXPORTS void read(const FileNode& node, CV_OUT std::vector<KeyPoint>& keypoints);
86 
93 {
94 public:
96 
97  /*
98  * Remove keypoints within borderPixels of an image edge.
99  */
100  static void runByImageBorder( std::vector<KeyPoint>& keypoints, Size imageSize, int borderSize );
101  /*
102  * Remove keypoints of sizes out of range.
103  */
104  static void runByKeypointSize( std::vector<KeyPoint>& keypoints, float minSize,
105  float maxSize=FLT_MAX );
106  /*
107  * Remove keypoints from some image by mask for pixels of this image.
108  */
109  static void runByPixelsMask( std::vector<KeyPoint>& keypoints, const Mat& mask );
110  /*
111  * Remove objects from some image and a vector of points by mask for pixels of this image
112  */
114  /*
115  * Remove duplicated keypoints.
116  */
117  static void removeDuplicated( std::vector<KeyPoint>& keypoints );
118  /*
119  * Remove duplicated keypoints and sort the remaining keypoints
120  */
122 
123  /*
124  * Retain the specified number of the best keypoints (according to the response)
125  */
126  static void retainBest( std::vector<KeyPoint>& keypoints, int npoints );
127 };
128 
129 
130 /************************************ Base Classes ************************************/
131 
134 #ifdef __EMSCRIPTEN__
135 class CV_EXPORTS_W Feature2D : public Algorithm
136 #else
137 class CV_EXPORTS_W Feature2D : public virtual Algorithm
138 #endif
139 {
140 public:
141  virtual ~Feature2D();
142 
151  CV_WRAP virtual void detect( InputArray image,
152  CV_OUT std::vector<KeyPoint>& keypoints,
153  InputArray mask=noArray() );
154 
162  CV_WRAP virtual void detect( InputArrayOfArrays images,
164  InputArrayOfArrays masks=noArray() );
165 
177  CV_WRAP virtual void compute( InputArray image,
179  OutputArray descriptors );
180 
191  CV_WRAP virtual void compute( InputArrayOfArrays images,
193  OutputArrayOfArrays descriptors );
194 
197  CV_OUT std::vector<KeyPoint>& keypoints,
198  OutputArray descriptors,
199  bool useProvidedKeypoints=false );
200 
201  CV_WRAP virtual int descriptorSize() const;
202  CV_WRAP virtual int descriptorType() const;
203  CV_WRAP virtual int defaultNorm() const;
204 
205  CV_WRAP void write( const String& fileName ) const;
206 
207  CV_WRAP void read( const String& fileName );
208 
209  virtual void write( FileStorage&) const CV_OVERRIDE;
210 
211  // see corresponding cv::Algorithm method
212  CV_WRAP virtual void read( const FileNode&) CV_OVERRIDE;
213 
215  CV_WRAP virtual bool empty() const CV_OVERRIDE;
216  CV_WRAP virtual String getDefaultName() const CV_OVERRIDE;
217 
218  // see corresponding cv::Algorithm method
219  CV_WRAP inline void write(FileStorage& fs, const String& name) const { Algorithm::write(fs, name); }
220 #if CV_VERSION_MAJOR < 5
221  inline void write(const Ptr<FileStorage>& fs, const String& name) const { CV_Assert(fs); Algorithm::write(*fs, name); }
222 #endif
223 };
224 
229 
236 
237 
242 {
243 public:
252  int maxTilt = 5, int minTilt = 0, float tiltStep = 1.4142135623730951f, float rotateStepBase = 72);
253 
254  CV_WRAP virtual void setViewParams(const std::vector<float>& tilts, const std::vector<float>& rolls) = 0;
255  CV_WRAP virtual void getViewParams(std::vector<float>& tilts, std::vector<float>& rolls) const = 0;
257 };
258 
261 
262 
267 {
268 public:
294  CV_WRAP static Ptr<SIFT> create(int nfeatures = 0, int nOctaveLayers = 3,
295  double contrastThreshold = 0.04, double edgeThreshold = 10,
296  double sigma = 1.6, bool enable_precise_upscale = false);
297 
325  CV_WRAP static Ptr<SIFT> create(int nfeatures, int nOctaveLayers,
326  double contrastThreshold, double edgeThreshold,
327  double sigma, int descriptorType, bool enable_precise_upscale = false);
328 
330 
331  CV_WRAP virtual void setNFeatures(int maxFeatures) = 0;
332  CV_WRAP virtual int getNFeatures() const = 0;
333 
334  CV_WRAP virtual void setNOctaveLayers(int nOctaveLayers) = 0;
335  CV_WRAP virtual int getNOctaveLayers() const = 0;
336 
337  CV_WRAP virtual void setContrastThreshold(double contrastThreshold) = 0;
338  CV_WRAP virtual double getContrastThreshold() const = 0;
339 
340  CV_WRAP virtual void setEdgeThreshold(double edgeThreshold) = 0;
341  CV_WRAP virtual double getEdgeThreshold() const = 0;
342 
343  CV_WRAP virtual void setSigma(double sigma) = 0;
344  CV_WRAP virtual double getSigma() const = 0;
345 };
346 
349 
350 
354 {
355 public:
363  CV_WRAP static Ptr<BRISK> create(int thresh=30, int octaves=3, float patternScale=1.0f);
364 
376  CV_WRAP static Ptr<BRISK> create(const std::vector<float> &radiusList, const std::vector<int> &numberList,
377  float dMax=5.85f, float dMin=8.2f, const std::vector<int>& indexChange=std::vector<int>());
378 
392  CV_WRAP static Ptr<BRISK> create(int thresh, int octaves, const std::vector<float> &radiusList,
393  const std::vector<int> &numberList, float dMax=5.85f, float dMin=8.2f,
394  const std::vector<int>& indexChange=std::vector<int>());
396 
400  CV_WRAP virtual void setThreshold(int threshold) = 0;
401  CV_WRAP virtual int getThreshold() const = 0;
402 
406  CV_WRAP virtual void setOctaves(int octaves) = 0;
407  CV_WRAP virtual int getOctaves() const = 0;
412  CV_WRAP virtual void setPatternScale(float patternScale) = 0;
413  CV_WRAP virtual float getPatternScale() const = 0;
414 };
415 
423 class CV_EXPORTS_W ORB : public Feature2D
424 {
425 public:
426  enum ScoreType { HARRIS_SCORE=0, FAST_SCORE=1 };
427  static const int kBytes = 32;
428 
460  CV_WRAP static Ptr<ORB> create(int nfeatures=500, float scaleFactor=1.2f, int nlevels=8, int edgeThreshold=31,
461  int firstLevel=0, int WTA_K=2, ORB::ScoreType scoreType=ORB::HARRIS_SCORE, int patchSize=31, int fastThreshold=20);
462 
463  CV_WRAP virtual void setMaxFeatures(int maxFeatures) = 0;
464  CV_WRAP virtual int getMaxFeatures() const = 0;
465 
466  CV_WRAP virtual void setScaleFactor(double scaleFactor) = 0;
467  CV_WRAP virtual double getScaleFactor() const = 0;
468 
469  CV_WRAP virtual void setNLevels(int nlevels) = 0;
470  CV_WRAP virtual int getNLevels() const = 0;
471 
472  CV_WRAP virtual void setEdgeThreshold(int edgeThreshold) = 0;
473  CV_WRAP virtual int getEdgeThreshold() const = 0;
474 
475  CV_WRAP virtual void setFirstLevel(int firstLevel) = 0;
476  CV_WRAP virtual int getFirstLevel() const = 0;
477 
478  CV_WRAP virtual void setWTA_K(int wta_k) = 0;
479  CV_WRAP virtual int getWTA_K() const = 0;
480 
481  CV_WRAP virtual void setScoreType(ORB::ScoreType scoreType) = 0;
482  CV_WRAP virtual ORB::ScoreType getScoreType() const = 0;
483 
484  CV_WRAP virtual void setPatchSize(int patchSize) = 0;
485  CV_WRAP virtual int getPatchSize() const = 0;
486 
487  CV_WRAP virtual void setFastThreshold(int fastThreshold) = 0;
488  CV_WRAP virtual int getFastThreshold() const = 0;
490 };
491 
508 {
509 public:
522  CV_WRAP static Ptr<MSER> create( int delta=5, int min_area=60, int max_area=14400,
523  double max_variation=0.25, double min_diversity=.2,
524  int max_evolution=200, double area_threshold=1.01,
525  double min_margin=0.003, int edge_blur_size=5 );
526 
533  CV_WRAP virtual void detectRegions( InputArray image,
535  CV_OUT std::vector<Rect>& bboxes ) = 0;
536 
537  CV_WRAP virtual void setDelta(int delta) = 0;
538  CV_WRAP virtual int getDelta() const = 0;
539 
540  CV_WRAP virtual void setMinArea(int minArea) = 0;
541  CV_WRAP virtual int getMinArea() const = 0;
542 
543  CV_WRAP virtual void setMaxArea(int maxArea) = 0;
544  CV_WRAP virtual int getMaxArea() const = 0;
545 
546  CV_WRAP virtual void setMaxVariation(double maxVariation) = 0;
547  CV_WRAP virtual double getMaxVariation() const = 0;
548 
549  CV_WRAP virtual void setMinDiversity(double minDiversity) = 0;
550  CV_WRAP virtual double getMinDiversity() const = 0;
551 
552  CV_WRAP virtual void setMaxEvolution(int maxEvolution) = 0;
553  CV_WRAP virtual int getMaxEvolution() const = 0;
554 
555  CV_WRAP virtual void setAreaThreshold(double areaThreshold) = 0;
556  CV_WRAP virtual double getAreaThreshold() const = 0;
557 
558  CV_WRAP virtual void setMinMargin(double min_margin) = 0;
559  CV_WRAP virtual double getMinMargin() const = 0;
560 
561  CV_WRAP virtual void setEdgeBlurSize(int edge_blur_size) = 0;
562  CV_WRAP virtual int getEdgeBlurSize() const = 0;
563 
564  CV_WRAP virtual void setPass2Only(bool f) = 0;
565  CV_WRAP virtual bool getPass2Only() const = 0;
566 
568 };
569 
570 
574 {
575 public:
577  {
578  TYPE_5_8 = 0, TYPE_7_12 = 1, TYPE_9_16 = 2
579  };
580  enum
581  {
582  THRESHOLD = 10000, NONMAX_SUPPRESSION=10001, FAST_N=10002
583  };
584 
585 
587  bool nonmaxSuppression=true,
589 
590  CV_WRAP virtual void setThreshold(int threshold) = 0;
591  CV_WRAP virtual int getThreshold() const = 0;
592 
593  CV_WRAP virtual void setNonmaxSuppression(bool f) = 0;
594  CV_WRAP virtual bool getNonmaxSuppression() const = 0;
595 
599 };
600 
602 CV_EXPORTS void FAST( InputArray image, CV_OUT std::vector<KeyPoint>& keypoints,
603  int threshold, bool nonmaxSuppression=true );
604 
623 CV_EXPORTS void FAST( InputArray image, CV_OUT std::vector<KeyPoint>& keypoints,
624  int threshold, bool nonmaxSuppression, FastFeatureDetector::DetectorType type );
625 
626 
630 {
631 public:
633  {
634  AGAST_5_8 = 0, AGAST_7_12d = 1, AGAST_7_12s = 2, OAST_9_16 = 3,
635  };
636 
637  enum
638  {
639  THRESHOLD = 10000, NONMAX_SUPPRESSION = 10001,
640  };
641 
643  bool nonmaxSuppression=true,
645 
646  CV_WRAP virtual void setThreshold(int threshold) = 0;
647  CV_WRAP virtual int getThreshold() const = 0;
648 
649  CV_WRAP virtual void setNonmaxSuppression(bool f) = 0;
650  CV_WRAP virtual bool getNonmaxSuppression() const = 0;
651 
655 };
656 
658 CV_EXPORTS void AGAST( InputArray image, CV_OUT std::vector<KeyPoint>& keypoints,
659  int threshold, bool nonmaxSuppression=true );
660 
679 CV_EXPORTS void AGAST( InputArray image, CV_OUT std::vector<KeyPoint>& keypoints,
680  int threshold, bool nonmaxSuppression, AgastFeatureDetector::DetectorType type );
681 
685 {
686 public:
687  CV_WRAP static Ptr<GFTTDetector> create( int maxCorners=1000, double qualityLevel=0.01, double minDistance=1,
688  int blockSize=3, bool useHarrisDetector=false, double k=0.04 );
690  int blockSize, int gradiantSize, bool useHarrisDetector=false, double k=0.04 );
691  CV_WRAP virtual void setMaxFeatures(int maxFeatures) = 0;
692  CV_WRAP virtual int getMaxFeatures() const = 0;
693 
694  CV_WRAP virtual void setQualityLevel(double qlevel) = 0;
695  CV_WRAP virtual double getQualityLevel() const = 0;
696 
697  CV_WRAP virtual void setMinDistance(double minDistance) = 0;
698  CV_WRAP virtual double getMinDistance() const = 0;
699 
700  CV_WRAP virtual void setBlockSize(int blockSize) = 0;
701  CV_WRAP virtual int getBlockSize() const = 0;
702 
703  CV_WRAP virtual void setGradientSize(int gradientSize_) = 0;
704  CV_WRAP virtual int getGradientSize() = 0;
705 
706  CV_WRAP virtual void setHarrisDetector(bool val) = 0;
707  CV_WRAP virtual bool getHarrisDetector() const = 0;
708 
709  CV_WRAP virtual void setK(double k) = 0;
710  CV_WRAP virtual double getK() const = 0;
712 };
713 
746 {
747 public:
749  {
756 
759 
761  CV_PROP_RW float minArea, maxArea;
762 
764  CV_PROP_RW float minCircularity, maxCircularity;
765 
767  CV_PROP_RW float minInertiaRatio, maxInertiaRatio;
768 
770  CV_PROP_RW float minConvexity, maxConvexity;
771 
773 
774  void read( const FileNode& fn );
775  void write( FileStorage& fs ) const;
776  };
777 
780 
781  CV_WRAP virtual void setParams(const SimpleBlobDetector::Params& params ) = 0;
783 
785  CV_WRAP virtual const std::vector<std::vector<cv::Point> >& getBlobContours() const;
786 };
787 
788 
796 {
797 public:
799  {
800  DIFF_PM_G1 = 0,
801  DIFF_PM_G2 = 1,
802  DIFF_WEICKERT = 2,
803  DIFF_CHARBONNIER = 3
804  };
805 
816  CV_WRAP static Ptr<KAZE> create(bool extended=false, bool upright=false,
817  float threshold = 0.001f,
818  int nOctaves = 4, int nOctaveLayers = 4,
820 
821  CV_WRAP virtual void setExtended(bool extended) = 0;
822  CV_WRAP virtual bool getExtended() const = 0;
823 
824  CV_WRAP virtual void setUpright(bool upright) = 0;
825  CV_WRAP virtual bool getUpright() const = 0;
826 
827  CV_WRAP virtual void setThreshold(double threshold) = 0;
828  CV_WRAP virtual double getThreshold() const = 0;
829 
830  CV_WRAP virtual void setNOctaves(int octaves) = 0;
831  CV_WRAP virtual int getNOctaves() const = 0;
832 
833  CV_WRAP virtual void setNOctaveLayers(int octaveLayers) = 0;
834  CV_WRAP virtual int getNOctaveLayers() const = 0;
835 
839 };
840 
858 {
859 public:
860  // AKAZE descriptor type
862  {
863  DESCRIPTOR_KAZE_UPRIGHT = 2,
864  DESCRIPTOR_KAZE = 3,
865  DESCRIPTOR_MLDB_UPRIGHT = 4,
866  DESCRIPTOR_MLDB = 5
867  };
868 
885  int descriptor_size = 0, int descriptor_channels = 3,
886  float threshold = 0.001f, int nOctaves = 4,
887  int nOctaveLayers = 4, KAZE::DiffusivityType diffusivity = KAZE::DIFF_PM_G2,
888  int max_points = -1);
889 
892 
893  CV_WRAP virtual void setDescriptorSize(int dsize) = 0;
894  CV_WRAP virtual int getDescriptorSize() const = 0;
895 
896  CV_WRAP virtual void setDescriptorChannels(int dch) = 0;
897  CV_WRAP virtual int getDescriptorChannels() const = 0;
898 
899  CV_WRAP virtual void setThreshold(double threshold) = 0;
900  CV_WRAP virtual double getThreshold() const = 0;
901 
902  CV_WRAP virtual void setNOctaves(int octaves) = 0;
903  CV_WRAP virtual int getNOctaves() const = 0;
904 
905  CV_WRAP virtual void setNOctaveLayers(int octaveLayers) = 0;
906  CV_WRAP virtual int getNOctaveLayers() const = 0;
907 
911 
912  CV_WRAP virtual void setMaxPoints(int max_points) = 0;
913  CV_WRAP virtual int getMaxPoints() const = 0;
914 };
915 
916 
917 /****************************************************************************************\
918 * Distance *
919 \****************************************************************************************/
920 
921 template<typename T>
923 {
924  typedef T Type;
925 };
926 
927 template<> struct Accumulator<unsigned char> { typedef float Type; };
928 template<> struct Accumulator<unsigned short> { typedef float Type; };
929 template<> struct Accumulator<char> { typedef float Type; };
930 template<> struct Accumulator<short> { typedef float Type; };
931 
932 /*
933  * Squared Euclidean distance functor
934  */
935 template<class T>
937 {
938  static const NormTypes normType = NORM_L2SQR;
939  typedef T ValueType;
941 
942  ResultType operator()( const T* a, const T* b, int size ) const
943  {
944  return normL2Sqr<ValueType, ResultType>(a, b, size);
945  }
946 };
947 
948 /*
949  * Euclidean distance functor
950  */
951 template<class T>
952 struct L2
953 {
954  static const NormTypes normType = NORM_L2;
955  typedef T ValueType;
957 
958  ResultType operator()( const T* a, const T* b, int size ) const
959  {
960  return (ResultType)std::sqrt((double)normL2Sqr<ValueType, ResultType>(a, b, size));
961  }
962 };
963 
964 /*
965  * Manhattan distance (city block distance) functor
966  */
967 template<class T>
968 struct L1
969 {
970  static const NormTypes normType = NORM_L1;
971  typedef T ValueType;
973 
974  ResultType operator()( const T* a, const T* b, int size ) const
975  {
976  return normL1<ValueType, ResultType>(a, b, size);
977  }
978 };
979 
981 
982 /****************************************************************************************\
983 * DescriptorMatcher *
984 \****************************************************************************************/
985 
988 
995 {
996 public:
998  {
999  FLANNBASED = 1,
1000  BRUTEFORCE = 2,
1001  BRUTEFORCE_L1 = 3,
1002  BRUTEFORCE_HAMMING = 4,
1003  BRUTEFORCE_HAMMINGLUT = 5,
1004  BRUTEFORCE_SL2 = 6
1005  };
1006 
1008 
1017  CV_WRAP virtual void add( InputArrayOfArrays descriptors );
1018 
1022 
1025  CV_WRAP virtual void clear() CV_OVERRIDE;
1026 
1029  CV_WRAP virtual bool empty() const CV_OVERRIDE;
1030 
1033  CV_WRAP virtual bool isMaskSupported() const = 0;
1034 
1042  CV_WRAP virtual void train();
1043 
1060  CV_WRAP void match( InputArray queryDescriptors, InputArray trainDescriptors,
1061  CV_OUT std::vector<DMatch>& matches, InputArray mask=noArray() ) const;
1062 
1081  CV_WRAP void knnMatch( InputArray queryDescriptors, InputArray trainDescriptors,
1082  CV_OUT std::vector<std::vector<DMatch> >& matches, int k,
1083  InputArray mask=noArray(), bool compactResult=false ) const;
1084 
1104  CV_WRAP void radiusMatch( InputArray queryDescriptors, InputArray trainDescriptors,
1105  CV_OUT std::vector<std::vector<DMatch> >& matches, float maxDistance,
1106  InputArray mask=noArray(), bool compactResult=false ) const;
1107 
1115  CV_WRAP void match( InputArray queryDescriptors, CV_OUT std::vector<DMatch>& matches,
1116  InputArrayOfArrays masks=noArray() );
1128  CV_WRAP void knnMatch( InputArray queryDescriptors, CV_OUT std::vector<std::vector<DMatch> >& matches, int k,
1129  InputArrayOfArrays masks=noArray(), bool compactResult=false );
1142  CV_WRAP void radiusMatch( InputArray queryDescriptors, CV_OUT std::vector<std::vector<DMatch> >& matches, float maxDistance,
1143  InputArrayOfArrays masks=noArray(), bool compactResult=false );
1144 
1145 
1146  CV_WRAP void write( const String& fileName ) const
1147  {
1148  FileStorage fs(fileName, FileStorage::WRITE);
1149  write(fs);
1150  }
1151 
1152  CV_WRAP void read( const String& fileName )
1153  {
1154  FileStorage fs(fileName, FileStorage::READ);
1155  read(fs.root());
1156  }
1157  // Reads matcher object from a file node
1158  // see corresponding cv::Algorithm method
1159  CV_WRAP virtual void read( const FileNode& ) CV_OVERRIDE;
1160  // Writes matcher object to a file storage
1161  virtual void write( FileStorage& ) const CV_OVERRIDE;
1162 
1169  CV_WRAP CV_NODISCARD_STD virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const = 0;
1170 
1182  CV_WRAP static Ptr<DescriptorMatcher> create( const String& descriptorMatcherType );
1183 
1185 
1186 
1187  // see corresponding cv::Algorithm method
1188  CV_WRAP inline void write(FileStorage& fs, const String& name) const { Algorithm::write(fs, name); }
1189 #if CV_VERSION_MAJOR < 5
1190  inline void write(const Ptr<FileStorage>& fs, const String& name) const { CV_Assert(fs); Algorithm::write(*fs, name); }
1191 #endif
1192 
1193 protected:
1199  {
1200  public:
1204 
1205  // Vector of matrices "descriptors" will be merged to one matrix "mergedDescriptors" here.
1206  void set( const std::vector<Mat>& descriptors );
1207  virtual void clear();
1208 
1209  const Mat& getDescriptors() const;
1210  Mat getDescriptor( int imgIdx, int localDescIdx ) const;
1211  Mat getDescriptor( int globalDescIdx ) const;
1212  void getLocalIdx( int globalDescIdx, int& imgIdx, int& localDescIdx ) const;
1213 
1214  int size() const;
1215 
1216  protected:
1219  };
1220 
1224  virtual void knnMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, int k,
1225  InputArrayOfArrays masks=noArray(), bool compactResult=false ) = 0;
1226  virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
1227  InputArrayOfArrays masks=noArray(), bool compactResult=false ) = 0;
1228 
1229  static bool isPossibleMatch( InputArray mask, int queryIdx, int trainIdx );
1230  static bool isMaskedOut( InputArrayOfArrays masks, int queryIdx );
1231 
1232  CV_NODISCARD_STD static Mat clone_op( Mat m ) { return m.clone(); }
1233  void checkMasks( InputArrayOfArrays masks, int queryDescriptorsCount ) const;
1234 
1238 };
1239 
1247 {
1248 public:
1253  CV_WRAP BFMatcher( int normType=NORM_L2, bool crossCheck=false );
1254 
1255  virtual ~BFMatcher() {}
1256 
1257  virtual bool isMaskSupported() const CV_OVERRIDE { return true; }
1258 
1271  CV_WRAP static Ptr<BFMatcher> create( int normType=NORM_L2, bool crossCheck=false ) ;
1272 
1273  CV_NODISCARD_STD virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const CV_OVERRIDE;
1274 protected:
1275  virtual void knnMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, int k,
1276  InputArrayOfArrays masks=noArray(), bool compactResult=false ) CV_OVERRIDE;
1277  virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
1278  InputArrayOfArrays masks=noArray(), bool compactResult=false ) CV_OVERRIDE;
1279 
1280  int normType;
1281  bool crossCheck;
1282 };
1283 
1284 #if defined(HAVE_OPENCV_FLANN) || defined(CV_DOXYGEN)
1285 
1293 class CV_EXPORTS_W FlannBasedMatcher : public DescriptorMatcher
1294 {
1295 public:
1296  CV_WRAP FlannBasedMatcher( const Ptr<flann::IndexParams>& indexParams=makePtr<flann::KDTreeIndexParams>(),
1297  const Ptr<flann::SearchParams>& searchParams=makePtr<flann::SearchParams>() );
1298 
1299  virtual void add( InputArrayOfArrays descriptors ) CV_OVERRIDE;
1300  virtual void clear() CV_OVERRIDE;
1301 
1302  // Reads matcher object from a file node
1303  virtual void read( const FileNode& ) CV_OVERRIDE;
1304  // Writes matcher object to a file storage
1305  virtual void write( FileStorage& ) const CV_OVERRIDE;
1306 
1307  virtual void train() CV_OVERRIDE;
1308  virtual bool isMaskSupported() const CV_OVERRIDE;
1309 
1310  CV_WRAP static Ptr<FlannBasedMatcher> create();
1311 
1312  CV_NODISCARD_STD virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const CV_OVERRIDE;
1313 protected:
1314  static void convertToDMatches( const DescriptorCollection& descriptors,
1315  const Mat& indices, const Mat& distances,
1316  std::vector<std::vector<DMatch> >& matches );
1317 
1318  virtual void knnMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, int k,
1319  InputArrayOfArrays masks=noArray(), bool compactResult=false ) CV_OVERRIDE;
1320  virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
1321  InputArrayOfArrays masks=noArray(), bool compactResult=false ) CV_OVERRIDE;
1322 
1323  Ptr<flann::IndexParams> indexParams;
1324  Ptr<flann::SearchParams> searchParams;
1325  Ptr<flann::Index> flannIndex;
1326 
1327  DescriptorCollection mergedDescriptors;
1328  int addedDescCount;
1329 };
1330 
1331 #endif
1332 
1334 
1335 /****************************************************************************************\
1336 * Drawing functions *
1337 \****************************************************************************************/
1338 
1341 
1342 enum struct DrawMatchesFlags
1343 {
1344  DEFAULT = 0,
1349  DRAW_OVER_OUTIMG = 1,
1352  DRAW_RICH_KEYPOINTS = 4
1354 };
1356 
1357 
1372 CV_EXPORTS_W void drawKeypoints( InputArray image, const std::vector<KeyPoint>& keypoints, InputOutputArray outImage,
1373  const Scalar& color=Scalar::all(-1), DrawMatchesFlags flags=DrawMatchesFlags::DEFAULT );
1374 
1398  InputArray img2, const std::vector<KeyPoint>& keypoints2,
1399  const std::vector<DMatch>& matches1to2, InputOutputArray outImg,
1400  const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1),
1401  const std::vector<char>& matchesMask=std::vector<char>(), DrawMatchesFlags flags=DrawMatchesFlags::DEFAULT );
1402 
1405  InputArray img2, const std::vector<KeyPoint>& keypoints2,
1406  const std::vector<DMatch>& matches1to2, InputOutputArray outImg,
1407  const int matchesThickness, const Scalar& matchColor=Scalar::all(-1),
1408  const Scalar& singlePointColor=Scalar::all(-1), const std::vector<char>& matchesMask=std::vector<char>(),
1410 
1411 CV_EXPORTS_AS(drawMatchesKnn) void drawMatches( InputArray img1, const std::vector<KeyPoint>& keypoints1,
1413  const std::vector<std::vector<DMatch> >& matches1to2, InputOutputArray outImg,
1414  const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1),
1415  const std::vector<std::vector<char> >& matchesMask=std::vector<std::vector<char> >(), DrawMatchesFlags flags=DrawMatchesFlags::DEFAULT );
1416 
1418 
1419 /****************************************************************************************\
1420 * Functions to evaluate the feature detectors and [generic] descriptor extractors *
1421 \****************************************************************************************/
1422 
1425 
1426 CV_EXPORTS void evaluateFeatureDetector( const Mat& img1, const Mat& img2, const Mat& H1to2,
1427  std::vector<KeyPoint>* keypoints1, std::vector<KeyPoint>* keypoints2,
1428  float& repeatability, int& correspCount,
1429  const Ptr<FeatureDetector>& fdetector=Ptr<FeatureDetector>() );
1430 
1432  const std::vector<std::vector<uchar> >& correctMatches1to2Mask,
1433  std::vector<Point2f>& recallPrecisionCurve );
1434 
1435 CV_EXPORTS float getRecall( const std::vector<Point2f>& recallPrecisionCurve, float l_precision );
1436 CV_EXPORTS int getNearestPoint( const std::vector<Point2f>& recallPrecisionCurve, float l_precision );
1437 
1439 
1440 /****************************************************************************************\
1441 * Bag of visual words *
1442 \****************************************************************************************/
1443 
1446 
1453 {
1454 public:
1456  virtual ~BOWTrainer();
1457 
1465  CV_WRAP void add( const Mat& descriptors );
1466 
1470 
1474 
1475  CV_WRAP virtual void clear();
1476 
1478  CV_WRAP virtual Mat cluster() const = 0;
1479 
1489  CV_WRAP virtual Mat cluster( const Mat& descriptors ) const = 0;
1490 
1491 protected:
1493  int size;
1494 };
1495 
1499 {
1500 public:
1506  int attempts=3, int flags=KMEANS_PP_CENTERS );
1508 
1509  // Returns trained vocabulary (i.e. cluster centers).
1510  CV_WRAP virtual Mat cluster() const CV_OVERRIDE;
1511  CV_WRAP virtual Mat cluster( const Mat& descriptors ) const CV_OVERRIDE;
1512 
1513 protected:
1514 
1515  int clusterCount;
1517  int attempts;
1518  int flags;
1519 };
1520 
1532 {
1533 public:
1542  const Ptr<DescriptorMatcher>& dmatcher );
1546 
1552  CV_WRAP void setVocabulary( const Mat& vocabulary );
1553 
1556  CV_WRAP const Mat& getVocabulary() const;
1557 
1568  void compute( InputArray image, std::vector<KeyPoint>& keypoints, OutputArray imgDescriptor,
1569  std::vector<std::vector<int> >* pointIdxsOfClusters=0, Mat* descriptors=0 );
1577  void compute( InputArray keypointDescriptors, OutputArray imgDescriptor,
1578  std::vector<std::vector<int> >* pointIdxsOfClusters=0 );
1579  // compute() is not constant because DescriptorMatcher::match is not constant
1580 
1581  CV_WRAP_AS(compute) void compute2( const Mat& image, std::vector<KeyPoint>& keypoints, CV_OUT Mat& imgDescriptor )
1582  { compute(image,keypoints,imgDescriptor); }
1583 
1587 
1591 
1592 protected:
1596 };
1597 
1599 
1600 } /* namespace cv */
1601 
1602 #endif
Class implementing the AKAZE keypoint detector and descriptor extractor, described in .
Definition: features2d.hpp:858
virtual CV_WRAP void setDiffusivity(KAZE::DiffusivityType diff)=0
virtual CV_WRAP void setDescriptorSize(int dsize)=0
virtual CV_WRAP AKAZE::DescriptorType getDescriptorType() const =0
static CV_WRAP Ptr< AKAZE > create(AKAZE::DescriptorType descriptor_type=AKAZE::DESCRIPTOR_MLDB, int descriptor_size=0, int descriptor_channels=3, float threshold=0.001f, int nOctaves=4, int nOctaveLayers=4, KAZE::DiffusivityType diffusivity=KAZE::DIFF_PM_G2, int max_points=-1)
The AKAZE constructor.
virtual CV_WRAP double getThreshold() const =0
virtual CV_WRAP int getNOctaves() const =0
DescriptorType
Definition: features2d.hpp:862
@ DESCRIPTOR_MLDB
Definition: features2d.hpp:866
virtual CV_WRAP void setNOctaves(int octaves)=0
virtual CV_WRAP int getDescriptorChannels() const =0
virtual CV_WRAP void setThreshold(double threshold)=0
virtual CV_WRAP void setNOctaveLayers(int octaveLayers)=0
virtual CV_WRAP void setDescriptorChannels(int dch)=0
virtual CV_WRAP int getNOctaveLayers() const =0
virtual CV_WRAP void setDescriptorType(AKAZE::DescriptorType dtype)=0
virtual CV_WRAP int getDescriptorSize() const =0
virtual CV_WRAP String getDefaultName() const CV_OVERRIDE
virtual CV_WRAP KAZE::DiffusivityType getDiffusivity() const =0
Class for implementing the wrapper which makes detectors and extractors to be affine invariant,...
Definition: features2d.hpp:242
virtual CV_WRAP String getDefaultName() const CV_OVERRIDE
static CV_WRAP Ptr< AffineFeature > create(const Ptr< Feature2D > &backend, int maxTilt=5, int minTilt=0, float tiltStep=1.4142135623730951f, float rotateStepBase=72)
virtual CV_WRAP void setViewParams(const std::vector< float > &tilts, const std::vector< float > &rolls)=0
virtual CV_WRAP void getViewParams(std::vector< float > &tilts, std::vector< float > &rolls) const =0
Wrapping class for feature detection using the AGAST method. :
Definition: features2d.hpp:630
virtual CV_WRAP bool getNonmaxSuppression() const =0
virtual CV_WRAP void setNonmaxSuppression(bool f)=0
virtual CV_WRAP String getDefaultName() const CV_OVERRIDE
virtual CV_WRAP AgastFeatureDetector::DetectorType getType() const =0
virtual CV_WRAP int getThreshold() const =0
static CV_WRAP Ptr< AgastFeatureDetector > create(int threshold=10, bool nonmaxSuppression=true, AgastFeatureDetector::DetectorType type=AgastFeatureDetector::OAST_9_16)
virtual CV_WRAP void setThreshold(int threshold)=0
DetectorType
Definition: features2d.hpp:633
@ OAST_9_16
Definition: features2d.hpp:634
virtual CV_WRAP void setType(AgastFeatureDetector::DetectorType type)=0
This is a base class for all more or less complex algorithms in OpenCV.
Definition: core.hpp:3197
virtual CV_WRAP void write(FileStorage &fs) const
Stores algorithm parameters in a file storage.
Definition: core.hpp:3208
Brute-force descriptor matcher.
Definition: features2d.hpp:1247
virtual bool isMaskSupported() const CV_OVERRIDE
Returns true if the descriptor matcher supports masking permissible matches.
Definition: features2d.hpp:1257
virtual ~BFMatcher()
Definition: features2d.hpp:1255
CV_WRAP BFMatcher(int normType=NORM_L2, bool crossCheck=false)
Brute-force matcher constructor (obsolete). Please use BFMatcher.create()
static CV_WRAP Ptr< BFMatcher > create(int normType=NORM_L2, bool crossCheck=false)
Brute-force matcher create method.
virtual CV_NODISCARD_STD Ptr< DescriptorMatcher > clone(bool emptyTrainData=false) const CV_OVERRIDE
Clones the matcher.
Class to compute an image descriptor using the bag of visual words.
Definition: features2d.hpp:1532
Ptr< DescriptorMatcher > dmatcher
Definition: features2d.hpp:1595
CV_WRAP BOWImgDescriptorExtractor(const Ptr< Feature2D > &dextractor, const Ptr< DescriptorMatcher > &dmatcher)
The constructor.
CV_WRAP int descriptorSize() const
Returns an image descriptor size if the vocabulary is set. Otherwise, it returns 0.
CV_WRAP const Mat & getVocabulary() const
Returns the set vocabulary.
CV_WRAP_AS(compute) void compute2(const Mat &image
CV_WRAP int descriptorType() const
Returns an image descriptor type.
BOWImgDescriptorExtractor(const Ptr< DescriptorMatcher > &dmatcher)
Mat vocabulary
Definition: features2d.hpp:1593
void compute(InputArray image, std::vector< KeyPoint > &keypoints, OutputArray imgDescriptor, std::vector< std::vector< int > > *pointIdxsOfClusters=0, Mat *descriptors=0)
Computes an image descriptor using the set visual vocabulary.
Ptr< DescriptorExtractor > dextractor
Definition: features2d.hpp:1594
CV_WRAP void setVocabulary(const Mat &vocabulary)
Sets a visual vocabulary.
void compute(InputArray keypointDescriptors, OutputArray imgDescriptor, std::vector< std::vector< int > > *pointIdxsOfClusters=0)
kmeans -based class to train visual vocabulary using the bag of visual words approach....
Definition: features2d.hpp:1499
virtual CV_WRAP Mat cluster() const CV_OVERRIDE
virtual ~BOWKMeansTrainer()
CV_WRAP BOWKMeansTrainer(int clusterCount, const TermCriteria &termcrit=TermCriteria(), int attempts=3, int flags=KMEANS_PP_CENTERS)
The constructor.
Abstract base class for training the bag of visual words vocabulary from a set of descriptors.
Definition: features2d.hpp:1453
int size
Definition: features2d.hpp:1493
std::vector< Mat > descriptors
Definition: features2d.hpp:1492
CV_WRAP void add(const Mat &descriptors)
Adds descriptors to a training set.
CV_WRAP const std::vector< Mat > & getDescriptors() const
Returns a training set of descriptors.
virtual CV_WRAP void clear()
virtual ~BOWTrainer()
virtual CV_WRAP Mat cluster() const =0
CV_WRAP int descriptorsCount() const
Returns the count of all descriptors stored in the training set.
virtual CV_WRAP Mat cluster(const Mat &descriptors) const =0
Clusters train descriptors.
Class implementing the BRISK keypoint detector and descriptor extractor, described in .
Definition: features2d.hpp:354
static CV_WRAP Ptr< BRISK > create(const std::vector< float > &radiusList, const std::vector< int > &numberList, float dMax=5.85f, float dMin=8.2f, const std::vector< int > &indexChange=std::vector< int >())
The BRISK constructor for a custom pattern.
virtual CV_WRAP String getDefaultName() const CV_OVERRIDE
static CV_WRAP Ptr< BRISK > create(int thresh=30, int octaves=3, float patternScale=1.0f)
The BRISK constructor.
static CV_WRAP Ptr< BRISK > create(int thresh, int octaves, const std::vector< float > &radiusList, const std::vector< int > &numberList, float dMax=5.85f, float dMin=8.2f, const std::vector< int > &indexChange=std::vector< int >())
The BRISK constructor for a custom pattern, detection threshold and octaves.
Class for matching keypoint descriptors.
Definition: types.hpp:842
Definition: features2d.hpp:1199
std::vector< int > startIdxs
Definition: features2d.hpp:1218
Mat getDescriptor(int globalDescIdx) const
DescriptorCollection(const DescriptorCollection &collection)
void set(const std::vector< Mat > &descriptors)
Mat getDescriptor(int imgIdx, int localDescIdx) const
void getLocalIdx(int globalDescIdx, int &imgIdx, int &localDescIdx) const
Mat mergedDescriptors
Definition: features2d.hpp:1217
Abstract base class for matching keypoint descriptors.
Definition: features2d.hpp:995
static CV_WRAP Ptr< DescriptorMatcher > create(const DescriptorMatcher::MatcherType &matcherType)
static CV_NODISCARD_STD Mat clone_op(Mat m)
Definition: features2d.hpp:1232
virtual void knnMatchImpl(InputArray queryDescriptors, std::vector< std::vector< DMatch > > &matches, int k, InputArrayOfArrays masks=noArray(), bool compactResult=false)=0
static CV_WRAP Ptr< DescriptorMatcher > create(const String &descriptorMatcherType)
Creates a descriptor matcher of a given type with the default parameters (using default constructor).
std::vector< UMat > utrainDescCollection
Definition: features2d.hpp:1237
std::vector< Mat > trainDescCollection
Collection of descriptors from train images.
Definition: features2d.hpp:1236
virtual CV_WRAP void add(InputArrayOfArrays descriptors)
Adds descriptors to train a CPU(trainDescCollectionis) or GPU(utrainDescCollectionis) descriptor coll...
CV_WRAP const std::vector< Mat > & getTrainDescriptors() const
Returns a constant link to the train descriptor collection trainDescCollection .
virtual ~DescriptorMatcher()
virtual CV_WRAP void clear() CV_OVERRIDE
Clears the train descriptor collections.
static bool isPossibleMatch(InputArray mask, int queryIdx, int trainIdx)
virtual void write(FileStorage &) const CV_OVERRIDE
Stores algorithm parameters in a file storage.
void write(const Ptr< FileStorage > &fs, const String &name) const
Definition: features2d.hpp:1190
virtual CV_WRAP void read(const FileNode &) CV_OVERRIDE
Reads algorithm parameters from a file storage.
void checkMasks(InputArrayOfArrays masks, int queryDescriptorsCount) const
static bool isMaskedOut(InputArrayOfArrays masks, int queryIdx)
CV_WRAP virtual CV_NODISCARD_STD Ptr< DescriptorMatcher > clone(bool emptyTrainData=false) const =0
Clones the matcher.
CV_WRAP void read(const String &fileName)
Definition: features2d.hpp:1152
CV_WRAP void write(FileStorage &fs, const String &name) const
Definition: features2d.hpp:1188
MatcherType
Definition: features2d.hpp:998
virtual void radiusMatchImpl(InputArray queryDescriptors, std::vector< std::vector< DMatch > > &matches, float maxDistance, InputArrayOfArrays masks=noArray(), bool compactResult=false)=0
Wrapping class for feature detection using the FAST method. :
Definition: features2d.hpp:574
virtual CV_WRAP void setNonmaxSuppression(bool f)=0
virtual CV_WRAP int getThreshold() const =0
DetectorType
Definition: features2d.hpp:577
@ TYPE_9_16
Definition: features2d.hpp:578
virtual CV_WRAP void setType(FastFeatureDetector::DetectorType type)=0
virtual CV_WRAP void setThreshold(int threshold)=0
virtual CV_WRAP FastFeatureDetector::DetectorType getType() const =0
static CV_WRAP Ptr< FastFeatureDetector > create(int threshold=10, bool nonmaxSuppression=true, FastFeatureDetector::DetectorType type=FastFeatureDetector::TYPE_9_16)
virtual CV_WRAP bool getNonmaxSuppression() const =0
virtual CV_WRAP String getDefaultName() const CV_OVERRIDE
Abstract base class for 2D image feature detectors and descriptor extractors.
Definition: features2d.hpp:139
CV_WRAP void read(const String &fileName)
virtual CV_WRAP void detect(InputArrayOfArrays images, CV_OUT std::vector< std::vector< KeyPoint > > &keypoints, InputArrayOfArrays masks=noArray())
virtual void write(FileStorage &) const CV_OVERRIDE
Stores algorithm parameters in a file storage.
virtual CV_WRAP void compute(InputArray image, CV_OUT CV_IN_OUT std::vector< KeyPoint > &keypoints, OutputArray descriptors)
Computes the descriptors for a set of keypoints detected in an image (first variant) or image set (se...
virtual CV_WRAP void detect(InputArray image, CV_OUT std::vector< KeyPoint > &keypoints, InputArray mask=noArray())
Detects keypoints in an image (first variant) or image set (second variant).
CV_WRAP void write(const String &fileName) const
virtual ~Feature2D()
virtual CV_WRAP int descriptorType() const
virtual CV_WRAP void detectAndCompute(InputArray image, InputArray mask, CV_OUT std::vector< KeyPoint > &keypoints, OutputArray descriptors, bool useProvidedKeypoints=false)
virtual CV_WRAP bool empty() const CV_OVERRIDE
Return true if detector object is empty.
virtual CV_WRAP void read(const FileNode &) CV_OVERRIDE
Reads algorithm parameters from a file storage.
virtual CV_WRAP int defaultNorm() const
virtual CV_WRAP int descriptorSize() const
virtual CV_WRAP void compute(InputArrayOfArrays images, CV_OUT CV_IN_OUT std::vector< std::vector< KeyPoint > > &keypoints, OutputArrayOfArrays descriptors)
void write(const Ptr< FileStorage > &fs, const String &name) const
Definition: features2d.hpp:221
File Storage Node class.
Definition: persistence.hpp:482
XML/YAML/JSON file storage class that encapsulates all the information necessary for writing or readi...
Definition: persistence.hpp:304
CV_WRAP FileNode root(int streamidx=0) const
Returns the top-level mapping.
@ WRITE
value, open the file for writing
Definition: persistence.hpp:310
@ READ
value, open the file for reading
Definition: persistence.hpp:309
Wrapping class for feature detection using the goodFeaturesToTrack function. :
Definition: features2d.hpp:685
static CV_WRAP Ptr< GFTTDetector > create(int maxCorners, double qualityLevel, double minDistance, int blockSize, int gradiantSize, bool useHarrisDetector=false, double k=0.04)
virtual CV_WRAP String getDefaultName() const CV_OVERRIDE
virtual CV_WRAP void setMaxFeatures(int maxFeatures)=0
virtual CV_WRAP void setGradientSize(int gradientSize_)=0
virtual CV_WRAP double getMinDistance() const =0
virtual CV_WRAP void setQualityLevel(double qlevel)=0
virtual CV_WRAP void setMinDistance(double minDistance)=0
virtual CV_WRAP int getGradientSize()=0
virtual CV_WRAP void setK(double k)=0
virtual CV_WRAP int getBlockSize() const =0
virtual CV_WRAP bool getHarrisDetector() const =0
virtual CV_WRAP void setHarrisDetector(bool val)=0
virtual CV_WRAP double getK() const =0
static CV_WRAP Ptr< GFTTDetector > create(int maxCorners=1000, double qualityLevel=0.01, double minDistance=1, int blockSize=3, bool useHarrisDetector=false, double k=0.04)
virtual CV_WRAP void setBlockSize(int blockSize)=0
virtual CV_WRAP int getMaxFeatures() const =0
virtual CV_WRAP double getQualityLevel() const =0
Class implementing the KAZE keypoint detector and descriptor extractor, described in .
Definition: features2d.hpp:796
virtual CV_WRAP void setThreshold(double threshold)=0
virtual CV_WRAP int getNOctaves() const =0
virtual CV_WRAP void setExtended(bool extended)=0
virtual CV_WRAP String getDefaultName() const CV_OVERRIDE
virtual CV_WRAP KAZE::DiffusivityType getDiffusivity() const =0
virtual CV_WRAP void setNOctaves(int octaves)=0
virtual CV_WRAP bool getUpright() const =0
virtual CV_WRAP double getThreshold() const =0
virtual CV_WRAP void setNOctaveLayers(int octaveLayers)=0
DiffusivityType
Definition: features2d.hpp:799
@ DIFF_PM_G2
Definition: features2d.hpp:801
virtual CV_WRAP void setDiffusivity(KAZE::DiffusivityType diff)=0
static CV_WRAP Ptr< KAZE > create(bool extended=false, bool upright=false, float threshold=0.001f, int nOctaves=4, int nOctaveLayers=4, KAZE::DiffusivityType diffusivity=KAZE::DIFF_PM_G2)
The KAZE constructor.
virtual CV_WRAP void setUpright(bool upright)=0
virtual CV_WRAP bool getExtended() const =0
virtual CV_WRAP int getNOctaveLayers() const =0
Data structure for salient point detectors.
Definition: types.hpp:745
A class filters a vector of keypoints.
Definition: features2d.hpp:93
static void runByKeypointSize(std::vector< KeyPoint > &keypoints, float minSize, float maxSize=FLT_MAX)
KeyPointsFilter()
Definition: features2d.hpp:95
static void removeDuplicatedSorted(std::vector< KeyPoint > &keypoints)
static void runByImageBorder(std::vector< KeyPoint > &keypoints, Size imageSize, int borderSize)
static void removeDuplicated(std::vector< KeyPoint > &keypoints)
static void retainBest(std::vector< KeyPoint > &keypoints, int npoints)
static void runByPixelsMask(std::vector< KeyPoint > &keypoints, const Mat &mask)
static void runByPixelsMask2VectorPoint(std::vector< KeyPoint > &keypoints, std::vector< std::vector< Point > > &removeFrom, const Mat &mask)
Maximally stable extremal region extractor.
Definition: features2d.hpp:508
virtual CV_WRAP bool getPass2Only() const =0
virtual CV_WRAP int getMaxEvolution() const =0
virtual CV_WRAP void setMinDiversity(double minDiversity)=0
virtual CV_WRAP String getDefaultName() const CV_OVERRIDE
virtual CV_WRAP void setAreaThreshold(double areaThreshold)=0
virtual CV_WRAP void setEdgeBlurSize(int edge_blur_size)=0
virtual CV_WRAP void setMinArea(int minArea)=0
virtual CV_WRAP void setPass2Only(bool f)=0
virtual CV_WRAP void setMaxArea(int maxArea)=0
virtual CV_WRAP int getMinArea() const =0
static CV_WRAP Ptr< MSER > create(int delta=5, int min_area=60, int max_area=14400, double max_variation=0.25, double min_diversity=.2, int max_evolution=200, double area_threshold=1.01, double min_margin=0.003, int edge_blur_size=5)
Full constructor for MSER detector.
virtual CV_WRAP double getAreaThreshold() const =0
virtual CV_WRAP double getMinDiversity() const =0
virtual CV_WRAP void setMaxVariation(double maxVariation)=0
virtual CV_WRAP int getMaxArea() const =0
virtual CV_WRAP void setMinMargin(double min_margin)=0
virtual CV_WRAP void detectRegions(InputArray image, CV_OUT std::vector< std::vector< Point > > &msers, CV_OUT std::vector< Rect > &bboxes)=0
Detect MSER regions.
virtual CV_WRAP void setDelta(int delta)=0
virtual CV_WRAP double getMaxVariation() const =0
virtual CV_WRAP int getEdgeBlurSize() const =0
virtual CV_WRAP int getDelta() const =0
virtual CV_WRAP double getMinMargin() const =0
virtual CV_WRAP void setMaxEvolution(int maxEvolution)=0
n-dimensional dense array class
Definition: mat.hpp:812
CV_NODISCARD_STD Mat clone() const
Creates a full copy of the array and the underlying data.
Class implementing the ORB (oriented BRIEF) keypoint detector and descriptor extractor.
Definition: features2d.hpp:424
virtual CV_WRAP void setFirstLevel(int firstLevel)=0
virtual CV_WRAP int getEdgeThreshold() const =0
virtual CV_WRAP void setMaxFeatures(int maxFeatures)=0
static CV_WRAP Ptr< ORB > create(int nfeatures=500, float scaleFactor=1.2f, int nlevels=8, int edgeThreshold=31, int firstLevel=0, int WTA_K=2, ORB::ScoreType scoreType=ORB::HARRIS_SCORE, int patchSize=31, int fastThreshold=20)
The ORB constructor.
virtual CV_WRAP void setWTA_K(int wta_k)=0
virtual CV_WRAP void setEdgeThreshold(int edgeThreshold)=0
virtual CV_WRAP String getDefaultName() const CV_OVERRIDE
ScoreType
Definition: features2d.hpp:426
@ HARRIS_SCORE
Definition: features2d.hpp:426
virtual CV_WRAP void setScoreType(ORB::ScoreType scoreType)=0
virtual CV_WRAP int getMaxFeatures() const =0
virtual CV_WRAP void setNLevels(int nlevels)=0
virtual CV_WRAP void setScaleFactor(double scaleFactor)=0
virtual CV_WRAP void setPatchSize(int patchSize)=0
virtual CV_WRAP int getFastThreshold() const =0
virtual CV_WRAP double getScaleFactor() const =0
virtual CV_WRAP int getFirstLevel() const =0
virtual CV_WRAP ORB::ScoreType getScoreType() const =0
virtual CV_WRAP int getWTA_K() const =0
virtual CV_WRAP int getPatchSize() const =0
virtual CV_WRAP void setFastThreshold(int fastThreshold)=0
virtual CV_WRAP int getNLevels() const =0
Template class for 2D points specified by its coordinates x and y.
Definition: types.hpp:163
Class for extracting keypoints and computing descriptors using the Scale Invariant Feature Transform ...
Definition: features2d.hpp:267
static CV_WRAP Ptr< SIFT > create(int nfeatures=0, int nOctaveLayers=3, double contrastThreshold=0.04, double edgeThreshold=10, double sigma=1.6, bool enable_precise_upscale=false)
virtual CV_WRAP String getDefaultName() const CV_OVERRIDE
static CV_WRAP Ptr< SIFT > create(int nfeatures, int nOctaveLayers, double contrastThreshold, double edgeThreshold, double sigma, int descriptorType, bool enable_precise_upscale=false)
Create SIFT with specified descriptorType.
Class for extracting blobs from an image. :
Definition: features2d.hpp:746
virtual CV_WRAP SimpleBlobDetector::Params getParams() const =0
virtual CV_WRAP String getDefaultName() const CV_OVERRIDE
virtual CV_WRAP void setParams(const SimpleBlobDetector::Params &params)=0
static CV_WRAP Ptr< SimpleBlobDetector > create(const SimpleBlobDetector::Params &parameters=SimpleBlobDetector::Params())
Template class for specifying the size of an image or rectangle.
Definition: types.hpp:335
The class defining termination criteria for iterative algorithms.
Definition: types.hpp:886
Definition: mat.hpp:387
This type is very similar to InputArray except that it is used for input/output and output function p...
Definition: mat.hpp:296
CV_EXPORTS_AS(calibrateCameraExtended) double calibrateCamera(InputArrayOfArrays objectPoints
Finds the camera intrinsic and extrinsic parameters from several views of a calibration pattern.
InputArrayOfArrays InputArrayOfArrays InputOutputArray InputOutputArray InputOutputArray InputOutputArray Size InputOutputArray InputOutputArray T
Definition: calib3d.hpp:1867
InputArrayOfArrays Size InputOutputArray InputOutputArray OutputArrayOfArrays OutputArrayOfArrays OutputArray OutputArray OutputArray int flags
Definition: calib3d.hpp:1617
InputArrayOfArrays Size imageSize
Definition: calib3d.hpp:1611
CV_EXPORTS_W void add(InputArray src1, InputArray src2, OutputArray dst, InputArray mask=noArray(), int dtype=-1)
Calculates the per-element sum of two arrays or an array and a scalar.
NormTypes
Definition: base.hpp:159
@ NORM_L2
Definition: base.hpp:185
@ NORM_L1
Definition: base.hpp:176
@ NORM_L2SQR
Definition: base.hpp:194
CV_EXPORTS InputOutputArray noArray()
InputArray InputArrayOfArrays
Definition: mat.hpp:443
CV__DEBUG_NS_END typedef const _InputArray & InputArray
Definition: mat.hpp:442
CvSize size
Definition: core_c.h:112
int int type
Definition: core_c.h:221
int CvArr CvTermCriteria termcrit
Definition: core_c.h:1927
@ KMEANS_PP_CENTERS
Definition: core.hpp:213
unsigned char uchar
Definition: interface.h:51
#define CV_EXPORTS_W_SIMPLE
Definition: cvdef.h:473
#define CV_EXPORTS
Definition: cvdef.h:435
#define CV_IN_OUT
Definition: cvdef.h:477
#define CV_ENUM_FLAGS(EnumType)
Definition: cvdef.h:649
#define CV_OVERRIDE
Definition: cvdef.h:792
#define CV_OUT
Definition: cvdef.h:478
#define CV_NODISCARD_STD
Definition: cvdef.h:767
#define CV_EXPORTS_W
Definition: cvdef.h:472
#define CV_PROP_RW
Definition: cvdef.h:480
#define CV_WRAP
Definition: cvdef.h:481
#define CV_Assert(expr)
Checks a condition at runtime and throws exception if it fails.
Definition: base.hpp:342
CV_EXPORTS_W void drawMatches(InputArray img1, const std::vector< KeyPoint > &keypoints1, InputArray img2, const std::vector< KeyPoint > &keypoints2, const std::vector< DMatch > &matches1to2, InputOutputArray outImg, const Scalar &matchColor=Scalar::all(-1), const Scalar &singlePointColor=Scalar::all(-1), const std::vector< char > &matchesMask=std::vector< char >(), DrawMatchesFlags flags=DrawMatchesFlags::DEFAULT)
Draws the found matches of keypoints from two images.
const std::vector< KeyPoint > InputArray const std::vector< KeyPoint > const std::vector< std::vector< DMatch > > InputOutputArray outImg
Definition: features2d.hpp:1413
DrawMatchesFlags
Definition: features2d.hpp:1343
const std::vector< KeyPoint > InputArray const std::vector< KeyPoint > & keypoints2
Definition: features2d.hpp:1412
const std::vector< KeyPoint > InputArray const std::vector< KeyPoint > const std::vector< std::vector< DMatch > > InputOutputArray const Scalar const Scalar const std::vector< std::vector< char > > & matchesMask
Definition: features2d.hpp:1415
const std::vector< KeyPoint > InputArray img2
Definition: features2d.hpp:1412
const std::vector< KeyPoint > & keypoints1
Definition: features2d.hpp:1411
const std::vector< KeyPoint > InputArray const std::vector< KeyPoint > const std::vector< std::vector< DMatch > > & matches1to2
Definition: features2d.hpp:1413
CV_EXPORTS_W void drawKeypoints(InputArray image, const std::vector< KeyPoint > &keypoints, InputOutputArray outImage, const Scalar &color=Scalar::all(-1), DrawMatchesFlags flags=DrawMatchesFlags::DEFAULT)
Draws keypoints.
const std::vector< KeyPoint > InputArray const std::vector< KeyPoint > const std::vector< std::vector< DMatch > > InputOutputArray const Scalar const Scalar & singlePointColor
Definition: features2d.hpp:1414
const std::vector< KeyPoint > InputArray const std::vector< KeyPoint > const std::vector< std::vector< DMatch > > InputOutputArray const Scalar & matchColor
Definition: features2d.hpp:1414
@ NOT_DRAW_SINGLE_POINTS
Single keypoints will not be drawn.
Feature2D FeatureDetector
Definition: features2d.hpp:228
CV_EXPORTS void evaluateFeatureDetector(const Mat &img1, const Mat &img2, const Mat &H1to2, std::vector< KeyPoint > *keypoints1, std::vector< KeyPoint > *keypoints2, float &repeatability, int &correspCount, const Ptr< FeatureDetector > &fdetector=Ptr< FeatureDetector >())
CV_EXPORTS void computeRecallPrecisionCurve(const std::vector< std::vector< DMatch > > &matches1to2, const std::vector< std::vector< uchar > > &correctMatches1to2Mask, std::vector< Point2f > &recallPrecisionCurve)
CV_EXPORTS int getNearestPoint(const std::vector< Point2f > &recallPrecisionCurve, float l_precision)
CV_EXPORTS float getRecall(const std::vector< Point2f > &recallPrecisionCurve, float l_precision)
CV_EXPORTS void FAST(InputArray image, CV_OUT std::vector< KeyPoint > &keypoints, int threshold, bool nonmaxSuppression=true)
CV_EXPORTS void AGAST(InputArray image, CV_OUT std::vector< KeyPoint > &keypoints, int threshold, bool nonmaxSuppression=true)
Feature2D DescriptorExtractor
Definition: features2d.hpp:235
CvPoint CvPoint CvScalar color
Definition: imgproc_c.h:968
CvSize int int int CvPoint int delta
Definition: imgproc_c.h:1168
CV_EXPORTS OutputArray int double double InputArray OutputArray int int bool useHarrisDetector
Definition: imgproc.hpp:2133
CV_EXPORTS OutputArray int maxCorners
Definition: imgproc.hpp:2131
CV_EXPORTS OutputArray int double qualityLevel
Definition: imgproc.hpp:2131
CV_EXPORTS OutputArray int double double InputArray mask
Definition: imgproc.hpp:2132
CV_EXPORTS OutputArray int double double InputArray OutputArray int blockSize
Definition: imgproc.hpp:2132
CV_EXPORTS OutputArray int double double InputArray OutputArray int int bool double k
Definition: imgproc.hpp:2133
CV_EXPORTS OutputArray int double double minDistance
Definition: imgproc.hpp:2131
CV_EXPORTS_W double threshold(InputArray src, OutputArray dst, double thresh, double maxval, int type)
Applies a fixed-level threshold to each array element.
"black box" representation of the file storage associated with a file on disk.
Definition: calib3d.hpp:441
CV_EXPORTS void read(const FileNode &node, int &value, int default_value)
CV_EXPORTS void write(FileStorage &fs, const String &name, int value)
T sqrt(T... args)
float Type
Definition: features2d.hpp:929
float Type
Definition: features2d.hpp:930
float Type
Definition: features2d.hpp:927
float Type
Definition: features2d.hpp:928
Definition: features2d.hpp:923
T Type
Definition: features2d.hpp:924
Definition: features2d.hpp:969
T ValueType
Definition: features2d.hpp:971
Accumulator< T >::Type ResultType
Definition: features2d.hpp:972
ResultType operator()(const T *a, const T *b, int size) const
Definition: features2d.hpp:974
Definition: features2d.hpp:953
Accumulator< T >::Type ResultType
Definition: features2d.hpp:956
ResultType operator()(const T *a, const T *b, int size) const
Definition: features2d.hpp:958
T ValueType
Definition: features2d.hpp:955
Definition: cvstd_wrapper.hpp:74
Definition: features2d.hpp:937
ResultType operator()(const T *a, const T *b, int size) const
Definition: features2d.hpp:942
T ValueType
Definition: features2d.hpp:939
Accumulator< T >::Type ResultType
Definition: features2d.hpp:940
Definition: features2d.hpp:749
CV_PROP_RW float maxCircularity
Definition: features2d.hpp:764
void write(FileStorage &fs) const
CV_PROP_RW float maxArea
Definition: features2d.hpp:761
void read(const FileNode &fn)
CV_PROP_RW bool filterByConvexity
Definition: features2d.hpp:769
CV_PROP_RW size_t minRepeatability
Definition: features2d.hpp:754
CV_PROP_RW bool filterByCircularity
Definition: features2d.hpp:763
CV_PROP_RW bool filterByArea
Definition: features2d.hpp:760
CV_PROP_RW float maxConvexity
Definition: features2d.hpp:770
CV_PROP_RW float maxThreshold
Definition: features2d.hpp:753
CV_PROP_RW bool filterByColor
Definition: features2d.hpp:757
CV_PROP_RW bool collectContours
Definition: features2d.hpp:772
CV_PROP_RW float minDistBetweenBlobs
Definition: features2d.hpp:755
CV_PROP_RW bool filterByInertia
Definition: features2d.hpp:766
CV_PROP_RW float minThreshold
Definition: features2d.hpp:752
CV_PROP_RW float thresholdStep
Definition: features2d.hpp:751
CV_PROP_RW uchar blobColor
Definition: features2d.hpp:758
CV_PROP_RW float maxInertiaRatio
Definition: features2d.hpp:767