2012-10-17 15:12:04 +08:00
|
|
|
#ifndef __OPENCV_FEATURES_2D_MANUAL_HPP__
|
|
|
|
#define __OPENCV_FEATURES_2D_MANUAL_HPP__
|
|
|
|
|
|
|
|
#include "opencv2/opencv_modules.hpp"
|
|
|
|
|
|
|
|
#ifdef HAVE_OPENCV_FEATURES2D
|
2013-03-13 20:22:44 +08:00
|
|
|
#include "opencv2/features2d.hpp"
|
2015-02-19 21:17:19 +08:00
|
|
|
#include "features2d_converters.hpp"
|
2012-10-17 15:12:04 +08:00
|
|
|
|
|
|
|
#undef SIMPLEBLOB // to solve conflict with wincrypt.h on windows
|
|
|
|
|
|
|
|
namespace cv
|
|
|
|
{
|
|
|
|
|
2013-08-13 23:12:25 +08:00
|
|
|
class CV_EXPORTS_AS(FeatureDetector) javaFeatureDetector
|
2012-10-17 15:12:04 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-08-13 23:12:25 +08:00
|
|
|
CV_WRAP void detect( const Mat& image, CV_OUT std::vector<KeyPoint>& keypoints, const Mat& mask=Mat() ) const
|
|
|
|
{ return wrapped->detect(image, keypoints, mask); }
|
|
|
|
|
|
|
|
CV_WRAP void detect( const std::vector<Mat>& images, CV_OUT std::vector<std::vector<KeyPoint> >& keypoints, const std::vector<Mat>& masks=std::vector<Mat>() ) const
|
|
|
|
{ return wrapped->detect(images, keypoints, masks); }
|
|
|
|
|
|
|
|
CV_WRAP bool empty() const
|
|
|
|
{ return wrapped->empty(); }
|
2012-10-17 15:12:04 +08:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
FAST = 1,
|
|
|
|
STAR = 2,
|
|
|
|
SIFT = 3,
|
|
|
|
SURF = 4,
|
|
|
|
ORB = 5,
|
|
|
|
MSER = 6,
|
|
|
|
GFTT = 7,
|
|
|
|
HARRIS = 8,
|
|
|
|
SIMPLEBLOB = 9,
|
|
|
|
DENSE = 10,
|
|
|
|
BRISK = 11,
|
2014-05-30 15:46:47 +08:00
|
|
|
AKAZE = 12,
|
2012-10-17 15:12:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
GRIDDETECTOR = 1000,
|
|
|
|
|
|
|
|
GRID_FAST = GRIDDETECTOR + FAST,
|
|
|
|
GRID_STAR = GRIDDETECTOR + STAR,
|
|
|
|
GRID_SIFT = GRIDDETECTOR + SIFT,
|
|
|
|
GRID_SURF = GRIDDETECTOR + SURF,
|
|
|
|
GRID_ORB = GRIDDETECTOR + ORB,
|
|
|
|
GRID_MSER = GRIDDETECTOR + MSER,
|
|
|
|
GRID_GFTT = GRIDDETECTOR + GFTT,
|
|
|
|
GRID_HARRIS = GRIDDETECTOR + HARRIS,
|
|
|
|
GRID_SIMPLEBLOB = GRIDDETECTOR + SIMPLEBLOB,
|
|
|
|
GRID_DENSE = GRIDDETECTOR + DENSE,
|
|
|
|
GRID_BRISK = GRIDDETECTOR + BRISK,
|
2014-05-30 15:46:47 +08:00
|
|
|
GRID_AKAZE = GRIDDETECTOR + AKAZE,
|
2012-10-17 15:12:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
PYRAMIDDETECTOR = 2000,
|
|
|
|
|
|
|
|
PYRAMID_FAST = PYRAMIDDETECTOR + FAST,
|
|
|
|
PYRAMID_STAR = PYRAMIDDETECTOR + STAR,
|
|
|
|
PYRAMID_SIFT = PYRAMIDDETECTOR + SIFT,
|
|
|
|
PYRAMID_SURF = PYRAMIDDETECTOR + SURF,
|
|
|
|
PYRAMID_ORB = PYRAMIDDETECTOR + ORB,
|
|
|
|
PYRAMID_MSER = PYRAMIDDETECTOR + MSER,
|
|
|
|
PYRAMID_GFTT = PYRAMIDDETECTOR + GFTT,
|
|
|
|
PYRAMID_HARRIS = PYRAMIDDETECTOR + HARRIS,
|
|
|
|
PYRAMID_SIMPLEBLOB = PYRAMIDDETECTOR + SIMPLEBLOB,
|
|
|
|
PYRAMID_DENSE = PYRAMIDDETECTOR + DENSE,
|
|
|
|
PYRAMID_BRISK = PYRAMIDDETECTOR + BRISK,
|
2014-05-30 15:46:47 +08:00
|
|
|
PYRAMID_AKAZE = PYRAMIDDETECTOR + AKAZE,
|
2012-10-17 15:12:04 +08:00
|
|
|
|
|
|
|
DYNAMICDETECTOR = 3000,
|
|
|
|
|
|
|
|
DYNAMIC_FAST = DYNAMICDETECTOR + FAST,
|
|
|
|
DYNAMIC_STAR = DYNAMICDETECTOR + STAR,
|
|
|
|
DYNAMIC_SIFT = DYNAMICDETECTOR + SIFT,
|
|
|
|
DYNAMIC_SURF = DYNAMICDETECTOR + SURF,
|
|
|
|
DYNAMIC_ORB = DYNAMICDETECTOR + ORB,
|
|
|
|
DYNAMIC_MSER = DYNAMICDETECTOR + MSER,
|
|
|
|
DYNAMIC_GFTT = DYNAMICDETECTOR + GFTT,
|
|
|
|
DYNAMIC_HARRIS = DYNAMICDETECTOR + HARRIS,
|
|
|
|
DYNAMIC_SIMPLEBLOB = DYNAMICDETECTOR + SIMPLEBLOB,
|
|
|
|
DYNAMIC_DENSE = DYNAMICDETECTOR + DENSE,
|
2014-05-30 15:46:47 +08:00
|
|
|
DYNAMIC_BRISK = DYNAMICDETECTOR + BRISK,
|
|
|
|
DYNAMIC_AKAZE = DYNAMICDETECTOR + AKAZE
|
2012-10-17 15:12:04 +08:00
|
|
|
};
|
|
|
|
|
2014-05-30 15:46:47 +08:00
|
|
|
//supported: FAST STAR SIFT SURF ORB MSER GFTT HARRIS BRISK AKAZE Grid(XXXX) Pyramid(XXXX) Dynamic(XXXX)
|
2012-10-17 15:12:04 +08:00
|
|
|
//not supported: SimpleBlob, Dense
|
|
|
|
CV_WRAP static javaFeatureDetector* create( int detectorType )
|
|
|
|
{
|
2014-10-17 02:52:04 +08:00
|
|
|
//String name;
|
2012-10-17 15:12:04 +08:00
|
|
|
if (detectorType > DYNAMICDETECTOR)
|
|
|
|
{
|
2014-10-17 02:52:04 +08:00
|
|
|
//name = "Dynamic";
|
2012-10-17 15:12:04 +08:00
|
|
|
detectorType -= DYNAMICDETECTOR;
|
|
|
|
}
|
|
|
|
if (detectorType > PYRAMIDDETECTOR)
|
|
|
|
{
|
2014-10-17 02:52:04 +08:00
|
|
|
//name = "Pyramid";
|
2012-10-17 15:12:04 +08:00
|
|
|
detectorType -= PYRAMIDDETECTOR;
|
|
|
|
}
|
|
|
|
if (detectorType > GRIDDETECTOR)
|
|
|
|
{
|
2014-10-17 02:52:04 +08:00
|
|
|
//name = "Grid";
|
2012-10-17 15:12:04 +08:00
|
|
|
detectorType -= GRIDDETECTOR;
|
|
|
|
}
|
|
|
|
|
2014-10-17 02:52:04 +08:00
|
|
|
Ptr<FeatureDetector> fd;
|
2012-10-17 15:12:04 +08:00
|
|
|
switch(detectorType)
|
|
|
|
{
|
|
|
|
case FAST:
|
2014-10-17 02:52:04 +08:00
|
|
|
fd = FastFeatureDetector::create();
|
2012-10-17 15:12:04 +08:00
|
|
|
break;
|
2014-10-17 02:52:04 +08:00
|
|
|
//case STAR:
|
|
|
|
// fd = xfeatures2d::StarDetector::create();
|
|
|
|
// break;
|
|
|
|
//case SIFT:
|
|
|
|
// name = name + "SIFT";
|
|
|
|
// break;
|
|
|
|
//case SURF:
|
|
|
|
// name = name + "SURF";
|
|
|
|
// break;
|
2012-10-17 15:12:04 +08:00
|
|
|
case ORB:
|
2014-10-17 02:52:04 +08:00
|
|
|
fd = ORB::create();
|
2012-10-17 15:12:04 +08:00
|
|
|
break;
|
|
|
|
case MSER:
|
2014-10-17 02:52:04 +08:00
|
|
|
fd = MSER::create();
|
2012-10-17 15:12:04 +08:00
|
|
|
break;
|
|
|
|
case GFTT:
|
2014-10-17 02:52:04 +08:00
|
|
|
fd = GFTTDetector::create();
|
2012-10-17 15:12:04 +08:00
|
|
|
break;
|
|
|
|
case HARRIS:
|
2014-10-19 00:44:26 +08:00
|
|
|
{
|
|
|
|
Ptr<GFTTDetector> gftt = GFTTDetector::create();
|
|
|
|
gftt->setHarrisDetector(true);
|
|
|
|
fd = gftt;
|
|
|
|
}
|
2012-10-17 15:12:04 +08:00
|
|
|
break;
|
|
|
|
case SIMPLEBLOB:
|
2014-10-17 02:52:04 +08:00
|
|
|
fd = SimpleBlobDetector::create();
|
2012-10-17 15:12:04 +08:00
|
|
|
break;
|
2014-10-17 02:52:04 +08:00
|
|
|
//case DENSE:
|
|
|
|
// name = name + "Dense";
|
|
|
|
// break;
|
2012-10-17 15:12:04 +08:00
|
|
|
case BRISK:
|
2014-10-17 02:52:04 +08:00
|
|
|
fd = BRISK::create();
|
2012-10-17 15:12:04 +08:00
|
|
|
break;
|
2014-05-30 15:46:47 +08:00
|
|
|
case AKAZE:
|
2014-10-17 02:52:04 +08:00
|
|
|
fd = AKAZE::create();
|
2014-05-30 15:46:47 +08:00
|
|
|
break;
|
2012-10-17 15:12:04 +08:00
|
|
|
default:
|
2013-03-29 16:59:55 +08:00
|
|
|
CV_Error( Error::StsBadArg, "Specified feature detector type is not supported." );
|
2012-10-17 15:12:04 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-10-17 02:52:04 +08:00
|
|
|
return new javaFeatureDetector(fd);
|
2012-10-17 15:12:04 +08:00
|
|
|
}
|
|
|
|
|
2013-03-23 00:37:49 +08:00
|
|
|
CV_WRAP void write( const String& fileName ) const
|
2012-10-17 15:12:04 +08:00
|
|
|
{
|
|
|
|
FileStorage fs(fileName, FileStorage::WRITE);
|
2013-08-13 23:12:25 +08:00
|
|
|
wrapped->write(fs);
|
2012-10-17 15:12:04 +08:00
|
|
|
}
|
|
|
|
|
2013-03-23 00:37:49 +08:00
|
|
|
CV_WRAP void read( const String& fileName )
|
2012-10-17 15:12:04 +08:00
|
|
|
{
|
|
|
|
FileStorage fs(fileName, FileStorage::READ);
|
2013-08-13 23:12:25 +08:00
|
|
|
wrapped->read(fs.root());
|
2012-10-17 15:12:04 +08:00
|
|
|
}
|
2013-08-13 23:12:25 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
javaFeatureDetector(Ptr<FeatureDetector> _wrapped) : wrapped(_wrapped)
|
|
|
|
{}
|
|
|
|
|
|
|
|
Ptr<FeatureDetector> wrapped;
|
2012-10-17 15:12:04 +08:00
|
|
|
};
|
|
|
|
|
2013-08-13 23:12:25 +08:00
|
|
|
class CV_EXPORTS_AS(DescriptorMatcher) javaDescriptorMatcher
|
2012-10-17 15:12:04 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-08-13 23:12:25 +08:00
|
|
|
CV_WRAP bool isMaskSupported() const
|
|
|
|
{ return wrapped->isMaskSupported(); }
|
|
|
|
|
|
|
|
CV_WRAP void add( const std::vector<Mat>& descriptors )
|
|
|
|
{ return wrapped->add(descriptors); }
|
|
|
|
|
|
|
|
CV_WRAP const std::vector<Mat>& getTrainDescriptors() const
|
|
|
|
{ return wrapped->getTrainDescriptors(); }
|
|
|
|
|
|
|
|
CV_WRAP void clear()
|
|
|
|
{ return wrapped->clear(); }
|
|
|
|
|
|
|
|
CV_WRAP bool empty() const
|
|
|
|
{ return wrapped->empty(); }
|
|
|
|
|
|
|
|
CV_WRAP void train()
|
|
|
|
{ return wrapped->train(); }
|
|
|
|
|
2012-10-17 15:12:04 +08:00
|
|
|
CV_WRAP void match( const Mat& queryDescriptors, const Mat& trainDescriptors,
|
2013-08-13 23:12:25 +08:00
|
|
|
CV_OUT std::vector<DMatch>& matches, const Mat& mask=Mat() ) const
|
|
|
|
{ return wrapped->match(queryDescriptors, trainDescriptors, matches, mask); }
|
|
|
|
|
2012-10-17 15:12:04 +08:00
|
|
|
CV_WRAP void knnMatch( const Mat& queryDescriptors, const Mat& trainDescriptors,
|
2013-02-25 00:14:01 +08:00
|
|
|
CV_OUT std::vector<std::vector<DMatch> >& matches, int k,
|
2013-08-13 23:12:25 +08:00
|
|
|
const Mat& mask=Mat(), bool compactResult=false ) const
|
|
|
|
{ return wrapped->knnMatch(queryDescriptors, trainDescriptors, matches, k, mask, compactResult); }
|
|
|
|
|
2012-10-17 15:12:04 +08:00
|
|
|
CV_WRAP void radiusMatch( const Mat& queryDescriptors, const Mat& trainDescriptors,
|
2013-02-25 00:14:01 +08:00
|
|
|
CV_OUT std::vector<std::vector<DMatch> >& matches, float maxDistance,
|
2013-08-13 23:12:25 +08:00
|
|
|
const Mat& mask=Mat(), bool compactResult=false ) const
|
|
|
|
{ return wrapped->radiusMatch(queryDescriptors, trainDescriptors, matches, maxDistance, mask, compactResult); }
|
|
|
|
|
2013-02-25 00:14:01 +08:00
|
|
|
CV_WRAP void match( const Mat& queryDescriptors, CV_OUT std::vector<DMatch>& matches,
|
2013-08-13 23:12:25 +08:00
|
|
|
const std::vector<Mat>& masks=std::vector<Mat>() )
|
|
|
|
{ return wrapped->match(queryDescriptors, matches, masks); }
|
|
|
|
|
2013-02-25 00:14:01 +08:00
|
|
|
CV_WRAP void knnMatch( const Mat& queryDescriptors, CV_OUT std::vector<std::vector<DMatch> >& matches, int k,
|
2013-08-13 23:12:25 +08:00
|
|
|
const std::vector<Mat>& masks=std::vector<Mat>(), bool compactResult=false )
|
|
|
|
{ return wrapped->knnMatch(queryDescriptors, matches, k, masks, compactResult); }
|
|
|
|
|
2013-02-25 00:14:01 +08:00
|
|
|
CV_WRAP void radiusMatch( const Mat& queryDescriptors, CV_OUT std::vector<std::vector<DMatch> >& matches, float maxDistance,
|
2013-08-13 23:12:25 +08:00
|
|
|
const std::vector<Mat>& masks=std::vector<Mat>(), bool compactResult=false )
|
|
|
|
{ return wrapped->radiusMatch(queryDescriptors, matches, maxDistance, masks, compactResult); }
|
2012-10-17 15:12:04 +08:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
FLANNBASED = 1,
|
|
|
|
BRUTEFORCE = 2,
|
|
|
|
BRUTEFORCE_L1 = 3,
|
|
|
|
BRUTEFORCE_HAMMING = 4,
|
|
|
|
BRUTEFORCE_HAMMINGLUT = 5,
|
|
|
|
BRUTEFORCE_SL2 = 6
|
|
|
|
};
|
|
|
|
|
|
|
|
CV_WRAP_AS(clone) javaDescriptorMatcher* jclone( bool emptyTrainData=false ) const
|
|
|
|
{
|
2013-08-13 23:12:25 +08:00
|
|
|
return new javaDescriptorMatcher(wrapped->clone(emptyTrainData));
|
2012-10-17 15:12:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//supported: FlannBased, BruteForce, BruteForce-L1, BruteForce-Hamming, BruteForce-HammingLUT
|
|
|
|
CV_WRAP static javaDescriptorMatcher* create( int matcherType )
|
|
|
|
{
|
2013-03-23 00:37:49 +08:00
|
|
|
String name;
|
2012-10-17 15:12:04 +08:00
|
|
|
|
|
|
|
switch(matcherType)
|
|
|
|
{
|
|
|
|
case FLANNBASED:
|
|
|
|
name = "FlannBased";
|
|
|
|
break;
|
|
|
|
case BRUTEFORCE:
|
|
|
|
name = "BruteForce";
|
|
|
|
break;
|
|
|
|
case BRUTEFORCE_L1:
|
|
|
|
name = "BruteForce-L1";
|
|
|
|
break;
|
|
|
|
case BRUTEFORCE_HAMMING:
|
|
|
|
name = "BruteForce-Hamming";
|
|
|
|
break;
|
|
|
|
case BRUTEFORCE_HAMMINGLUT:
|
|
|
|
name = "BruteForce-HammingLUT";
|
|
|
|
break;
|
|
|
|
case BRUTEFORCE_SL2:
|
|
|
|
name = "BruteForce-SL2";
|
|
|
|
break;
|
|
|
|
default:
|
2013-03-29 16:59:55 +08:00
|
|
|
CV_Error( Error::StsBadArg, "Specified descriptor matcher type is not supported." );
|
2012-10-17 15:12:04 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-08-13 23:12:25 +08:00
|
|
|
return new javaDescriptorMatcher(DescriptorMatcher::create(name));
|
2012-10-17 15:12:04 +08:00
|
|
|
}
|
|
|
|
|
2013-03-23 00:37:49 +08:00
|
|
|
CV_WRAP void write( const String& fileName ) const
|
2012-10-17 15:12:04 +08:00
|
|
|
{
|
|
|
|
FileStorage fs(fileName, FileStorage::WRITE);
|
2013-08-13 23:12:25 +08:00
|
|
|
wrapped->write(fs);
|
2012-10-17 15:12:04 +08:00
|
|
|
}
|
|
|
|
|
2013-03-23 00:37:49 +08:00
|
|
|
CV_WRAP void read( const String& fileName )
|
2012-10-17 15:12:04 +08:00
|
|
|
{
|
|
|
|
FileStorage fs(fileName, FileStorage::READ);
|
2013-08-13 23:12:25 +08:00
|
|
|
wrapped->read(fs.root());
|
2012-10-17 15:12:04 +08:00
|
|
|
}
|
2013-08-13 23:12:25 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
javaDescriptorMatcher(Ptr<DescriptorMatcher> _wrapped) : wrapped(_wrapped)
|
|
|
|
{}
|
|
|
|
|
|
|
|
Ptr<DescriptorMatcher> wrapped;
|
2012-10-17 15:12:04 +08:00
|
|
|
};
|
|
|
|
|
2013-08-13 23:12:25 +08:00
|
|
|
class CV_EXPORTS_AS(DescriptorExtractor) javaDescriptorExtractor
|
2012-10-17 15:12:04 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-08-13 23:12:25 +08:00
|
|
|
CV_WRAP void compute( const Mat& image, CV_IN_OUT std::vector<KeyPoint>& keypoints, Mat& descriptors ) const
|
|
|
|
{ return wrapped->compute(image, keypoints, descriptors); }
|
|
|
|
|
|
|
|
CV_WRAP void compute( const std::vector<Mat>& images, CV_IN_OUT std::vector<std::vector<KeyPoint> >& keypoints, CV_OUT std::vector<Mat>& descriptors ) const
|
|
|
|
{ return wrapped->compute(images, keypoints, descriptors); }
|
|
|
|
|
|
|
|
CV_WRAP int descriptorSize() const
|
|
|
|
{ return wrapped->descriptorSize(); }
|
2012-10-17 15:12:04 +08:00
|
|
|
|
2013-08-13 23:12:25 +08:00
|
|
|
CV_WRAP int descriptorType() const
|
|
|
|
{ return wrapped->descriptorType(); }
|
|
|
|
|
|
|
|
CV_WRAP bool empty() const
|
|
|
|
{ return wrapped->empty(); }
|
2012-10-17 15:12:04 +08:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
SIFT = 1,
|
|
|
|
SURF = 2,
|
|
|
|
ORB = 3,
|
|
|
|
BRIEF = 4,
|
|
|
|
BRISK = 5,
|
|
|
|
FREAK = 6,
|
2014-05-30 15:46:47 +08:00
|
|
|
AKAZE = 7,
|
2012-10-17 15:12:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
OPPONENTEXTRACTOR = 1000,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OPPONENT_SIFT = OPPONENTEXTRACTOR + SIFT,
|
|
|
|
OPPONENT_SURF = OPPONENTEXTRACTOR + SURF,
|
|
|
|
OPPONENT_ORB = OPPONENTEXTRACTOR + ORB,
|
|
|
|
OPPONENT_BRIEF = OPPONENTEXTRACTOR + BRIEF,
|
|
|
|
OPPONENT_BRISK = OPPONENTEXTRACTOR + BRISK,
|
2014-05-30 15:46:47 +08:00
|
|
|
OPPONENT_FREAK = OPPONENTEXTRACTOR + FREAK,
|
|
|
|
OPPONENT_AKAZE = OPPONENTEXTRACTOR + AKAZE
|
2012-10-17 15:12:04 +08:00
|
|
|
};
|
|
|
|
|
2014-05-30 15:46:47 +08:00
|
|
|
//supported SIFT, SURF, ORB, BRIEF, BRISK, FREAK, AKAZE, Opponent(XXXX)
|
2012-10-17 15:12:04 +08:00
|
|
|
//not supported: Calonder
|
|
|
|
CV_WRAP static javaDescriptorExtractor* create( int extractorType )
|
|
|
|
{
|
2014-10-17 02:52:04 +08:00
|
|
|
//String name;
|
2012-10-17 15:12:04 +08:00
|
|
|
|
|
|
|
if (extractorType > OPPONENTEXTRACTOR)
|
|
|
|
{
|
2014-10-17 02:52:04 +08:00
|
|
|
//name = "Opponent";
|
2012-10-17 15:12:04 +08:00
|
|
|
extractorType -= OPPONENTEXTRACTOR;
|
|
|
|
}
|
|
|
|
|
2014-10-17 02:52:04 +08:00
|
|
|
Ptr<DescriptorExtractor> de;
|
2012-10-17 15:12:04 +08:00
|
|
|
switch(extractorType)
|
|
|
|
{
|
2014-10-17 02:52:04 +08:00
|
|
|
//case SIFT:
|
|
|
|
// name = name + "SIFT";
|
|
|
|
// break;
|
|
|
|
//case SURF:
|
|
|
|
// name = name + "SURF";
|
|
|
|
// break;
|
2012-10-17 15:12:04 +08:00
|
|
|
case ORB:
|
2014-10-17 02:52:04 +08:00
|
|
|
de = ORB::create();
|
2012-10-17 15:12:04 +08:00
|
|
|
break;
|
2014-10-17 02:52:04 +08:00
|
|
|
//case BRIEF:
|
|
|
|
// name = name + "BRIEF";
|
|
|
|
// break;
|
2012-10-17 15:12:04 +08:00
|
|
|
case BRISK:
|
2014-10-17 02:52:04 +08:00
|
|
|
de = BRISK::create();
|
2012-10-17 15:12:04 +08:00
|
|
|
break;
|
2014-10-17 02:52:04 +08:00
|
|
|
//case FREAK:
|
|
|
|
// name = name + "FREAK";
|
|
|
|
// break;
|
2014-05-30 15:46:47 +08:00
|
|
|
case AKAZE:
|
2014-10-17 02:52:04 +08:00
|
|
|
de = AKAZE::create();
|
2014-05-30 15:46:47 +08:00
|
|
|
break;
|
2012-10-17 15:12:04 +08:00
|
|
|
default:
|
2013-03-29 16:59:55 +08:00
|
|
|
CV_Error( Error::StsBadArg, "Specified descriptor extractor type is not supported." );
|
2012-10-17 15:12:04 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-10-17 02:52:04 +08:00
|
|
|
return new javaDescriptorExtractor(de);
|
2012-10-17 15:12:04 +08:00
|
|
|
}
|
|
|
|
|
2013-03-23 00:37:49 +08:00
|
|
|
CV_WRAP void write( const String& fileName ) const
|
2012-10-17 15:12:04 +08:00
|
|
|
{
|
|
|
|
FileStorage fs(fileName, FileStorage::WRITE);
|
2013-08-13 23:12:25 +08:00
|
|
|
wrapped->write(fs);
|
2012-10-17 15:12:04 +08:00
|
|
|
}
|
|
|
|
|
2013-03-23 00:37:49 +08:00
|
|
|
CV_WRAP void read( const String& fileName )
|
2012-10-17 15:12:04 +08:00
|
|
|
{
|
|
|
|
FileStorage fs(fileName, FileStorage::READ);
|
2013-08-13 23:12:25 +08:00
|
|
|
wrapped->read(fs.root());
|
2012-10-17 15:12:04 +08:00
|
|
|
}
|
2013-08-13 23:12:25 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
javaDescriptorExtractor(Ptr<DescriptorExtractor> _wrapped) : wrapped(_wrapped)
|
|
|
|
{}
|
|
|
|
|
|
|
|
Ptr<DescriptorExtractor> wrapped;
|
2012-10-17 15:12:04 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
//DO NOT REMOVE! The block is required for sources parser
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
DRAW_OVER_OUTIMG = 1, // Output image matrix will not be created (Mat::create).
|
|
|
|
// Matches will be drawn on existing content of output image.
|
|
|
|
NOT_DRAW_SINGLE_POINTS = 2, // Single keypoints will not be drawn.
|
|
|
|
DRAW_RICH_KEYPOINTS = 4 // For each keypoint the circle around keypoint with keypoint size and
|
|
|
|
// orientation will be drawn.
|
|
|
|
};
|
|
|
|
|
|
|
|
// Draw keypoints.
|
2013-02-25 00:14:01 +08:00
|
|
|
CV_EXPORTS_W void drawKeypoints( const Mat& image, const std::vector<KeyPoint>& keypoints, Mat& outImage,
|
2012-10-17 15:12:04 +08:00
|
|
|
const Scalar& color=Scalar::all(-1), int flags=0 );
|
|
|
|
|
|
|
|
// Draws matches of keypints from two images on output image.
|
2013-02-25 00:14:01 +08:00
|
|
|
CV_EXPORTS_W void drawMatches( const Mat& img1, const std::vector<KeyPoint>& keypoints1,
|
|
|
|
const Mat& img2, const std::vector<KeyPoint>& keypoints2,
|
|
|
|
const std::vector<DMatch>& matches1to2, Mat& outImg,
|
2012-10-17 15:12:04 +08:00
|
|
|
const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1),
|
2013-02-25 00:14:01 +08:00
|
|
|
const std::vector<char>& matchesMask=std::vector<char>(), int flags=0 );
|
2012-10-17 15:12:04 +08:00
|
|
|
|
2013-02-25 00:14:01 +08:00
|
|
|
CV_EXPORTS_AS(drawMatches2) void drawMatches( const Mat& img1, const std::vector<KeyPoint>& keypoints1,
|
|
|
|
const Mat& img2, const std::vector<KeyPoint>& keypoints2,
|
|
|
|
const std::vector<std::vector<DMatch> >& matches1to2, Mat& outImg,
|
2012-10-17 15:12:04 +08:00
|
|
|
const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1),
|
2013-02-25 00:14:01 +08:00
|
|
|
const std::vector<std::vector<char> >& matchesMask=std::vector<std::vector<char> >(), int flags=0);
|
2012-10-17 15:12:04 +08:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
} //cv
|
|
|
|
|
|
|
|
#endif // HAVE_OPENCV_FEATURES2D
|
|
|
|
|
|
|
|
#endif // __OPENCV_FEATURES_2D_MANUAL_HPP__
|