![]()  | 
  
  
  
    GSoC2011SfM
    0.1
    
   Google Summer of Code 2011: Structure from motion 
   | 
  
  
  
 
This class store the track of keypoints. A track is a connected set of matching keypoints across multiple images. More...
#include <TracksOfPoints.h>
Public Member Functions | |
| template<typename Type , int size> | |
| operator cv::Vec< Type, size > & () | |
| bool | addMatch (const int image_src, const int point_idx) | 
| bool | containImage (const int image_wanted) const | 
| bool | containPoint (const int image_src, const int point_idx1) const | 
| unsigned int | getNbTrack () const | 
| cv::DMatch | toDMatch (const int img1, const int img2) const | 
| void | getMatch (const unsigned int index, int &idImage, int &idPoint) const | 
| int | getPointIndex (const unsigned int image) const | 
| int | getImageIndex (const unsigned int idx) const | 
| double | triangulateLinear (std::vector< PointOfView > &cameras, const std::vector< cv::Ptr< PointsToTrack > > &points_to_track, cv::Vec3d &points3D, const std::vector< bool > &masks=std::vector< bool >()) | 
| double | triangulateRobust (std::vector< PointOfView > &cameras, const std::vector< cv::Ptr< PointsToTrack > > &points_to_track, cv::Vec3d &points3D, double reproj_error=4, const std::vector< bool > &masks=std::vector< bool >()) | 
| void | removeOutliers (std::vector< PointOfView > &cameras, const std::vector< cv::Ptr< PointsToTrack > > &points_to_track, double reproj_error=4, std::vector< bool > *masks=NULL) | 
| void | set3DPosition (cv::Vec3d newPoint) | 
| cv::Ptr< cv::Vec3d > | get3DPosition () | 
| unsigned int | getColor () const | 
| void | setColor (unsigned int c) | 
Static Public Member Functions | |
| static void | fusionDuplicates (std::vector< TrackOfPoints > &tracks) | 
| static void | keepTrackHavingImage (unsigned int idx_image, std::vector< TrackOfPoints > &tracks) | 
| static void | keepTrackWithImages (const std::vector< int > &imgList, std::vector< TrackOfPoints > &tracks) | 
| static void | mixTracks (const std::vector< TrackOfPoints > &list_tracks, std::vector< TrackOfPoints > *mixed_tracks) | 
Protected Member Functions | |
| double | errorEstimate (std::vector< PointOfView > &cameras, const std::vector< cv::Ptr< PointsToTrack > > &points_to_track, cv::Vec3d &points3D, const std::vector< bool > &masks=std::vector< bool >()) const | 
Protected Attributes | |
| cv::Ptr< cv::Vec3d > | point3D | 
| The corresponding 3D coordinates. If not available, Ptr is empty.  | |
| std::vector< unsigned int > | images_indexes_ | 
| List of image indexes of unordered points.  | |
| std::vector< unsigned int > | point_indexes_ | 
| List of point indexes of unordered points.  | |
| unsigned int | color | 
| Color of this point (computed using the mean of every 2D points projections.  | |
| std::vector< bool > | good_values | 
| int | track_consistance | 
Friends | |
| class | SequenceAnalyzer | 
This class store the track of keypoints. A track is a connected set of matching keypoints across multiple images.
This class can be used as a Vec3d because it's the projection of a 3D points Of course, use triangulate method before to create this 3D point!
Discussion: Store index of points or 2D position?
Definition at line 23 of file TracksOfPoints.h.
| bool OpencvSfM::TrackOfPoints::addMatch | ( | const int | image_src, | 
| const int | point_idx | ||
| ) | 
This function add matches to track
| image_src | index of source matches image | 
| point_idx | index of point in source image | 
Definition at line 56 of file TracksOfPoints.cpp.
Referenced by OpencvSfM::SequenceAnalyzer::addMatches(), fusionDuplicates(), mixTracks(), and OpencvSfM::SequenceAnalyzer::read().
| bool OpencvSfM::TrackOfPoints::containImage | ( | const int | image_wanted | ) |  const [inline] | 
        
This function is used to know if the track contains the image
| image_wanted | index of query image | 
Definition at line 66 of file TracksOfPoints.h.
Referenced by OpencvSfM::StructureEstimator::computeStructure(), OpencvSfM::PointsToTrack::getKeyMatches(), OpencvSfM::EuclideanEstimator::initialReconstruction(), keepTrackHavingImage(), and keepTrackWithImages().
| bool OpencvSfM::TrackOfPoints::containPoint | ( | const int | image_src, | 
| const int | point_idx1 | ||
| ) | const | 
This function is used to know if the track contains the query point
| image_src | index of query image | 
| point_idx1 | index of point in query image | 
Definition at line 156 of file TracksOfPoints.cpp.
Referenced by OpencvSfM::SequenceAnalyzer::addMatches(), and mixTracks().
| double OpencvSfM::TrackOfPoints::errorEstimate | ( | std::vector< PointOfView > & | cameras, | 
| const std::vector< cv::Ptr< PointsToTrack > > & | points_to_track, | ||
| cv::Vec3d & | points3D, | ||
| const std::vector< bool > & | masks = std::vector<bool>( )  | 
        ||
| ) |  const [protected] | 
        
Comptue an estimation of 2D reprojection error
| cameras | list of cameras | 
| points_to_track | list of 2D points | 
| points3D | 3d points to project with cameras | 
| masks | wanted points | 
Definition at line 217 of file TracksOfPoints.cpp.
Referenced by triangulateLinear().
| void OpencvSfM::TrackOfPoints::fusionDuplicates | ( | std::vector< TrackOfPoints > & | tracks | ) |  [static] | 
        
Remove tracks having points in commun (mix them and set them inconsistant if needed...)
| tracks | list of tracks to analyze | 
Definition at line 95 of file TracksOfPoints.cpp.
Referenced by OpencvSfM::SequenceAnalyzer::addImageToTracks(), and OpencvSfM::SequenceAnalyzer::computeMatches().
| cv::Ptr<cv::Vec3d> OpencvSfM::TrackOfPoints::get3DPosition | ( | ) |  [inline] | 
        
Use this function to get the 3D point corresponding to this track
Definition at line 189 of file TracksOfPoints.h.
Referenced by OpencvSfM::StructureEstimator::removeOutliersTracks().
| unsigned int OpencvSfM::TrackOfPoints::getColor | ( | ) |  const [inline] | 
        
Use this function to get the color of this track
Definition at line 195 of file TracksOfPoints.h.
Referenced by OpencvSfM::SequenceAnalyzer::write().
| int OpencvSfM::TrackOfPoints::getImageIndex | ( | const unsigned int | idx | ) |  const [inline] | 
        
use this function to get the image corresponding to the nth entry of this track
| idx | index of wanted point | 
Definition at line 124 of file TracksOfPoints.h.
Referenced by OpencvSfM::StructureEstimator::computeStructure().
| void OpencvSfM::TrackOfPoints::getMatch | ( | const unsigned int | index, | 
| int & | idImage, | ||
| int & | idPoint | ||
| ) | const | 
use this function to get the n^th match value from this track
| index | which match | 
| idImage | out value of the image index | 
| idPoint | out value of the point index | 
Definition at line 206 of file TracksOfPoints.cpp.
| unsigned int OpencvSfM::TrackOfPoints::getNbTrack | ( | ) |  const [inline] | 
        
This function is used to get the numbers of image for this track
Definition at line 85 of file TracksOfPoints.h.
Referenced by OpencvSfM::StructureEstimator::computeStructure(), OpencvSfM::StructureEstimator::removeOutliersTracks(), OpencvSfM::SequenceAnalyzer::removePointsWithoutProjection(), and OpencvSfM::SequenceAnalyzer::write().
| int OpencvSfM::TrackOfPoints::getPointIndex | ( | const unsigned int | image | ) |  const [inline] | 
        
use this function to get the index point of the wanted image
| image | index of wanted image | 
Definition at line 110 of file TracksOfPoints.h.
Referenced by OpencvSfM::PointsToTrack::getKeyMatches().
| void OpencvSfM::TrackOfPoints::keepTrackHavingImage | ( | unsigned int | idx_image, | 
| std::vector< TrackOfPoints > & | tracks | ||
| ) |  [static] | 
        
Use this function to keep only tracks having image from first parameter
| idx_image | index of needed image | 
| tracks | vector of matches to clean... | 
Definition at line 402 of file TracksOfPoints.cpp.
| void OpencvSfM::TrackOfPoints::keepTrackWithImages | ( | const std::vector< int > & | imgList, | 
| std::vector< TrackOfPoints > & | tracks | ||
| ) |  [static] | 
        
Use this function to keep only tracks having at least 2 images from first parameter
| imgList | Needed images indexes | 
| tracks | vector of matches to clean... | 
Definition at line 467 of file TracksOfPoints.cpp.
| void OpencvSfM::TrackOfPoints::mixTracks | ( | const std::vector< TrackOfPoints > & | list_tracks, | 
| std::vector< TrackOfPoints > * | mixed_tracks | ||
| ) |  [static] | 
        
add to mixed_tracks the new tracks from list_tracks who are not in mixed_tracks. Of course, as a track of points contains only indexes, be careful to mix two compatible vectors (i.e. share the same points indexes)
| list_tracks | first list of tracks to add into mixed_tracks | 
| mixed_tracks | output list of tracks | 
Definition at line 422 of file TracksOfPoints.cpp.
| OpencvSfM::TrackOfPoints::operator cv::Vec< Type, size > & | ( | ) |  [inline] | 
        
cast operator to use this object as a 3D point!
Definition at line 47 of file TracksOfPoints.h.
| void OpencvSfM::TrackOfPoints::removeOutliers | ( | std::vector< PointOfView > & | cameras, | 
| const std::vector< cv::Ptr< PointsToTrack > > & | points_to_track, | ||
| double | reproj_error = 4,  | 
        ||
| std::vector< bool > * | masks = NULL  | 
        ||
| ) | 
From the list of points of this track, remove each 2D points when reprojection error > reproj_error
| cameras | cameras used to compute projection of 3D point. | 
| points_to_track | 2D points used to compute reprojection error | 
| reproj_error | Threshold used to reject outliners | 
| masks | used to knwo which point this function have to test. | 
Definition at line 368 of file TracksOfPoints.cpp.
Referenced by OpencvSfM::StructureEstimator::removeOutliersTracks().
| void OpencvSfM::TrackOfPoints::set3DPosition | ( | cv::Vec3d | newPoint | ) |  [inline] | 
        
Use this function to change the 3D coordinates corresponding to this track
| newPoint | new 3D coordinates | 
Definition at line 178 of file TracksOfPoints.h.
| void OpencvSfM::TrackOfPoints::setColor | ( | unsigned int | c | ) |  [inline] | 
        
Use this function to change the color of this track
| c | new color (ARGB packed into a int) | 
Definition at line 200 of file TracksOfPoints.h.
Referenced by OpencvSfM::SequenceAnalyzer::read().
| DMatch OpencvSfM::TrackOfPoints::toDMatch | ( | const int | img1, | 
| const int | img2 | ||
| ) | const | 
use this function to create a DMatch value from this track
| img1 | train match image | 
| img2 | query match image | 
Definition at line 176 of file TracksOfPoints.cpp.
Referenced by OpencvSfM::EuclideanEstimator::initialReconstruction().
| double OpencvSfM::TrackOfPoints::triangulateLinear | ( | std::vector< PointOfView > & | cameras, | 
| const std::vector< cv::Ptr< PointsToTrack > > & | points_to_track, | ||
| cv::Vec3d & | points3D, | ||
| const std::vector< bool > & | masks = std::vector<bool>( )  | 
        ||
| ) | 
Using cameras and 2D points, try to find the 3D coordinates
| cameras | cameras used to compute projection of 3D point. | 
| points_to_track | 2D points used to compute projection | 
| points3D | 3D coordinates of this tracks | 
| masks | used to knwo which point this function have to use. | 
Definition at line 242 of file TracksOfPoints.cpp.
Referenced by triangulateRobust().
| double OpencvSfM::TrackOfPoints::triangulateRobust | ( | std::vector< PointOfView > & | cameras, | 
| const std::vector< cv::Ptr< PointsToTrack > > & | points_to_track, | ||
| cv::Vec3d & | points3D, | ||
| double | reproj_error = 4,  | 
        ||
| const std::vector< bool > & | masks = std::vector<bool>( )  | 
        ||
| ) | 
Using cameras and 2D points, try to find the best 3D coordinates which minimize the reprojection error using a RANSAC estimation
| cameras | cameras used to compute projection of 3D point. | 
| points_to_track | 2D points used to compute projection | 
| points3D | 3D coordinates of the best estimation | 
| reproj_error | Threshold used to reject outliners | 
| masks | used to knwo which point this function have to use. | 
Definition at line 299 of file TracksOfPoints.cpp.
Referenced by OpencvSfM::StructureEstimator::computeStructure(), and OpencvSfM::StructureEstimator::removeOutliersTracks().
std::vector<bool> OpencvSfM::TrackOfPoints::good_values [protected] | 
        
Sometimes a 2d point is not good... This vector help us to know which points are correct...
Definition at line 36 of file TracksOfPoints.h.
Referenced by addMatch(), containPoint(), removeOutliers(), OpencvSfM::SequenceAnalyzer::removePointsWithoutProjection(), and OpencvSfM::SequenceAnalyzer::write().
int OpencvSfM::TrackOfPoints::track_consistance [protected] | 
        
if <0 the track is inconsistent if >0 represent the degree of consistence ( higher is better )
Definition at line 41 of file TracksOfPoints.h.
Referenced by addMatch(), OpencvSfM::SequenceAnalyzer::read(), and OpencvSfM::SequenceAnalyzer::write().
 1.7.5.1