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::StereoFeatures ( )

Member Function Documentation

◆ calculateDepthInformationBetweenCorrespondences()

void StereoFeatures::calculateDepthInformationBetweenCorrespondences ( StereoFeatureArray stereo_features = NULL)

◆ calculateInterFrameCorrespondences() [1/2]

void StereoFeatures::calculateInterFrameCorrespondences ( const StereoFeatureArray frame1,
const StereoFeatureArray frame2,
int  filterMethod 
)

calculate the relation between two stereo pairs

◆ calculateInterFrameCorrespondences() [2/2]

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 
)

◆ crossCheckMatching() [1/2]

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.

◆ crossCheckMatching() [2/2]

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

◆ findFeatures()

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 
)

◆ findFeatures2()

void StereoFeatures::findFeatures2 ( const cv::Mat &  image,
FeatureInfo info,
bool  left_frame = true,
int  crop_left = 0,
int  crop_right = 0 
)
protected

◆ findFeatures_threading()

void StereoFeatures::findFeatures_threading ( const cv::Mat &  image,
FeatureInfo info,
bool  left_frame = true,
int  crop_left = 0,
int  crop_right = 0 
)
protected

◆ getDebugImage()

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.

◆ getFeatureInfoLeft()

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

Get the result of the last feature extraction, left

◆ getFeatureInfoRight()

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

Get the result of the last feature extraction, left

◆ getHomography()

cv::Mat stereo::StereoFeatures::getHomography ( )
inline

◆ getInterFrameCorrespondences()

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()

◆ getInterFrameCorrespondenceTransform()

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.

◆ getInterFrameDebugImage()

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.

◆ getPutativeStereoCorrespondences()

bool StereoFeatures::getPutativeStereoCorrespondences ( )

◆ getStereoFeatures()

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

Get the result of the last stereo image processing step.

◆ initDetector()

void StereoFeatures::initDetector ( size_t  lastNumFeatures)
protected

◆ processFramePair()

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.

◆ refineFeatureCorrespondences()

bool StereoFeatures::refineFeatureCorrespondences ( )

◆ setCalibration()

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

Set the calibration parameters for the stereo camera setup.

◆ setConfiguration()

void StereoFeatures::setConfiguration ( const FeatureConfiguration config)

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

◆ setDetectorConfiguration()

void StereoFeatures::setDetectorConfiguration ( const DetectorConfiguration detector_config)

Set the configuration for the feature detector

◆ setDistanceImages()

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

◆ calib

frame_helper::StereoCalibrationCv stereo::StereoFeatures::calib
protected

◆ config

FeatureConfiguration stereo::StereoFeatures::config
protected

◆ correspondences

std::vector<std::pair<long,long> > stereo::StereoFeatures::correspondences
protected

◆ correspondenceTransform

base::Affine3d stereo::StereoFeatures::correspondenceTransform
protected

◆ debugImage

cv::Mat stereo::StereoFeatures::debugImage
protected

◆ debugRightOffset

int stereo::StereoFeatures::debugRightOffset
protected

◆ descriptorExtractor

cv::Ptr<cv::DescriptorExtractor> stereo::StereoFeatures::descriptorExtractor
protected

◆ descriptorMatcher

cv::Ptr<cv::DescriptorMatcher> stereo::StereoFeatures::descriptorMatcher
protected

◆ descriptors_gpu_left

cv::gpu::GpuMat stereo::StereoFeatures::descriptors_gpu_left
protected

◆ descriptors_gpu_right

cv::gpu::GpuMat stereo::StereoFeatures::descriptors_gpu_right
protected

◆ detector

cv::Ptr<cv::FeatureDetector> stereo::StereoFeatures::detector
protected

◆ detectorParams

DetectorConfiguration stereo::StereoFeatures::detectorParams
protected

◆ dist_left

const base::samples::DistanceImage* stereo::StereoFeatures::dist_left
protected

◆ dist_right

const base::samples::DistanceImage * stereo::StereoFeatures::dist_right
protected

◆ homography

cv::Mat stereo::StereoFeatures::homography
protected

◆ leftFeatures

FeatureInfo stereo::StereoFeatures::leftFeatures
protected

◆ leftMatches

FeatureInfo stereo::StereoFeatures::leftMatches
protected

◆ leftPutativeMatches

FeatureInfo stereo::StereoFeatures::leftPutativeMatches
protected

◆ rightFeatures

FeatureInfo stereo::StereoFeatures::rightFeatures
protected

◆ rightMatches

FeatureInfo stereo::StereoFeatures::rightMatches
protected

◆ rightPutativeMatches

FeatureInfo stereo::StereoFeatures::rightPutativeMatches
protected

◆ stereoFeatures

StereoFeatureArray stereo::StereoFeatures::stereoFeatures
protected

◆ use_gpu_detector

bool stereo::StereoFeatures::use_gpu_detector
protected

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