Class cv::BFMatcher#

Brute-force descriptor matcher. View details

Collaboration diagram for cv::BFMatcher:

cv::BFMatcher Node1 cv::BFMatcher   + BFMatcher() + ~BFMatcher() + clone() + isMaskSupported() + create() # knnMatchImpl() # radiusMatchImpl() Node2 cv::DescriptorMatcher   + ~DescriptorMatcher() + add() + clear() + clone() + empty() + getTrainDescriptors() + isMaskSupported() + knnMatch() + knnMatch() + match() and 10 more... + create() + create() # checkMasks() # knnMatchImpl() # radiusMatchImpl() # clone_op() # isMaskedOut() # isPossibleMatch() Node2->Node1 Node3 cv::Algorithm   + Algorithm() + ~Algorithm() + clear() + empty() + getDefaultName() + read() + save() + write() + write() + load() + loadFromString() + read() # writeFormat() Node3->Node2 Node4 std::vector< cv::Mat >     Node4->Node2 #trainDescCollection Node5 cv::Mat   + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() and 152 more... + diag() + eye() + eye() + getDefaultAllocator() + getStdAllocator() + ones() + ones() + ones() + ones() + setDefaultAllocator() + zeros() + zeros() + zeros() + zeros() # forEach_impl() Node5->Node4 +elements Node6 int     Node6->Node1 #normType Node6->Node5 +cols +dims +dummy +flags +rows Node15 cv::UMat   + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() and 67 more... + diag() + eye() + eye() + getStdAllocator() + ones() + ones() + ones() + ones() + zeros() + zeros() + zeros() + zeros() Node6->Node15 +cols +dims +flags +rows Node7 uint8_t     Node7->Node5 +data +dataend +datalimit +datastart Node8 cv::MatAllocator   + MatAllocator() + ~MatAllocator() + allocate() + allocate() + copy() + deallocate() + download() + getBufferPoolController() + map() + unmap() + upload() Node8->Node5 +allocator Node8->Node15 +allocator Node9 UMatData *     Node9->Node5 +u Node9->Node15 +u Node10 MatSize     Node10->Node5 +size Node10->Node15 +size Node11 MatStep     Node11->Node5 +step Node11->Node15 +step Node12 std::vector< T >     Node12->Node4 < cv::Mat > Node14 std::vector< cv::UMat >     Node12->Node14 < cv::UMat > Node13 T     Node13->Node12 +elements Node14->Node2 #utrainDescCollection Node15->Node14 +elements Node16 UMatUsageFlags     Node16->Node15 +usageFlags Node17 size_t     Node17->Node15 +offset Node18 bool     Node18->Node1 #crossCheck

cv::BFMatcher Node1 cv::BFMatcher   + BFMatcher() + ~BFMatcher() + clone() + isMaskSupported() + create() # knnMatchImpl() # radiusMatchImpl() Node2 cv::DescriptorMatcher   + ~DescriptorMatcher() + add() + clear() + clone() + empty() + getTrainDescriptors() + isMaskSupported() + knnMatch() + knnMatch() + match() and 10 more... + create() + create() # checkMasks() # knnMatchImpl() # radiusMatchImpl() # clone_op() # isMaskedOut() # isPossibleMatch() Node2->Node1 Node3 cv::Algorithm   + Algorithm() + ~Algorithm() + clear() + empty() + getDefaultName() + read() + save() + write() + write() + load() + loadFromString() + read() # writeFormat() Node3->Node2 Node4 std::vector< cv::Mat >     Node4->Node2 #trainDescCollection Node5 cv::Mat   + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() + Mat() and 152 more... + diag() + eye() + eye() + getDefaultAllocator() + getStdAllocator() + ones() + ones() + ones() + ones() + setDefaultAllocator() + zeros() + zeros() + zeros() + zeros() # forEach_impl() Node5->Node4 +elements Node6 int     Node6->Node1 #normType Node6->Node5 +cols +dims +dummy +flags +rows Node15 cv::UMat   + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() + UMat() and 67 more... + diag() + eye() + eye() + getStdAllocator() + ones() + ones() + ones() + ones() + zeros() + zeros() + zeros() + zeros() Node6->Node15 +cols +dims +flags +rows Node7 uint8_t     Node7->Node5 +data +dataend +datalimit +datastart Node8 cv::MatAllocator   + MatAllocator() + ~MatAllocator() + allocate() + allocate() + copy() + deallocate() + download() + getBufferPoolController() + map() + unmap() + upload() Node8->Node5 +allocator Node8->Node15 +allocator Node9 UMatData *     Node9->Node5 +u Node9->Node15 +u Node10 MatSize     Node10->Node5 +size Node10->Node15 +size Node11 MatStep     Node11->Node5 +step Node11->Node15 +step Node12 std::vector< T >     Node12->Node4 < cv::Mat > Node14 std::vector< cv::UMat >     Node12->Node14 < cv::UMat > Node13 T     Node13->Node12 +elements Node14->Node2 #utrainDescCollection Node15->Node14 +elements Node16 UMatUsageFlags     Node16->Node15 +usageFlags Node17 size_t     Node17->Node15 +offset Node18 bool     Node18->Node1 #crossCheck

Public Types#

Public Types inherited from cv::DescriptorMatcher

Return

Name

Description

MatcherType

Public Member Functions#

Public Member Functions inherited from cv::DescriptorMatcher

Return

Name

Description

~DescriptorMatcher()

void

add(InputArrayOfArrays descriptors)

Adds descriptors to train a CPU(trainDescCollectionis) or GPU(utrainDescCollectionis) descriptor collection.

void

clear()

Clears the train descriptor collections.

CV_NODISCARD_STD Ptr< DescriptorMatcher >

clone(bool emptyTrainData = false)

Clones the matcher.

bool

empty()

Returns true if there are no train descriptors in the both collections.

const std::vector< Mat > &

getTrainDescriptors()

Returns a constant link to the train descriptor collection trainDescCollection .

bool

isMaskSupported()

Returns true if the descriptor matcher supports masking permissible matches.

void

knnMatch(
    InputArray queryDescriptors,
    InputArray trainDescriptors,
    std::vector< std::vector< DMatch > > & matches,
    int k,
    InputArray mask = noArray(),
    bool compactResult = false )

Finds the k best matches for each descriptor from a query set.

void

knnMatch(
    InputArray queryDescriptors,
    std::vector< std::vector< DMatch > > & matches,
    int k,
    InputArrayOfArrays masks = noArray(),
    bool compactResult = false )

void

match(
    InputArray queryDescriptors,
    InputArray trainDescriptors,
    std::vector< DMatch > & matches,
    InputArray mask = noArray() )

Finds the best match for each descriptor from a query set.

void

match(
    InputArray queryDescriptors,
    std::vector< DMatch > & matches,
    InputArrayOfArrays masks = noArray() )

void

radiusMatch(
    InputArray queryDescriptors,
    InputArray trainDescriptors,
    std::vector< std::vector< DMatch > > & matches,
    float maxDistance,
    InputArray mask = noArray(),
    bool compactResult = false )

For each query descriptor, finds the training descriptors not farther than the specified distance.

void

radiusMatch(
    InputArray queryDescriptors,
    std::vector< std::vector< DMatch > > & matches,
    float maxDistance,
    InputArrayOfArrays masks = noArray(),
    bool compactResult = false )

void

read(const FileNode & fn)

Reads algorithm parameters from a file storage.

void

read(const String & fileName)

void

train()

Trains a descriptor matcher.

void

write(
    const Ptr< FileStorage > & fs,
    const String & name )

void

write(const String & fileName)

void

write(FileStorage & fs)

Stores algorithm parameters in a file storage.

void

write(
    FileStorage & fs,
    const String & name )

Public Member Functions inherited from cv::Algorithm

Return

Name

Description

Algorithm()

~Algorithm()

void

clear()

Clears the algorithm state.

bool

empty()

Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.

String

getDefaultName()

void

read(const FileNode & fn)

Reads algorithm parameters from a file storage.

void

save(const String & filename)

void

write(
    const Ptr< FileStorage > & fs,
    const String & name = String() )

void

write(FileStorage & fs)

Stores algorithm parameters in a file storage.

void

write(
    FileStorage & fs,
    const String & name )

Static Public Member Functions#

Static Public Member Functions inherited from cv::DescriptorMatcher

Return

Name

Description

static Ptr< DescriptorMatcher >

create(const DescriptorMatcher::MatcherType & matcherType)

static Ptr< DescriptorMatcher >

create(const String & descriptorMatcherType)

Creates a descriptor matcher of a given type with the default parameters (using default constructor).

Static Public Member Functions inherited from cv::Algorithm

Return

Name

Description

static Ptr< _Tp >

load(
    const String & filename,
    const String & objname = String() )

Loads algorithm from the file.

static Ptr< _Tp >

loadFromString(
    const String & strModel,
    const String & objname = String() )

Loads algorithm from a String.

static Ptr< _Tp >

read(const FileNode & fn)

Reads algorithm from the file node.

Additional Inherited Members#

Protected Member Functions inherited from cv::DescriptorMatcher
Protected Member Functions inherited from cv::Algorithm

Return

Name

Description

void

writeFormat(FileStorage & fs)

Static Protected Member Functions inherited from cv::DescriptorMatcher
Protected Attributes inherited from cv::DescriptorMatcher

Return

Name

Description

std::vector< Mat >

trainDescCollection

Collection of descriptors from train images.

std::vector< UMat >

utrainDescCollection

Detailed Description#

Brute-force descriptor matcher.

For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. This descriptor matcher supports masking permissible matches of descriptor sets.

Constructor & Destructor Documentation#

BFMatcher()#

cv::BFMatcher::BFMatcher(
int normType = NORM_L2,
bool crossCheck = false )

Python:

cv.BFMatcher([, normType[, crossCheck]]) -> <BFMatcher object>

Brute-force matcher constructor (obsolete). Please use BFMatcher.create()

~BFMatcher()#

cv::BFMatcher::~BFMatcher()

Member Function Documentation#

clone()#

CV_NODISCARD_STD Ptr< DescriptorMatcher > cv::BFMatcher::clone(bool emptyTrainData = false)

Clones the matcher.

Parameters

  • emptyTrainData — If emptyTrainData is false, the method creates a deep copy of the object, that is, copies both parameters and train data. If emptyTrainData is true, the method creates an object copy with the current parameters but with empty train data.

isMaskSupported()#

bool cv::BFMatcher::isMaskSupported()

Returns true if the descriptor matcher supports masking permissible matches.

create()#

static Ptr< BFMatcher > cv::BFMatcher::create(
int normType = NORM_L2,
bool crossCheck = false )

Python:

cv.BFMatcher.create([, normType[, crossCheck]]) -> retval
cv.BFMatcher_create([, normType[, crossCheck]]) -> retval

Brute-force matcher create method.

Parameters

  • 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, BRISK and BRIEF, NORM_HAMMING2 should be used with ORB when WTA_K==3 or 4 (see ORB::ORB constructor description).

  • crossCheck — If it is false, this is will be default BFMatcher behaviour when it finds the k nearest neighbors for each query descriptor. If crossCheck==true, then the knnMatch() method with k=1 will only return pairs (i,j) such that for i-th query descriptor the j-th descriptor in the matcher’s collection is the nearest and vice versa, i.e. the BFMatcher will only return consistent pairs. Such technique usually produces best results with minimal number of outliers when there are enough matches. This is alternative to the ratio test, used by D. Lowe in SIFT paper.

knnMatchImpl()#

void cv::BFMatcher::knnMatchImpl(
InputArray queryDescriptors,
std::vector< std::vector< DMatch > > & matches,
int k,
InputArrayOfArrays masks = noArray(),
bool compactResult = false )

In fact the matching is implemented only by the following two methods. These methods suppose that the class object has been trained already. Public match methods call these methods after calling train().

radiusMatchImpl()#

void cv::BFMatcher::radiusMatchImpl(
InputArray queryDescriptors,
std::vector< std::vector< DMatch > > & matches,
float maxDistance,
InputArrayOfArrays masks = noArray(),
bool compactResult = false )

Member Data Documentation#

crossCheck#

bool cv::BFMatcher::crossCheck

normType#

int cv::BFMatcher::normType

Source file#

The documentation for this class was generated from the following file: