GSoC2011SfM
0.1
Google Summer of Code 2011: Structure from motion
|
A class used for matching points between two images. More...
#include <PointsMatcher.h>
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< PointsMatcher > | clone (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< PointsMatcher > | create (std::string match_algo, double dist_allowed=2.0) |
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.
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.
name_of_algo | one of the following algo: OpticalFlowPyrLK OpticalFlowFarneback OpticalFlowBM OpticalFlowHS OpticalFlowLK |
dist_allowed | in 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().
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.
emptyTrainData | IIf 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.. |
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)
match_algo | name of the wanted algorithm |
dist_allowed | in pixel, the threshold to know if a match is close enough to the predicted position |
Definition at line 231 of file PointsMatcher.h.
bool OpencvSfM::PointsMatcherOpticalFlow::empty | ( | ) | const [virtual] |
Use to know if matching are available
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
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.
queryPoints | Query set of points and descriptors. |
matches | Mathes. Each matches[ i ] is k or less matches for the same query descriptor. |
k | Count of best matches will be found per each query descriptor ( or less if it’s not possible ). |
masks | specifying 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.
queryPoints | Query set of points and descriptors. |
matches | Mathes. 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. |
masks | The 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.
queryPoints | Query set of points and descriptors. |
matches | Each matches[ i ] is k or less matches for the same query descriptor. |
maxDistance | The threshold to found match distances. |
masks | specifying 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.