Added info() method in descriptor matchers (#2330)
This commit is contained in:
parent
d8f749da52
commit
7745c8806c
@ -267,7 +267,7 @@ BFMatcher::BFMatcher
|
||||
--------------------
|
||||
Brute-force matcher constructor.
|
||||
|
||||
.. ocv:function:: BFMatcher::BFMatcher( int normType, bool crossCheck=false )
|
||||
.. ocv:function:: BFMatcher::BFMatcher( int normType=NORM_L2, bool crossCheck=false )
|
||||
|
||||
:param normType: One of ``NORM_L1``, ``NORM_L2``, ``NORM_HAMMING``, ``NORM_HAMMING2``. ``L1`` and ``L2`` norms are preferable choices for SIFT and SURF descriptors, ``NORM_HAMMING`` should be used with ORB and BRIEF, ``NORM_HAMMING2`` should be used with ORB when ``WTA_K==3`` or ``4`` (see ORB::ORB constructor description).
|
||||
|
||||
|
@ -1198,13 +1198,14 @@ protected:
|
||||
class CV_EXPORTS_W BFMatcher : public DescriptorMatcher
|
||||
{
|
||||
public:
|
||||
CV_WRAP BFMatcher( int normType, bool crossCheck=false );
|
||||
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;
|
||||
|
||||
AlgorithmInfo* info() const;
|
||||
protected:
|
||||
virtual void knnMatchImpl( const Mat& queryDescriptors, vector<vector<DMatch> >& matches, int k,
|
||||
const vector<Mat>& masks=vector<Mat>(), bool compactResult=false );
|
||||
@ -1238,6 +1239,7 @@ public:
|
||||
|
||||
virtual Ptr<DescriptorMatcher> clone( bool emptyTrainData=false ) const;
|
||||
|
||||
AlgorithmInfo* info() const;
|
||||
protected:
|
||||
static void convertToDMatches( const DescriptorCollection& descriptors,
|
||||
const Mat& indices, const Mat& distances,
|
||||
|
@ -166,6 +166,16 @@ CV_INIT_ALGORITHM(GridAdaptedFeatureDetector, "Feature2D.Grid",
|
||||
obj.info()->addParam(obj, "gridRows", obj.gridRows);
|
||||
obj.info()->addParam(obj, "gridCols", obj.gridCols));
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CV_INIT_ALGORITHM(BFMatcher, "DescriptorMatcher.BFMatcher",
|
||||
obj.info()->addParam(obj, "normType", obj.normType);
|
||||
obj.info()->addParam(obj, "crossCheck", obj.crossCheck));
|
||||
|
||||
CV_INIT_ALGORITHM(FlannBasedMatcher, "DescriptorMatcher.FlannBasedMatcher",);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool cv::initModule_features2d(void)
|
||||
{
|
||||
bool all = true;
|
||||
@ -181,6 +191,8 @@ bool cv::initModule_features2d(void)
|
||||
all &= !HarrisDetector_info_auto.name().empty();
|
||||
all &= !DenseFeatureDetector_info_auto.name().empty();
|
||||
all &= !GridAdaptedFeatureDetector_info_auto.name().empty();
|
||||
all &= !BFMatcher_info_auto.name().empty();
|
||||
all &= !FlannBasedMatcher_info_auto.name().empty();
|
||||
|
||||
return all;
|
||||
}
|
||||
|
@ -532,12 +532,12 @@ void CV_DescriptorMatcherTest::run( int )
|
||||
|
||||
TEST( Features2d_DescriptorMatcher_BruteForce, regression )
|
||||
{
|
||||
CV_DescriptorMatcherTest test( "descriptor-matcher-brute-force", new BFMatcher(NORM_L2), 0.01f );
|
||||
CV_DescriptorMatcherTest test( "descriptor-matcher-brute-force", Algorithm::create<DescriptorMatcher>("DescriptorMatcher.BFMatcher"), 0.01f );
|
||||
test.safe_run();
|
||||
}
|
||||
|
||||
TEST( Features2d_DescriptorMatcher_FlannBased, regression )
|
||||
{
|
||||
CV_DescriptorMatcherTest test( "descriptor-matcher-flann-based", new FlannBasedMatcher, 0.04f );
|
||||
CV_DescriptorMatcherTest test( "descriptor-matcher-flann-based", Algorithm::create<DescriptorMatcher>("DescriptorMatcher.FlannBasedMatcher"), 0.04f );
|
||||
test.safe_run();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user