OpenCV453
クラス | 公開型 | 公開メンバ関数 | 静的公開メンバ関数 | 限定公開メンバ関数 | 静的限定公開メンバ関数 | 限定公開変数類 | 全メンバ一覧
cv::DescriptorMatcher クラスabstract

Abstract base class for matching keypoint descriptors. [詳解]

#include <features2d.hpp>

cv::Algorithmを継承しています。

cv::BFMatcherに継承されています。

クラス

class  DescriptorCollection
 

公開型

enum  MatcherType {
  FLANNBASED = 1 , BRUTEFORCE = 2 , BRUTEFORCE_L1 = 3 , BRUTEFORCE_HAMMING = 4 ,
  BRUTEFORCE_HAMMINGLUT = 5 , BRUTEFORCE_SL2 = 6
}
 

公開メンバ関数

virtual CV_WRAP void add (InputArrayOfArrays descriptors)
 Adds descriptors to train a CPU(trainDescCollectionis) or GPU(utrainDescCollectionis) descriptor collection. [詳解]
 
CV_WRAP const std::vector< Mat > & getTrainDescriptors () const
 Returns a constant link to the train descriptor collection trainDescCollection .
 
virtual CV_WRAP void clear () CV_OVERRIDE
 Clears the train descriptor collections. [詳解]
 
virtual CV_WRAP bool empty () const CV_OVERRIDE
 Returns true if there are no train descriptors in the both collections. [詳解]
 
virtual CV_WRAP bool isMaskSupported () const =0
 Returns true if the descriptor matcher supports masking permissible matches. [詳解]
 
virtual CV_WRAP void train ()
 Trains a descriptor matcher [詳解]
 
CV_WRAP void match (InputArray queryDescriptors, InputArray trainDescriptors, CV_OUT std::vector< DMatch > &matches, InputArray mask=noArray()) const
 Finds the best match for each descriptor from a query set. [詳解]
 
CV_WRAP void knnMatch (InputArray queryDescriptors, InputArray trainDescriptors, CV_OUT std::vector< std::vector< DMatch > > &matches, int k, InputArray mask=noArray(), bool compactResult=false) const
 Finds the k best matches for each descriptor from a query set. [詳解]
 
CV_WRAP void radiusMatch (InputArray queryDescriptors, InputArray trainDescriptors, CV_OUT std::vector< std::vector< DMatch > > &matches, float maxDistance, InputArray mask=noArray(), bool compactResult=false) const
 For each query descriptor, finds the training descriptors not farther than the specified distance. [詳解]
 
CV_WRAP void match (InputArray queryDescriptors, CV_OUT std::vector< DMatch > &matches, InputArrayOfArrays masks=noArray())
 
CV_WRAP void knnMatch (InputArray queryDescriptors, CV_OUT std::vector< std::vector< DMatch > > &matches, int k, InputArrayOfArrays masks=noArray(), bool compactResult=false)
 
CV_WRAP void radiusMatch (InputArray queryDescriptors, CV_OUT std::vector< std::vector< DMatch > > &matches, float maxDistance, InputArrayOfArrays masks=noArray(), bool compactResult=false)
 
CV_WRAP void write (const String &fileName) const
 
CV_WRAP void read (const String &fileName)
 
virtual CV_WRAP void read (const FileNode &) CV_OVERRIDE
 Reads algorithm parameters from a file storage [詳解]
 
virtual void write (FileStorage &) const CV_OVERRIDE
 Stores algorithm parameters in a file storage [詳解]
 
virtual CV_WRAP Ptr< DescriptorMatcherclone (bool emptyTrainData=false) const =0
 Clones the matcher. [詳解]
 
CV_WRAP void write (const Ptr< FileStorage > &fs, const String &name=String()) const
 
- 基底クラス cv::Algorithm に属する継承公開メンバ関数
CV_WRAP void write (const Ptr< FileStorage > &fs, const String &name=String()) const
 simplified API for language bindings これはオーバーロードされたメンバ関数です。利便性のために用意されています。元の関数との違いは引き数のみです。
 
virtual CV_WRAP void save (const String &filename) const
 
virtual CV_WRAP String getDefaultName () const
 

静的公開メンバ関数

static CV_WRAP Ptr< DescriptorMatchercreate (const String &descriptorMatcherType)
 Creates a descriptor matcher of a given type with the default parameters (using default constructor). [詳解]
 
static CV_WRAP Ptr< DescriptorMatchercreate (const DescriptorMatcher::MatcherType &matcherType)
 
- 基底クラス cv::Algorithm に属する継承静的公開メンバ関数
template<typename _Tp >
static Ptr< _Tp > read (const FileNode &fn)
 Reads algorithm from the file node [詳解]
 
template<typename _Tp >
static Ptr< _Tp > load (const String &filename, const String &objname=String())
 Loads algorithm from the file [詳解]
 
template<typename _Tp >
static Ptr< _Tp > loadFromString (const String &strModel, const String &objname=String())
 Loads algorithm from a String [詳解]
 

限定公開メンバ関数

virtual void knnMatchImpl (InputArray queryDescriptors, std::vector< std::vector< DMatch > > &matches, int k, InputArrayOfArrays masks=noArray(), bool compactResult=false)=0
 
virtual void radiusMatchImpl (InputArray queryDescriptors, std::vector< std::vector< DMatch > > &matches, float maxDistance, InputArrayOfArrays masks=noArray(), bool compactResult=false)=0
 
void checkMasks (InputArrayOfArrays masks, int queryDescriptorsCount) const
 
- 基底クラス cv::Algorithm に属する継承限定公開メンバ関数
void writeFormat (FileStorage &fs) const
 

静的限定公開メンバ関数

static bool isPossibleMatch (InputArray mask, int queryIdx, int trainIdx)
 
static bool isMaskedOut (InputArrayOfArrays masks, int queryIdx)
 
static Mat clone_op (Mat m)
 

限定公開変数類

std::vector< MattrainDescCollection
 Collection of descriptors from train images.
 
std::vector< UMatutrainDescCollection
 

詳解

Abstract base class for matching keypoint descriptors.

It has two groups of match methods: for matching descriptors of an image with another image or with an image set.

関数詳解

◆ add()

virtual CV_WRAP void cv::DescriptorMatcher::add ( InputArrayOfArrays  descriptors)
virtual

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

If the collection is not empty, the new descriptors are added to existing train descriptors.

引数
descriptorsDescriptors to add. Each descriptors[i] is a set of descriptors from the same train image.

◆ clear()

virtual CV_WRAP void cv::DescriptorMatcher::clear ( )
virtual

Clears the train descriptor collections.

cv::Algorithmを再実装しています。

◆ clone()

virtual CV_WRAP Ptr< DescriptorMatcher > cv::DescriptorMatcher::clone ( bool  emptyTrainData = false) const
pure virtual

Clones the matcher.

引数
emptyTrainDataIf 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.

cv::BFMatcherで実装されています。

◆ create()

static CV_WRAP Ptr< DescriptorMatcher > cv::DescriptorMatcher::create ( const String &  descriptorMatcherType)
static

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

引数
descriptorMatcherTypeDescriptor matcher type. Now the following matcher types are supported:
  • BruteForce (it uses L2 )
  • BruteForce-L1
  • BruteForce-Hamming
  • BruteForce-Hamming(2)
  • FlannBased

◆ empty()

virtual CV_WRAP bool cv::DescriptorMatcher::empty ( ) const
virtual

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

cv::Algorithmを再実装しています。

◆ isMaskSupported()

virtual CV_WRAP bool cv::DescriptorMatcher::isMaskSupported ( ) const
pure virtual

Returns true if the descriptor matcher supports masking permissible matches.

cv::BFMatcherで実装されています。

◆ knnMatch() [1/2]

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

これはオーバーロードされたメンバ関数です。利便性のために用意されています。元の関数との違いは引き数のみです。

引数
queryDescriptorsQuery set of descriptors.
matchesMatches. Each matches[i] is k or less matches for the same query descriptor.
kCount of best matches found per each query descriptor or less if a query descriptor has less than k possible matches in total.
masksSet of masks. Each masks[i] specifies permissible matches between the input query descriptors and stored train descriptors from the i-th image trainDescCollection[i].
compactResultParameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.

◆ knnMatch() [2/2]

CV_WRAP void cv::DescriptorMatcher::knnMatch ( InputArray  queryDescriptors,
InputArray  trainDescriptors,
CV_OUT std::vector< std::vector< DMatch > > &  matches,
int  k,
InputArray  mask = noArray(),
bool  compactResult = false 
) const

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

引数
queryDescriptorsQuery set of descriptors.
trainDescriptorsTrain set of descriptors. This set is not added to the train descriptors collection stored in the class object.
maskMask specifying permissible matches between an input query and train matrices of descriptors.
matchesMatches. Each matches[i] is k or less matches for the same query descriptor.
kCount of best matches found per each query descriptor or less if a query descriptor has less than k possible matches in total.
compactResultParameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.

These extended variants of DescriptorMatcher::match methods find several best matches for each query descriptor. The matches are returned in the distance increasing order. See DescriptorMatcher::match for the details about query and train descriptors.

◆ knnMatchImpl()

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

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().

cv::BFMatcherで実装されています。

◆ match() [1/2]

CV_WRAP void cv::DescriptorMatcher::match ( InputArray  queryDescriptors,
CV_OUT std::vector< DMatch > &  matches,
InputArrayOfArrays  masks = noArray() 
)

これはオーバーロードされたメンバ関数です。利便性のために用意されています。元の関数との違いは引き数のみです。

引数
queryDescriptorsQuery set of descriptors.
matchesMatches. If a query descriptor is masked out in mask , no match is added for this descriptor. So, matches size may be smaller than the query descriptors count.
masksSet of masks. Each masks[i] specifies permissible matches between the input query descriptors and stored train descriptors from the i-th image trainDescCollection[i].

◆ match() [2/2]

CV_WRAP void cv::DescriptorMatcher::match ( InputArray  queryDescriptors,
InputArray  trainDescriptors,
CV_OUT std::vector< DMatch > &  matches,
InputArray  mask = noArray() 
) const

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

引数
queryDescriptorsQuery set of descriptors.
trainDescriptorsTrain set of descriptors. This set is not added to the train descriptors collection stored in the class object.
matchesMatches. If a query descriptor is masked out in mask , no match is added for this descriptor. So, matches size may be smaller than the query descriptors count.
maskMask specifying permissible matches between an input query and train matrices of descriptors.

In the first variant of this method, the train descriptors are passed as an input argument. In the second variant of the method, train descriptors collection that was set by DescriptorMatcher::add is used. Optional mask (or masks) can be passed to specify which query and training descriptors can be matched. Namely, queryDescriptors[i] can be matched with trainDescriptors[j] only if mask.at<uchar>(i,j) is non-zero.

◆ radiusMatch() [1/2]

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

これはオーバーロードされたメンバ関数です。利便性のために用意されています。元の関数との違いは引き数のみです。

引数
queryDescriptorsQuery set of descriptors.
matchesFound matches.
maxDistanceThreshold for the distance between matched descriptors. Distance means here metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured in Pixels)!
masksSet of masks. Each masks[i] specifies permissible matches between the input query descriptors and stored train descriptors from the i-th image trainDescCollection[i].
compactResultParameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.

◆ radiusMatch() [2/2]

CV_WRAP void cv::DescriptorMatcher::radiusMatch ( InputArray  queryDescriptors,
InputArray  trainDescriptors,
CV_OUT std::vector< std::vector< DMatch > > &  matches,
float  maxDistance,
InputArray  mask = noArray(),
bool  compactResult = false 
) const

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

引数
queryDescriptorsQuery set of descriptors.
trainDescriptorsTrain set of descriptors. This set is not added to the train descriptors collection stored in the class object.
matchesFound matches.
compactResultParameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.
maxDistanceThreshold for the distance between matched descriptors. Distance means here metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured in Pixels)!
maskMask specifying permissible matches between an input query and train matrices of descriptors.

For each query descriptor, the methods find such training descriptors that the distance between the query descriptor and the training descriptor is equal or smaller than maxDistance. Found matches are returned in the distance increasing order.

◆ read()

virtual CV_WRAP void cv::DescriptorMatcher::read ( const FileNode fn)
virtual

Reads algorithm parameters from a file storage

cv::Algorithmを再実装しています。

◆ train()

virtual CV_WRAP void cv::DescriptorMatcher::train ( )
virtual

Trains a descriptor matcher

Trains a descriptor matcher (for example, the flann index). In all methods to match, the method train() is run every time before matching. Some descriptor matchers (for example, BruteForceMatcher) have an empty implementation of this method. Other matchers really train their inner structures (for example, FlannBasedMatcher trains flann::Index ).

◆ write()

virtual void cv::DescriptorMatcher::write ( FileStorage fs) const
virtual

Stores algorithm parameters in a file storage

cv::Algorithmを再実装しています。


このクラス詳解は次のファイルから抽出されました: