stereo
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
stereo::StereoFeatures Class Reference

#include <sparse_stereo.hpp>

Public Member Functions

 StereoFeatures ()
 
void setCalibration (const frame_helper::StereoCalibration &calib)
 
void setConfiguration (const FeatureConfiguration &config)
 
void setDetectorConfiguration (const DetectorConfiguration &detector_config)
 
void setDistanceImages (const base::samples::DistanceImage *left, const base::samples::DistanceImage *right)
 
void processFramePair (const cv::Mat &left_image, const cv::Mat &right_image, StereoFeatureArray *stereo_features=NULL)
 
StereoFeatureArraygetStereoFeatures ()
 
FeatureInfogetFeatureInfoLeft ()
 
FeatureInfogetFeatureInfoRight ()
 
void calculateInterFrameCorrespondences (const StereoFeatureArray &frame1, const StereoFeatureArray &frame2, int filterMethod)
 
void calculateInterFrameCorrespondences (const cv::Mat &feat1, const std::vector< cv::KeyPoint > &keyp1, const std::vector< Eigen::Vector3d > &points1, const cv::Mat &feat2, const std::vector< cv::KeyPoint > &keyp2, const std::vector< Eigen::Vector3d > &points2, int filterMethod)
 
std::vector< std::pair< long, long > > getInterFrameCorrespondences ()
 
base::Affine3d getInterFrameCorrespondenceTransform ()
 
const cv::Mat & getDebugImage ()
 
cv::Mat getInterFrameDebugImage (const cv::Mat &debug1, const StereoFeatureArray &frame1, const cv::Mat &debug2, const StereoFeatureArray &frame2, std::vector< std::pair< long, long > > *correspondence=NULL)
 
void findFeatures (const cv::Mat &left_image, const cv::Mat &right_image, int use_threading=1, int crop_left=0, int crop_right=0)
 
bool getPutativeStereoCorrespondences ()
 
bool refineFeatureCorrespondences ()
 
void calculateDepthInformationBetweenCorrespondences (StereoFeatureArray *stereo_features=NULL)
 
void crossCheckMatching (const cv::Mat &descriptors1, const cv::Mat &descriptors2, std::vector< cv::DMatch > &filteredMatches12, int knn=1, float distanceFactor=2.0)
 
cv::Mat getHomography ()
 

Protected Member Functions

void initDetector (size_t lastNumFeatures)
 
void findFeatures2 (const cv::Mat &image, FeatureInfo &info, bool left_frame=true, int crop_left=0, int crop_right=0)
 
void findFeatures_threading (const cv::Mat &image, FeatureInfo &info, bool left_frame=true, int crop_left=0, int crop_right=0)
 
void crossCheckMatching (std::vector< std::vector< cv::DMatch > > matches12, std::vector< std::vector< cv::DMatch > > matches21, std::vector< cv::DMatch > &filteredMatches12, int knn=1, float distanceFactor=2.0)
 

Protected Attributes

frame_helper::StereoCalibrationCv calib
 
FeatureConfiguration config
 
DetectorConfiguration detectorParams
 
FeatureInfo leftFeatures
 
FeatureInfo rightFeatures
 
FeatureInfo leftPutativeMatches
 
FeatureInfo rightPutativeMatches
 
FeatureInfo leftMatches
 
FeatureInfo rightMatches
 
StereoFeatureArray stereoFeatures
 
std::vector< std::pair< long, long > > correspondences
 
base::Affine3d correspondenceTransform
 
cv::Ptr< cv::FeatureDetector > detector
 
cv::Ptr< cv::DescriptorExtractor > descriptorExtractor
 
cv::Ptr< cv::DescriptorMatcher > descriptorMatcher
 
cv::Mat homography
 
cv::Mat debugImage
 
int debugRightOffset
 
const base::samples::DistanceImage * dist_left
 
const base::samples::DistanceImage * dist_right
 
bool use_gpu_detector
 
cv::gpu::GpuMat descriptors_gpu_left
 
cv::gpu::GpuMat descriptors_gpu_right
 

Constructor & Destructor Documentation

StereoFeatures::StereoFeatures ( )

Member Function Documentation

void StereoFeatures::calculateDepthInformationBetweenCorrespondences ( StereoFeatureArray stereo_features = NULL)
void StereoFeatures::calculateInterFrameCorrespondences ( const StereoFeatureArray frame1,
const StereoFeatureArray frame2,
int  filterMethod 
)

calculate the relation between two stereo pairs

void StereoFeatures::calculateInterFrameCorrespondences ( const cv::Mat &  feat1,
const std::vector< cv::KeyPoint > &  keyp1,
const std::vector< Eigen::Vector3d > &  points1,
const cv::Mat &  feat2,
const std::vector< cv::KeyPoint > &  keyp2,
const std::vector< Eigen::Vector3d > &  points2,
int  filterMethod 
)
void StereoFeatures::crossCheckMatching ( const cv::Mat &  descriptors1,
const cv::Mat &  descriptors2,
std::vector< cv::DMatch > &  filteredMatches12,
int  knn = 1,
float  distanceFactor = 2.0 
)

perform cross checking to make sure that the nearest neighbour relationship goes both ways. if a knn of greater than 1 is given, a distanceFactor of greater 1.0 will make the matches more robust, by checking against the next nn.

void StereoFeatures::crossCheckMatching ( std::vector< std::vector< cv::DMatch > >  matches12,
std::vector< std::vector< cv::DMatch > >  matches21,
std::vector< cv::DMatch > &  filteredMatches12,
int  knn = 1,
float  distanceFactor = 2.0 
)
protected
void StereoFeatures::findFeatures ( const cv::Mat &  left_image,
const cv::Mat &  right_image,
int  use_threading = 1,
int  crop_left = 0,
int  crop_right = 0 
)
void StereoFeatures::findFeatures2 ( const cv::Mat &  image,
FeatureInfo info,
bool  left_frame = true,
int  crop_left = 0,
int  crop_right = 0 
)
protected
void StereoFeatures::findFeatures_threading ( const cv::Mat &  image,
FeatureInfo info,
bool  left_frame = true,
int  crop_left = 0,
int  crop_right = 0 
)
protected
const cv::Mat& stereo::StereoFeatures::getDebugImage ( )
inline

get the debug image for a stereo pair, if debugImage has been activated in the configuration.

Todo:
generate the image in this function instead through the pipeline. to allow generation based on result types.
FeatureInfo& stereo::StereoFeatures::getFeatureInfoLeft ( )
inline

Get the result of the last feature extraction, left

FeatureInfo& stereo::StereoFeatures::getFeatureInfoRight ( )
inline

Get the result of the last feature extraction, left

cv::Mat stereo::StereoFeatures::getHomography ( )
inline
std::vector<std::pair<long,long> > stereo::StereoFeatures::getInterFrameCorrespondences ( )
inline

Get the correspondences of the last interframe calculation

Returns
- a vector of an std::pair, where first is an index to frame1 and second an index to frame2 as given by the calculateDepthInformationBetweenCorrespondences()
base::Affine3d stereo::StereoFeatures::getInterFrameCorrespondenceTransform ( )
inline

Get the transform calculated at the last interframe correspondence calculation. Only valid if the filter type was set to ISOMETRY and the number of correspondences > 3.

cv::Mat StereoFeatures::getInterFrameDebugImage ( const cv::Mat &  debug1,
const StereoFeatureArray frame1,
const cv::Mat &  debug2,
const StereoFeatureArray frame2,
std::vector< std::pair< long, long > > *  correspondence = NULL 
)

get the debug image for interframe correspondences.

bool StereoFeatures::getPutativeStereoCorrespondences ( )
StereoFeatureArray& stereo::StereoFeatures::getStereoFeatures ( )
inline

Get the result of the last stereo image processing step.

void StereoFeatures::initDetector ( size_t  lastNumFeatures)
protected
void StereoFeatures::processFramePair ( const cv::Mat &  left_image,
const cv::Mat &  right_image,
StereoFeatureArray stereo_features = NULL 
)

Perform the processing on a stereo frame pair. This will perform feature detection, description, matching and filtering based on the configuration given in the configuration class. If the optional last parameter is given, it will not work in class internal storage, but in the storage provided.

bool StereoFeatures::refineFeatureCorrespondences ( )
void StereoFeatures::setCalibration ( const frame_helper::StereoCalibration &  calib)

Set the calibration parameters for the stereo camera setup.

void StereoFeatures::setConfiguration ( const FeatureConfiguration config)

Set the configuration for the stereo processing chain. This will also reset any previous configuration including detector type.

void StereoFeatures::setDetectorConfiguration ( const DetectorConfiguration detector_config)

Set the configuration for the feature detector

void StereoFeatures::setDistanceImages ( const base::samples::DistanceImage *  left,
const base::samples::DistanceImage *  right 
)

optionally set the distance images before each call to process frame pair, in order to perform a perspective undistort of the features before running the descriptor.

Parameters
left- left distance image
right- right distance image

Member Data Documentation

frame_helper::StereoCalibrationCv stereo::StereoFeatures::calib
protected
FeatureConfiguration stereo::StereoFeatures::config
protected
std::vector<std::pair<long,long> > stereo::StereoFeatures::correspondences
protected
base::Affine3d stereo::StereoFeatures::correspondenceTransform
protected
cv::Mat stereo::StereoFeatures::debugImage
protected
int stereo::StereoFeatures::debugRightOffset
protected
cv::Ptr<cv::DescriptorExtractor> stereo::StereoFeatures::descriptorExtractor
protected
cv::Ptr<cv::DescriptorMatcher> stereo::StereoFeatures::descriptorMatcher
protected
cv::gpu::GpuMat stereo::StereoFeatures::descriptors_gpu_left
protected
cv::gpu::GpuMat stereo::StereoFeatures::descriptors_gpu_right
protected
cv::Ptr<cv::FeatureDetector> stereo::StereoFeatures::detector
protected
DetectorConfiguration stereo::StereoFeatures::detectorParams
protected
const base::samples::DistanceImage* stereo::StereoFeatures::dist_left
protected
const base::samples::DistanceImage * stereo::StereoFeatures::dist_right
protected
cv::Mat stereo::StereoFeatures::homography
protected
FeatureInfo stereo::StereoFeatures::leftFeatures
protected
FeatureInfo stereo::StereoFeatures::leftMatches
protected
FeatureInfo stereo::StereoFeatures::leftPutativeMatches
protected
FeatureInfo stereo::StereoFeatures::rightFeatures
protected
FeatureInfo stereo::StereoFeatures::rightMatches
protected
FeatureInfo stereo::StereoFeatures::rightPutativeMatches
protected
StereoFeatureArray stereo::StereoFeatures::stereoFeatures
protected
bool stereo::StereoFeatures::use_gpu_detector
protected

The documentation for this class was generated from the following files: