12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325 |
- #ifndef __OPENCV_FEATURES_2D_HPP__
- #define __OPENCV_FEATURES_2D_HPP__
- #include "opencv2/core.hpp"
- #include "opencv2/flann/miniflann.hpp"
- namespace cv
- {
- class CV_EXPORTS KeyPointsFilter
- {
- public:
- KeyPointsFilter(){}
-
- static void runByImageBorder( std::vector<KeyPoint>& keypoints, Size imageSize, int borderSize );
-
- static void runByKeypointSize( std::vector<KeyPoint>& keypoints, float minSize,
- float maxSize=FLT_MAX );
-
- static void runByPixelsMask( std::vector<KeyPoint>& keypoints, const Mat& mask );
-
- static void removeDuplicated( std::vector<KeyPoint>& keypoints );
-
- static void retainBest( std::vector<KeyPoint>& keypoints, int npoints );
- };
- class CV_EXPORTS_W Feature2D : public virtual Algorithm
- {
- public:
- virtual ~Feature2D();
-
- CV_WRAP virtual void detect( InputArray image,
- CV_OUT std::vector<KeyPoint>& keypoints,
- InputArray mask=noArray() );
-
- virtual void detect( InputArrayOfArrays images,
- std::vector<std::vector<KeyPoint> >& keypoints,
- InputArrayOfArrays masks=noArray() );
-
- CV_WRAP virtual void compute( InputArray image,
- CV_OUT CV_IN_OUT std::vector<KeyPoint>& keypoints,
- OutputArray descriptors );
-
- virtual void compute( InputArrayOfArrays images,
- std::vector<std::vector<KeyPoint> >& keypoints,
- OutputArrayOfArrays descriptors );
-
- CV_WRAP virtual void detectAndCompute( InputArray image, InputArray mask,
- CV_OUT std::vector<KeyPoint>& keypoints,
- OutputArray descriptors,
- bool useProvidedKeypoints=false );
- CV_WRAP virtual int descriptorSize() const;
- CV_WRAP virtual int descriptorType() const;
- CV_WRAP virtual int defaultNorm() const;
-
- CV_WRAP virtual bool empty() const;
- };
- typedef Feature2D FeatureDetector;
- typedef Feature2D DescriptorExtractor;
- class CV_EXPORTS_W BRISK : public Feature2D
- {
- public:
-
- CV_WRAP static Ptr<BRISK> create(int thresh=30, int octaves=3, float patternScale=1.0f);
-
- CV_WRAP static 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>());
- };
- class CV_EXPORTS_W ORB : public Feature2D
- {
- public:
- enum { kBytes = 32, HARRIS_SCORE=0, FAST_SCORE=1 };
-
- CV_WRAP static Ptr<ORB> create(int nfeatures=500, float scaleFactor=1.2f, int nlevels=8, int edgeThreshold=31,
- int firstLevel=0, int WTA_K=2, int scoreType=ORB::HARRIS_SCORE, int patchSize=31, int fastThreshold=20);
- CV_WRAP virtual void setMaxFeatures(int maxFeatures) = 0;
- CV_WRAP virtual int getMaxFeatures() const = 0;
- CV_WRAP virtual void setScaleFactor(double scaleFactor) = 0;
- CV_WRAP virtual double getScaleFactor() const = 0;
- CV_WRAP virtual void setNLevels(int nlevels) = 0;
- CV_WRAP virtual int getNLevels() const = 0;
- CV_WRAP virtual void setEdgeThreshold(int edgeThreshold) = 0;
- CV_WRAP virtual int getEdgeThreshold() const = 0;
- CV_WRAP virtual void setFirstLevel(int firstLevel) = 0;
- CV_WRAP virtual int getFirstLevel() const = 0;
- CV_WRAP virtual void setWTA_K(int wta_k) = 0;
- CV_WRAP virtual int getWTA_K() const = 0;
- CV_WRAP virtual void setScoreType(int scoreType) = 0;
- CV_WRAP virtual int getScoreType() const = 0;
- CV_WRAP virtual void setPatchSize(int patchSize) = 0;
- CV_WRAP virtual int getPatchSize() const = 0;
- CV_WRAP virtual void setFastThreshold(int fastThreshold) = 0;
- CV_WRAP virtual int getFastThreshold() const = 0;
- };
- class CV_EXPORTS_W MSER : public Feature2D
- {
- public:
-
- CV_WRAP static 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 );
-
- CV_WRAP virtual void detectRegions( InputArray image,
- CV_OUT std::vector<std::vector<Point> >& msers,
- std::vector<Rect>& bboxes ) = 0;
- CV_WRAP virtual void setDelta(int delta) = 0;
- CV_WRAP virtual int getDelta() const = 0;
- CV_WRAP virtual void setMinArea(int minArea) = 0;
- CV_WRAP virtual int getMinArea() const = 0;
- CV_WRAP virtual void setMaxArea(int maxArea) = 0;
- CV_WRAP virtual int getMaxArea() const = 0;
- CV_WRAP virtual void setPass2Only(bool f) = 0;
- CV_WRAP virtual bool getPass2Only() const = 0;
- };
- CV_EXPORTS void FAST( InputArray image, CV_OUT std::vector<KeyPoint>& keypoints,
- int threshold, bool nonmaxSuppression=true );
- CV_EXPORTS void FAST( InputArray image, CV_OUT std::vector<KeyPoint>& keypoints,
- int threshold, bool nonmaxSuppression, int type );
- class CV_EXPORTS_W FastFeatureDetector : public Feature2D
- {
- public:
- enum
- {
- TYPE_5_8 = 0, TYPE_7_12 = 1, TYPE_9_16 = 2,
- THRESHOLD = 10000, NONMAX_SUPPRESSION=10001, FAST_N=10002,
- };
- CV_WRAP static Ptr<FastFeatureDetector> create( int threshold=10,
- bool nonmaxSuppression=true,
- int type=FastFeatureDetector::TYPE_9_16 );
- CV_WRAP virtual void setThreshold(int threshold) = 0;
- CV_WRAP virtual int getThreshold() const = 0;
- CV_WRAP virtual void setNonmaxSuppression(bool f) = 0;
- CV_WRAP virtual bool getNonmaxSuppression() const = 0;
- CV_WRAP virtual void setType(int type) = 0;
- CV_WRAP virtual int getType() const = 0;
- };
- CV_EXPORTS void AGAST( 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, int type );
- class CV_EXPORTS_W AgastFeatureDetector : public Feature2D
- {
- public:
- enum
- {
- AGAST_5_8 = 0, AGAST_7_12d = 1, AGAST_7_12s = 2, OAST_9_16 = 3,
- THRESHOLD = 10000, NONMAX_SUPPRESSION = 10001,
- };
- CV_WRAP static Ptr<AgastFeatureDetector> create( int threshold=10,
- bool nonmaxSuppression=true,
- int type=AgastFeatureDetector::OAST_9_16 );
- CV_WRAP virtual void setThreshold(int threshold) = 0;
- CV_WRAP virtual int getThreshold() const = 0;
- CV_WRAP virtual void setNonmaxSuppression(bool f) = 0;
- CV_WRAP virtual bool getNonmaxSuppression() const = 0;
- CV_WRAP virtual void setType(int type) = 0;
- CV_WRAP virtual int getType() const = 0;
- };
- class CV_EXPORTS_W GFTTDetector : public Feature2D
- {
- public:
- CV_WRAP static Ptr<GFTTDetector> create( int maxCorners=1000, double qualityLevel=0.01, double minDistance=1,
- int blockSize=3, bool useHarrisDetector=false, double k=0.04 );
- CV_WRAP virtual void setMaxFeatures(int maxFeatures) = 0;
- CV_WRAP virtual int getMaxFeatures() const = 0;
- CV_WRAP virtual void setQualityLevel(double qlevel) = 0;
- CV_WRAP virtual double getQualityLevel() const = 0;
- CV_WRAP virtual void setMinDistance(double minDistance) = 0;
- CV_WRAP virtual double getMinDistance() const = 0;
- CV_WRAP virtual void setBlockSize(int blockSize) = 0;
- CV_WRAP virtual int getBlockSize() const = 0;
- CV_WRAP virtual void setHarrisDetector(bool val) = 0;
- CV_WRAP virtual bool getHarrisDetector() const = 0;
- CV_WRAP virtual void setK(double k) = 0;
- CV_WRAP virtual double getK() const = 0;
- };
- class CV_EXPORTS_W SimpleBlobDetector : public Feature2D
- {
- public:
- struct CV_EXPORTS_W_SIMPLE Params
- {
- CV_WRAP Params();
- CV_PROP_RW float thresholdStep;
- CV_PROP_RW float minThreshold;
- CV_PROP_RW float maxThreshold;
- CV_PROP_RW size_t minRepeatability;
- CV_PROP_RW float minDistBetweenBlobs;
- CV_PROP_RW bool filterByColor;
- CV_PROP_RW uchar blobColor;
- CV_PROP_RW bool filterByArea;
- CV_PROP_RW float minArea, maxArea;
- CV_PROP_RW bool filterByCircularity;
- CV_PROP_RW float minCircularity, maxCircularity;
- CV_PROP_RW bool filterByInertia;
- CV_PROP_RW float minInertiaRatio, maxInertiaRatio;
- CV_PROP_RW bool filterByConvexity;
- CV_PROP_RW float minConvexity, maxConvexity;
- void read( const FileNode& fn );
- void write( FileStorage& fs ) const;
- };
- CV_WRAP static Ptr<SimpleBlobDetector>
- create(const SimpleBlobDetector::Params ¶meters = SimpleBlobDetector::Params());
- };
- class CV_EXPORTS_W KAZE : public Feature2D
- {
- public:
- enum
- {
- DIFF_PM_G1 = 0,
- DIFF_PM_G2 = 1,
- DIFF_WEICKERT = 2,
- DIFF_CHARBONNIER = 3
- };
-
- CV_WRAP static Ptr<KAZE> create(bool extended=false, bool upright=false,
- float threshold = 0.001f,
- int nOctaves = 4, int nOctaveLayers = 4,
- int diffusivity = KAZE::DIFF_PM_G2);
- CV_WRAP virtual void setExtended(bool extended) = 0;
- CV_WRAP virtual bool getExtended() const = 0;
- CV_WRAP virtual void setUpright(bool upright) = 0;
- CV_WRAP virtual bool getUpright() const = 0;
- CV_WRAP virtual void setThreshold(double threshold) = 0;
- CV_WRAP virtual double getThreshold() const = 0;
- CV_WRAP virtual void setNOctaves(int octaves) = 0;
- CV_WRAP virtual int getNOctaves() const = 0;
- CV_WRAP virtual void setNOctaveLayers(int octaveLayers) = 0;
- CV_WRAP virtual int getNOctaveLayers() const = 0;
- CV_WRAP virtual void setDiffusivity(int diff) = 0;
- CV_WRAP virtual int getDiffusivity() const = 0;
- };
- class CV_EXPORTS_W AKAZE : public Feature2D
- {
- public:
-
- enum
- {
- DESCRIPTOR_KAZE_UPRIGHT = 2,
- DESCRIPTOR_KAZE = 3,
- DESCRIPTOR_MLDB_UPRIGHT = 4,
- DESCRIPTOR_MLDB = 5
- };
-
- CV_WRAP static Ptr<AKAZE> create(int descriptor_type=AKAZE::DESCRIPTOR_MLDB,
- int descriptor_size = 0, int descriptor_channels = 3,
- float threshold = 0.001f, int nOctaves = 4,
- int nOctaveLayers = 4, int diffusivity = KAZE::DIFF_PM_G2);
- CV_WRAP virtual void setDescriptorType(int dtype) = 0;
- CV_WRAP virtual int getDescriptorType() const = 0;
- CV_WRAP virtual void setDescriptorSize(int dsize) = 0;
- CV_WRAP virtual int getDescriptorSize() const = 0;
- CV_WRAP virtual void setDescriptorChannels(int dch) = 0;
- CV_WRAP virtual int getDescriptorChannels() const = 0;
- CV_WRAP virtual void setThreshold(double threshold) = 0;
- CV_WRAP virtual double getThreshold() const = 0;
- CV_WRAP virtual void setNOctaves(int octaves) = 0;
- CV_WRAP virtual int getNOctaves() const = 0;
- CV_WRAP virtual void setNOctaveLayers(int octaveLayers) = 0;
- CV_WRAP virtual int getNOctaveLayers() const = 0;
- CV_WRAP virtual void setDiffusivity(int diff) = 0;
- CV_WRAP virtual int getDiffusivity() const = 0;
- };
- template<typename T>
- struct CV_EXPORTS Accumulator
- {
- typedef T Type;
- };
- template<> struct Accumulator<unsigned char> { typedef float Type; };
- template<> struct Accumulator<unsigned short> { typedef float Type; };
- template<> struct Accumulator<char> { typedef float Type; };
- template<> struct Accumulator<short> { typedef float Type; };
- template<class T>
- struct CV_EXPORTS SL2
- {
- enum { normType = NORM_L2SQR };
- typedef T ValueType;
- typedef typename Accumulator<T>::Type ResultType;
- ResultType operator()( const T* a, const T* b, int size ) const
- {
- return normL2Sqr<ValueType, ResultType>(a, b, size);
- }
- };
- template<class T>
- struct CV_EXPORTS L2
- {
- enum { normType = NORM_L2 };
- typedef T ValueType;
- typedef typename Accumulator<T>::Type ResultType;
- ResultType operator()( const T* a, const T* b, int size ) const
- {
- return (ResultType)std::sqrt((double)normL2Sqr<ValueType, ResultType>(a, b, size));
- }
- };
- template<class T>
- struct CV_EXPORTS L1
- {
- enum { normType = NORM_L1 };
- typedef T ValueType;
- typedef typename Accumulator<T>::Type ResultType;
- ResultType operator()( const T* a, const T* b, int size ) const
- {
- return normL1<ValueType, ResultType>(a, b, size);
- }
- };
- class CV_EXPORTS_W DescriptorMatcher : public Algorithm
- {
- public:
- virtual ~DescriptorMatcher();
-
- CV_WRAP virtual void add( InputArrayOfArrays descriptors );
-
- CV_WRAP const std::vector<Mat>& getTrainDescriptors() const;
-
- CV_WRAP virtual void clear();
-
- CV_WRAP virtual bool empty() const;
-
- CV_WRAP virtual bool isMaskSupported() const = 0;
-
- CV_WRAP virtual void train();
-
- CV_WRAP void match( InputArray queryDescriptors, InputArray trainDescriptors,
- CV_OUT std::vector<DMatch>& matches, InputArray mask=noArray() ) const;
-
- CV_WRAP void knnMatch( InputArray queryDescriptors, InputArray trainDescriptors,
- CV_OUT std::vector<std::vector<DMatch> >& matches, int k,
- InputArray mask=noArray(), bool compactResult=false ) const;
-
- void radiusMatch( InputArray queryDescriptors, InputArray trainDescriptors,
- std::vector<std::vector<DMatch> >& matches, float maxDistance,
- InputArray mask=noArray(), bool compactResult=false ) const;
-
- CV_WRAP void match( InputArray queryDescriptors, CV_OUT std::vector<DMatch>& matches,
- InputArrayOfArrays masks=noArray() );
-
- CV_WRAP void knnMatch( InputArray queryDescriptors, CV_OUT std::vector<std::vector<DMatch> >& matches, int k,
- InputArrayOfArrays masks=noArray(), bool compactResult=false );
-
- void radiusMatch( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
- InputArrayOfArrays masks=noArray(), bool compactResult=false );
-
- virtual void read( const FileNode& );
-
- virtual void write( FileStorage& ) const;
-
- virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const = 0;
-
- CV_WRAP static Ptr<DescriptorMatcher> create( const String& descriptorMatcherType );
- protected:
-
- class CV_EXPORTS DescriptorCollection
- {
- public:
- DescriptorCollection();
- DescriptorCollection( const DescriptorCollection& collection );
- virtual ~DescriptorCollection();
-
- void set( const std::vector<Mat>& descriptors );
- virtual void clear();
- const Mat& getDescriptors() const;
- const Mat getDescriptor( int imgIdx, int localDescIdx ) const;
- const Mat getDescriptor( int globalDescIdx ) const;
- void getLocalIdx( int globalDescIdx, int& imgIdx, int& localDescIdx ) const;
- int size() const;
- protected:
- Mat mergedDescriptors;
- std::vector<int> startIdxs;
- };
-
-
-
- virtual void knnMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, int k,
- InputArrayOfArrays masks=noArray(), bool compactResult=false ) = 0;
- virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
- InputArrayOfArrays masks=noArray(), bool compactResult=false ) = 0;
- static bool isPossibleMatch( InputArray mask, int queryIdx, int trainIdx );
- static bool isMaskedOut( InputArrayOfArrays masks, int queryIdx );
- static Mat clone_op( Mat m ) { return m.clone(); }
- void checkMasks( InputArrayOfArrays masks, int queryDescriptorsCount ) const;
-
- std::vector<Mat> trainDescCollection;
- std::vector<UMat> utrainDescCollection;
- };
- class CV_EXPORTS_W BFMatcher : public DescriptorMatcher
- {
- public:
-
- CV_WRAP BFMatcher( int normType=NORM_L2, bool crossCheck=false );
- virtual ~BFMatcher() {}
- virtual bool isMaskSupported() const { return true; }
- virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const;
- protected:
- virtual void knnMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, int k,
- InputArrayOfArrays masks=noArray(), bool compactResult=false );
- virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
- InputArrayOfArrays masks=noArray(), bool compactResult=false );
- int normType;
- bool crossCheck;
- };
- class CV_EXPORTS_W FlannBasedMatcher : public DescriptorMatcher
- {
- public:
- CV_WRAP FlannBasedMatcher( const Ptr<flann::IndexParams>& indexParams=makePtr<flann::KDTreeIndexParams>(),
- const Ptr<flann::SearchParams>& searchParams=makePtr<flann::SearchParams>() );
- virtual void add( InputArrayOfArrays descriptors );
- virtual void clear();
-
- virtual void read( const FileNode& );
-
- virtual void write( FileStorage& ) const;
- virtual void train();
- virtual bool isMaskSupported() const;
- virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const;
- protected:
- static void convertToDMatches( const DescriptorCollection& descriptors,
- const Mat& indices, const Mat& distances,
- std::vector<std::vector<DMatch> >& matches );
- virtual void knnMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, int k,
- InputArrayOfArrays masks=noArray(), bool compactResult=false );
- virtual void radiusMatchImpl( InputArray queryDescriptors, std::vector<std::vector<DMatch> >& matches, float maxDistance,
- InputArrayOfArrays masks=noArray(), bool compactResult=false );
- Ptr<flann::IndexParams> indexParams;
- Ptr<flann::SearchParams> searchParams;
- Ptr<flann::Index> flannIndex;
- DescriptorCollection mergedDescriptors;
- int addedDescCount;
- };
- struct CV_EXPORTS DrawMatchesFlags
- {
- enum{ DEFAULT = 0,
-
-
-
-
- DRAW_OVER_OUTIMG = 1,
-
- NOT_DRAW_SINGLE_POINTS = 2,
- DRAW_RICH_KEYPOINTS = 4
-
- };
- };
- CV_EXPORTS_W void drawKeypoints( InputArray image, const std::vector<KeyPoint>& keypoints, InputOutputArray outImage,
- const Scalar& color=Scalar::all(-1), int flags=DrawMatchesFlags::DEFAULT );
- 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>(), int flags=DrawMatchesFlags::DEFAULT );
- CV_EXPORTS_AS(drawMatchesKnn) void drawMatches( InputArray img1, const std::vector<KeyPoint>& keypoints1,
- InputArray img2, const std::vector<KeyPoint>& keypoints2,
- const std::vector<std::vector<DMatch> >& matches1to2, InputOutputArray outImg,
- const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1),
- const std::vector<std::vector<char> >& matchesMask=std::vector<std::vector<char> >(), int flags=DrawMatchesFlags::DEFAULT );
- 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 float getRecall( const std::vector<Point2f>& recallPrecisionCurve, float l_precision );
- CV_EXPORTS int getNearestPoint( const std::vector<Point2f>& recallPrecisionCurve, float l_precision );
- class CV_EXPORTS_W BOWTrainer
- {
- public:
- BOWTrainer();
- virtual ~BOWTrainer();
-
- CV_WRAP void add( const Mat& descriptors );
-
- CV_WRAP const std::vector<Mat>& getDescriptors() const;
-
- CV_WRAP int descriptorsCount() const;
- CV_WRAP virtual void clear();
-
- CV_WRAP virtual Mat cluster() const = 0;
-
- CV_WRAP virtual Mat cluster( const Mat& descriptors ) const = 0;
- protected:
- std::vector<Mat> descriptors;
- int size;
- };
- class CV_EXPORTS_W BOWKMeansTrainer : public BOWTrainer
- {
- public:
-
- CV_WRAP BOWKMeansTrainer( int clusterCount, const TermCriteria& termcrit=TermCriteria(),
- int attempts=3, int flags=KMEANS_PP_CENTERS );
- virtual ~BOWKMeansTrainer();
-
- CV_WRAP virtual Mat cluster() const;
- CV_WRAP virtual Mat cluster( const Mat& descriptors ) const;
- protected:
- int clusterCount;
- TermCriteria termcrit;
- int attempts;
- int flags;
- };
- class CV_EXPORTS_W BOWImgDescriptorExtractor
- {
- public:
-
- CV_WRAP BOWImgDescriptorExtractor( const Ptr<DescriptorExtractor>& dextractor,
- const Ptr<DescriptorMatcher>& dmatcher );
-
- BOWImgDescriptorExtractor( const Ptr<DescriptorMatcher>& dmatcher );
- virtual ~BOWImgDescriptorExtractor();
-
- CV_WRAP void setVocabulary( const Mat& vocabulary );
-
- CV_WRAP const Mat& getVocabulary() const;
-
- void compute( InputArray image, std::vector<KeyPoint>& keypoints, OutputArray imgDescriptor,
- std::vector<std::vector<int> >* pointIdxsOfClusters=0, Mat* descriptors=0 );
-
- void compute( InputArray keypointDescriptors, OutputArray imgDescriptor,
- std::vector<std::vector<int> >* pointIdxsOfClusters=0 );
-
- CV_WRAP_AS(compute) void compute2( const Mat& image, std::vector<KeyPoint>& keypoints, CV_OUT Mat& imgDescriptor )
- { compute(image,keypoints,imgDescriptor); }
-
- CV_WRAP int descriptorSize() const;
-
- CV_WRAP int descriptorType() const;
- protected:
- Mat vocabulary;
- Ptr<DescriptorExtractor> dextractor;
- Ptr<DescriptorMatcher> dmatcher;
- };
- }
- #endif
|