class cv::detail::BestOf2NearestMatcher

Overview

Features matcher which finds two best matches for each feature and leaves the best one only if the ratio between descriptor distances is greater than the threshold match_conf. More…

#include <matchers.hpp>

class BestOf2NearestMatcher: public cv::detail::FeaturesMatcher
{
public:
    // construction

    BestOf2NearestMatcher(
        bool try_use_gpu = false,
        float match_conf = 0.3f,
        int num_matches_thresh1 = 6,
        int num_matches_thresh2 = 6
        );

    // methods

    virtual
    void
    collectGarbage();

protected:
    // fields

    Ptr<FeaturesMatcher> impl_;
    int num_matches_thresh1_;
    int num_matches_thresh2_;

    // methods

    virtual
    void
    match(
        const ImageFeatures& features1,
        const ImageFeatures& features2,
        MatchesInfo& matches_info
        );
};

// direct descendants

class AffineBestOf2NearestMatcher;
class BestOf2NearestRangeMatcher;

Inherited Members

public:
    // methods

    virtual
    void
    collectGarbage();

    bool
    isThreadSafe() const;

    void
    operator()(
        const ImageFeatures& features1,
        const ImageFeatures& features2,
        MatchesInfo& matches_info
        );

    void
    operator()(
        const std::vector<ImageFeatures>& features,
        std::vector<MatchesInfo>& pairwise_matches,
        const cv::UMat& mask = cv::UMat()
        );

protected:
    // fields

    bool is_thread_safe_;

    // methods

    virtual
    void
    match(
        const ImageFeatures& features1,
        const ImageFeatures& features2,
        MatchesInfo& matches_info
        ) = 0;

Detailed Documentation

Features matcher which finds two best matches for each feature and leaves the best one only if the ratio between descriptor distances is greater than the threshold match_conf.

See also:

detail::FeaturesMatcher

Construction

BestOf2NearestMatcher(
    bool try_use_gpu = false,
    float match_conf = 0.3f,
    int num_matches_thresh1 = 6,
    int num_matches_thresh2 = 6
    )

Constructs a “best of 2 nearest” matcher.

Parameters:

try_use_gpu Should try to use GPU or not
match_conf Match distances ration threshold
num_matches_thresh1 Minimum number of matches required for the 2D projective transform estimation used in the inliers classification step
num_matches_thresh2 Minimum number of matches required for the 2D projective transform re-estimation on inliers

Methods

virtual
void
collectGarbage()

Frees unused memory allocated before if there is any.

virtual
void
match(
    const ImageFeatures& features1,
    const ImageFeatures& features2,
    MatchesInfo& matches_info
    )

This method must implement matching logic in order to make the wrappers detail::FeaturesMatcher::operator()_ work.

Parameters:

features1 first image features
features2 second image features
matches_info found matches