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

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

#include <PointsMatcher.h>

Inheritance diagram for OpencvSfM::PointsMatcherOpticalFlow:
OpencvSfM::PointsMatcher

List of all members.

Public Member Functions

 PointsMatcherOpticalFlow (std::string name_of_algo, double dist_allowed=2.0)
virtual void clear ()
virtual void train ()
virtual bool isMaskSupported ()
virtual bool empty () const
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.

Any OpticalFlow algorithm can be used. See http://opencv.itseez.com/modules/video/doc/motion_analysis_and_object_tracking.html for a list of compatible algorithms.

Definition at line 197 of file PointsMatcher.h.


Constructor & Destructor Documentation

OpencvSfM::PointsMatcherOpticalFlow::PointsMatcherOpticalFlow ( std::string  name_of_algo,
double  dist_allowed = 2.0 
)

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

Parameters:
name_of_algoone of the following algo: OpticalFlowPyrLK OpticalFlowFarneback OpticalFlowBM OpticalFlowHS OpticalFlowLK
dist_allowedin pixel, the threshold to know if a match is close enough to the predicted position

Definition at line 324 of file PointsMatcher.cpp.

Referenced by clone().


Member Function Documentation

void OpencvSfM::PointsMatcherOpticalFlow::clear ( ) [virtual]

If needed, you can clear the training data using this method.

Reimplemented from OpencvSfM::PointsMatcher.

Definition at line 344 of file PointsMatcher.cpp.

Ptr< PointsMatcher > OpencvSfM::PointsMatcherOpticalFlow::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 464 of file PointsMatcher.cpp.

static cv::Ptr<PointsMatcher> OpencvSfM::PointsMatcherOpticalFlow::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.itseez.com/modules/video/doc/motion_analysis_and_object_tracking.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 231 of file PointsMatcher.h.

bool OpencvSfM::PointsMatcherOpticalFlow::empty ( ) const [virtual]

Use to know if matching are available

Returns:
true if matching has been performed

Reimplemented from OpencvSfM::PointsMatcher.

Definition at line 459 of file PointsMatcher.cpp.

Referenced by match().

bool OpencvSfM::PointsMatcherOpticalFlow::isMaskSupported ( ) [virtual]

Use this method to know if mask are supported with current matcher

Returns:
true if matcher can use mask

Reimplemented from OpencvSfM::PointsMatcher.

Definition at line 354 of file PointsMatcher.cpp.

void OpencvSfM::PointsMatcherOpticalFlow::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 123 of file PointsMatcher.cpp.

void OpencvSfM::PointsMatcherOpticalFlow::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 359 of file PointsMatcher.cpp.

void OpencvSfM::PointsMatcherOpticalFlow::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 144 of file PointsMatcher.cpp.

void OpencvSfM::PointsMatcherOpticalFlow::train ( ) [virtual]

When using matcher which need training, use this method to start the training.

Reimplemented from OpencvSfM::PointsMatcher.

Definition at line 349 of file PointsMatcher.cpp.


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