GSoC2011SfM  0.1
Google Summer of Code 2011: Structure from motion
Public Member Functions | Static Public Member Functions
OpencvSfM::MatcherSparseFlow Class Reference

A class used for matching points between two images. More...

#include <MatcherSparseFlow.h>

Inheritance diagram for OpencvSfM::MatcherSparseFlow:
OpencvSfM::PointsMatcher

List of all members.

Public Member Functions

 MatcherSparseFlow (const cv::Ptr< cv::DescriptorMatcher > &matcher, double dist_allowed=2.0)
virtual cv::Ptr< PointsMatcherclone (bool emptyTrainData=true)
virtual void match (cv::Ptr< PointsToTrack > queryPoints, std::vector< cv::DMatch > &matches, const std::vector< cv::Mat > &masks=std::vector< cv::Mat >())
virtual void knnMatch (cv::Ptr< PointsToTrack > queryPoints, std::vector< std::vector< cv::DMatch > > &matches, int k, const std::vector< cv::Mat > &masks=std::vector< cv::Mat >(), bool compactResult=true)
virtual void radiusMatch (cv::Ptr< PointsToTrack > queryPoints, std::vector< std::vector< cv::DMatch > > &matches, float maxDistance, const std::vector< cv::Mat > &masks=std::vector< cv::Mat >(), bool compactResult=true)

Static Public Member Functions

static cv::Ptr< PointsMatchercreate (std::string match_algo, double dist_allowed=2.0)

Detailed Description

A class used for matching points between two images.

This class use first a feature based matcher to have guesses about optical flow and then use calcOpticalFlowPyrLK to find every match (and add points to other image if needed)

Definition at line 21 of file MatcherSparseFlow.h.


Constructor & Destructor Documentation

OpencvSfM::MatcherSparseFlow::MatcherSparseFlow ( const cv::Ptr< cv::DescriptorMatcher > &  matcher,
double  dist_allowed = 2.0 
)

Construct a new point matcher using the name of the opticalflow algorithm.

Parameters:
matcherthe matching algo (see http://opencv.willowgarage.com/documentation/cpp/features2d_common_interfaces_of_descriptor_matchers.html)
dist_allowedin pixel, the threshold to know if a match is close enough to the predicted position

Definition at line 22 of file MatcherSparseFlow.cpp.

Referenced by clone().


Member Function Documentation

cv::Ptr< PointsMatcher > OpencvSfM::MatcherSparseFlow::clone ( bool  emptyTrainData = true) [virtual]

Clone the matcher.

Parameters:
emptyTrainDataIIf emptyTrainData is false the method create deep copy of the object, i.e. copies both parameters and train data. If emptyTrainData is true the method create object copy with current parameters but with empty train data..
Returns:
An other PointsMatcher instance

Reimplemented from OpencvSfM::PointsMatcher.

Definition at line 29 of file MatcherSparseFlow.cpp.

static cv::Ptr<PointsMatcher> OpencvSfM::MatcherSparseFlow::create ( std::string  match_algo,
double  dist_allowed = 2.0 
) [inline, static]

Use this function to create a point matcher using the name of an opticalflow algorithm (see http://opencv.willowgarage.com/documentation/cpp/features2d_common_interfaces_of_descriptor_matchers.html)

Parameters:
match_algoname of the wanted algorithm
dist_allowedin pixel, the threshold to know if a match is close enough to the predicted position
Returns:
a new PointsMatcher

Definition at line 41 of file MatcherSparseFlow.h.

void OpencvSfM::MatcherSparseFlow::knnMatch ( cv::Ptr< PointsToTrack queryPoints,
std::vector< std::vector< cv::DMatch > > &  matches,
int  k,
const std::vector< cv::Mat > &  masks = std::vector<cv::Mat>( ),
bool  compactResult = true 
) [virtual]

Find the k best matches for each descriptor from a query set with train descriptors.

Parameters:
queryPointsQuery set of points and descriptors.
matchesMathes. Each matches[ i ] is k or less matches for the same query descriptor.
kCount of best matches will be found per each query descriptor ( or less if it’s not possible ).
masksspecifying permissible matches between input query and train matrices of descriptors.
compactResult– It’s used when mask ( or masks ) is not empty. If compactResult is false matches vector will have the same size as queryDescriptors rows. If compactResult is true matches vector will not contain matches for fully masked out query descriptors.

Reimplemented from OpencvSfM::PointsMatcher.

Definition at line 211 of file MatcherSparseFlow.cpp.

void OpencvSfM::MatcherSparseFlow::match ( cv::Ptr< PointsToTrack queryPoints,
std::vector< cv::DMatch > &  matches,
const std::vector< cv::Mat > &  masks = std::vector<cv::Mat>( ) 
) [virtual]

Find the k best matches for each descriptor from a query set with train descriptors.

Parameters:
queryPointsQuery set of points and descriptors.
matchesMathes. If some query descriptor ( keypoint ) masked out in mask no match will be added for this descriptor. So matches size may be less than query keypoints count.
masksThe set of masks. Each masks[ i ] specifies permissible matches between input query keypoints and stored train keypointss from i-th image.

Reimplemented from OpencvSfM::PointsMatcher.

Definition at line 41 of file MatcherSparseFlow.cpp.

Referenced by knnMatch(), and radiusMatch().

void OpencvSfM::MatcherSparseFlow::radiusMatch ( cv::Ptr< PointsToTrack queryPoints,
std::vector< std::vector< cv::DMatch > > &  matches,
float  maxDistance,
const std::vector< cv::Mat > &  masks = std::vector<cv::Mat>( ),
bool  compactResult = true 
) [virtual]

Find the best matches for each query descriptor which have distance less than given threshold.

Parameters:
queryPointsQuery set of points and descriptors.
matchesEach matches[ i ] is k or less matches for the same query descriptor.
maxDistanceThe threshold to found match distances.
masksspecifying permissible matches between input query and train matrices of descriptors.
compactResult– It’s used when mask ( or masks ) is not empty. If compactResult is false matches vector will have the same size as queryDescriptors rows. If compactResult is true matches vector will not contain matches for fully masked out query descriptors.

Reimplemented from OpencvSfM::PointsMatcher.

Definition at line 223 of file MatcherSparseFlow.cpp.


The documentation for this class was generated from the following files:
 All Classes Functions Variables