added initModule_features2d(). Possibly solved problem when the linker excludes seemingly unused detectors/descriptors.
This commit is contained in:
@@ -51,6 +51,8 @@
|
||||
|
||||
namespace cv
|
||||
{
|
||||
|
||||
CV_EXPORTS bool initModule_features2d();
|
||||
|
||||
/*!
|
||||
The Keypoint Class
|
||||
|
@@ -172,20 +172,4 @@ void BriefDescriptorExtractor::computeImpl(const Mat& image, std::vector<KeyPoin
|
||||
test_fn_(sum, keypoints, descriptors);
|
||||
}
|
||||
|
||||
static Algorithm* createBRIEF() { return new BriefDescriptorExtractor; }
|
||||
static AlgorithmInfo brief_info("Feature2D.BRIEF", createBRIEF);
|
||||
|
||||
AlgorithmInfo* BriefDescriptorExtractor::info() const
|
||||
{
|
||||
static volatile bool initialized = false;
|
||||
if( !initialized )
|
||||
{
|
||||
BriefDescriptorExtractor brief;
|
||||
brief_info.addParam(brief, "bytes", brief.bytes_);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
return &brief_info;
|
||||
}
|
||||
|
||||
} // namespace cv
|
||||
|
@@ -359,5 +359,131 @@ void PyramidAdaptedFeatureDetector::detectImpl( const Mat& image, vector<KeyPoin
|
||||
if( !mask.empty() )
|
||||
KeyPointsFilter::runByPixelsMask( keypoints, mask );
|
||||
}
|
||||
|
||||
|
||||
/////////////////////// AlgorithmInfo for various detector & descriptors ////////////////////////////
|
||||
|
||||
/* NOTE!!!
|
||||
All the AlgorithmInfo-related stuff should be in the same file as initModule_features2d().
|
||||
Otherwise, linker may throw away some seemingly unused stuff.
|
||||
*/
|
||||
|
||||
static Algorithm* createBRIEF() { return new BriefDescriptorExtractor; }
|
||||
static AlgorithmInfo brief_info("Feature2D.BRIEF", createBRIEF);
|
||||
|
||||
AlgorithmInfo* BriefDescriptorExtractor::info() const
|
||||
{
|
||||
static volatile bool initialized = false;
|
||||
if( !initialized )
|
||||
{
|
||||
BriefDescriptorExtractor brief;
|
||||
brief_info.addParam(brief, "bytes", brief.bytes_);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
return &brief_info;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static Algorithm* createFAST() { return new FastFeatureDetector; }
|
||||
static AlgorithmInfo fast_info("Feature2D.FAST", createFAST);
|
||||
|
||||
AlgorithmInfo* FastFeatureDetector::info() const
|
||||
{
|
||||
static volatile bool initialized = false;
|
||||
if( !initialized )
|
||||
{
|
||||
FastFeatureDetector obj;
|
||||
fast_info.addParam(obj, "threshold", obj.threshold);
|
||||
fast_info.addParam(obj, "nonmaxSuppression", obj.nonmaxSuppression);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
return &fast_info;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static Algorithm* createStarDetector() { return new StarDetector; }
|
||||
static AlgorithmInfo star_info("Feature2D.STAR", createStarDetector);
|
||||
|
||||
AlgorithmInfo* StarDetector::info() const
|
||||
{
|
||||
static volatile bool initialized = false;
|
||||
if( !initialized )
|
||||
{
|
||||
StarDetector obj;
|
||||
star_info.addParam(obj, "maxSize", obj.maxSize);
|
||||
star_info.addParam(obj, "responseThreshold", obj.responseThreshold);
|
||||
star_info.addParam(obj, "lineThresholdProjected", obj.lineThresholdProjected);
|
||||
star_info.addParam(obj, "lineThresholdBinarized", obj.lineThresholdBinarized);
|
||||
star_info.addParam(obj, "suppressNonmaxSize", obj.suppressNonmaxSize);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
return &star_info;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static Algorithm* createMSER() { return new MSER; }
|
||||
static AlgorithmInfo mser_info("Feature2D.MSER", createMSER);
|
||||
|
||||
AlgorithmInfo* MSER::info() const
|
||||
{
|
||||
static volatile bool initialized = false;
|
||||
if( !initialized )
|
||||
{
|
||||
MSER obj;
|
||||
mser_info.addParam(obj, "delta", obj.delta);
|
||||
mser_info.addParam(obj, "minArea", obj.minArea);
|
||||
mser_info.addParam(obj, "maxArea", obj.maxArea);
|
||||
mser_info.addParam(obj, "maxVariation", obj.maxVariation);
|
||||
mser_info.addParam(obj, "minDiversity", obj.minDiversity);
|
||||
mser_info.addParam(obj, "maxEvolution", obj.maxEvolution);
|
||||
mser_info.addParam(obj, "areaThreshold", obj.areaThreshold);
|
||||
mser_info.addParam(obj, "minMargin", obj.minMargin);
|
||||
mser_info.addParam(obj, "edgeBlurSize", obj.edgeBlurSize);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
return &mser_info;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static Algorithm* createORB() { return new ORB; }
|
||||
static AlgorithmInfo orb_info("Feature2D.ORB", createORB);
|
||||
|
||||
AlgorithmInfo* ORB::info() const
|
||||
{
|
||||
static volatile bool initialized = false;
|
||||
if( !initialized )
|
||||
{
|
||||
ORB obj;
|
||||
orb_info.addParam(obj, "nFeatures", obj.nfeatures);
|
||||
orb_info.addParam(obj, "scaleFactor", obj.scaleFactor);
|
||||
orb_info.addParam(obj, "nLevels", obj.nlevels);
|
||||
orb_info.addParam(obj, "firstLevel", obj.firstLevel);
|
||||
orb_info.addParam(obj, "edgeThreshold", obj.edgeThreshold);
|
||||
orb_info.addParam(obj, "patchSize", obj.patchSize);
|
||||
orb_info.addParam(obj, "WTA_K", obj.WTA_K);
|
||||
orb_info.addParam(obj, "scoreType", obj.scoreType);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
return &orb_info;
|
||||
}
|
||||
|
||||
bool initModule_features2d(void)
|
||||
{
|
||||
Ptr<Algorithm> brief = createBRIEF(), orb = createORB(),
|
||||
star = createStarDetector(), fastd = createFAST(), mser = createMSER();
|
||||
return brief->info() != 0 && orb->info() != 0 && star->info() != 0 &&
|
||||
fastd->info() != 0 && mser->info() != 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -391,22 +391,4 @@ void FastFeatureDetector::detectImpl( const Mat& image, vector<KeyPoint>& keypoi
|
||||
KeyPointsFilter::runByPixelsMask( keypoints, mask );
|
||||
}
|
||||
|
||||
|
||||
static Algorithm* createFAST() { return new FastFeatureDetector; }
|
||||
static AlgorithmInfo fast_info("Feature2D.FAST", createFAST);
|
||||
|
||||
AlgorithmInfo* FastFeatureDetector::info() const
|
||||
{
|
||||
static volatile bool initialized = false;
|
||||
if( !initialized )
|
||||
{
|
||||
FastFeatureDetector obj;
|
||||
fast_info.addParam(obj, "threshold", obj.threshold);
|
||||
fast_info.addParam(obj, "nonmaxSuppression", obj.nonmaxSuppression);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
return &fast_info;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1299,28 +1299,4 @@ void MserFeatureDetector::detectImpl( const Mat& image, vector<KeyPoint>& keypoi
|
||||
}
|
||||
}
|
||||
|
||||
static Algorithm* createMSER() { return new MSER; }
|
||||
static AlgorithmInfo mser_info("Feature2D.MSER", createMSER);
|
||||
|
||||
AlgorithmInfo* MSER::info() const
|
||||
{
|
||||
static volatile bool initialized = false;
|
||||
if( !initialized )
|
||||
{
|
||||
MSER obj;
|
||||
mser_info.addParam(obj, "delta", obj.delta);
|
||||
mser_info.addParam(obj, "minArea", obj.minArea);
|
||||
mser_info.addParam(obj, "maxArea", obj.maxArea);
|
||||
mser_info.addParam(obj, "maxVariation", obj.maxVariation);
|
||||
mser_info.addParam(obj, "minDiversity", obj.minDiversity);
|
||||
mser_info.addParam(obj, "maxEvolution", obj.maxEvolution);
|
||||
mser_info.addParam(obj, "areaThreshold", obj.areaThreshold);
|
||||
mser_info.addParam(obj, "minMargin", obj.minMargin);
|
||||
mser_info.addParam(obj, "edgeBlurSize", obj.edgeBlurSize);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
return &mser_info;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -546,31 +546,6 @@ static void makeRandomPattern(int patchSize, Point* pattern, int npoints)
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static Algorithm* createORB() { return new ORB; }
|
||||
static AlgorithmInfo orb_info("Feature2D.ORB", createORB);
|
||||
|
||||
AlgorithmInfo* ORB::info() const
|
||||
{
|
||||
static volatile bool initialized = false;
|
||||
if( !initialized )
|
||||
{
|
||||
ORB obj;
|
||||
orb_info.addParam(obj, "nFeatures", obj.nfeatures);
|
||||
orb_info.addParam(obj, "scaleFactor", obj.scaleFactor);
|
||||
orb_info.addParam(obj, "nLevels", obj.nlevels);
|
||||
orb_info.addParam(obj, "firstLevel", obj.firstLevel);
|
||||
orb_info.addParam(obj, "edgeThreshold", obj.edgeThreshold);
|
||||
orb_info.addParam(obj, "patchSize", obj.patchSize);
|
||||
orb_info.addParam(obj, "WTA_K", obj.WTA_K);
|
||||
orb_info.addParam(obj, "scoreType", obj.scoreType);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
return &orb_info;
|
||||
}
|
||||
|
||||
static inline float getScale(int level, int firstLevel, double scaleFactor)
|
||||
{
|
||||
return (float)std::pow(scaleFactor, (double)(level - firstLevel));
|
||||
|
@@ -447,25 +447,4 @@ void StarDetector::operator()(const Mat& img, vector<KeyPoint>& keypoints) const
|
||||
lineThresholdBinarized, suppressNonmaxSize );
|
||||
}
|
||||
|
||||
|
||||
static Algorithm* createStarDetector() { return new StarDetector; }
|
||||
static AlgorithmInfo star_info("Feature2D.STAR", createStarDetector);
|
||||
|
||||
AlgorithmInfo* StarDetector::info() const
|
||||
{
|
||||
static volatile bool initialized = false;
|
||||
if( !initialized )
|
||||
{
|
||||
StarDetector obj;
|
||||
star_info.addParam(obj, "maxSize", obj.maxSize);
|
||||
star_info.addParam(obj, "responseThreshold", obj.responseThreshold);
|
||||
star_info.addParam(obj, "lineThresholdProjected", obj.lineThresholdProjected);
|
||||
star_info.addParam(obj, "lineThresholdBinarized", obj.lineThresholdBinarized);
|
||||
star_info.addParam(obj, "suppressNonmaxSize", obj.suppressNonmaxSize);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
return &star_info;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user