libstereo-odometry (C++ Library for robust Stereo odometry)
|
#include <libstereo-odometry.h>
Classes | |
struct | TDetectParams |
struct | TGeneralParams |
struct | TGUIParams |
struct | TImagePairData |
struct | TInfoForTheGUI |
struct | TInterFrameMatchingParams |
struct | TLeastSquaresParams |
struct | TLeftRightMatchParams |
struct | TRectifyParams |
struct | TStereoOdometryRequest |
struct | TStereoOdometryResult |
struct | TTrackedPixels |
struct | TTrackingData |
Public Member Functions | |
CStereoOdometryEstimator () | |
~CStereoOdometryEstimator () | |
void | enable_time_profiler (bool enable=true) |
mrpt::utils::CTimeLogger & | get_time_profiler () |
void | setVerbosityLevel (int level) |
int | getFASTThreshold () |
void | setFASTThreshold (int value) |
void | resetFASTThreshold () |
bool | isFASTThMin () |
bool | isFASTThMax () |
int | getORBThreshold () |
void | setORBThreshold (int value) |
void | resetORBThreshold () |
bool | isORBThMin () |
bool | isORBThMax () |
bool | keyPressedOnGUI () |
Return true if any key was pressed on the GUI window. More... | |
int | getKeyPressedOnGUI () |
void | loadParamsFromConfigFile (const mrpt::utils::CConfigFile &iniFile, const std::vector< std::string > §ions) |
void | loadParamsFromConfigFileName (const std::string &fileName, const std::vector< std::string > §ions) |
void | setThisFrameAsKF () |
void | resetIds () |
void | setIds (const vector< size_t > &ids) |
CImage & | getRefCurrentImageLeft () |
CImage & | getRefCurrentImageRight () |
CImage | getCopyCurrentImageLeft () |
CImage | getCopyCurrentImageRight () |
vector< size_t > & | getRefCurrentIDs (const size_t octave) |
void | getValues (vector< cv::KeyPoint > &leftKP, vector< cv::KeyPoint > &rightKP, cv::Mat &leftDesc, cv::Mat &rightDesc, vector< cv::DMatch > &matches, vector< size_t > &matches_id) |
void | setMaxMatchID (const size_t id) |
Main API methods | |
void | processNewImagePair (TStereoOdometryRequest &request_data, TStereoOdometryResult &result) |
bool | getChangeInPose (const vector_index_pairs_t &tracked_pairs, const vector< cv::DMatch > &pre_matches, const vector< cv::DMatch > &cur_matches, const vector< cv::KeyPoint > &pre_left_feats, const vector< cv::KeyPoint > &pre_right_feats, const vector< cv::KeyPoint > &cur_left_feats, const vector< cv::KeyPoint > &cur_right_feats, const mrpt::utils::TStereoCamera &stereo_camera, TStereoOdometryResult &result, const vector< double > &ini_estimation=vector< double >(6, 0)) |
void | getProjectedCoords (const vector< cv::DMatch > &pre_matches, const vector< cv::KeyPoint > &pre_left_feats, const vector< cv::KeyPoint > &pre_right_feats, const vector< pair< int, float > > &other_matches_tracked, const mrpt::utils::TStereoCamera &stereo_camera, const CPose3D &change_pose, vector< pair< TPixelCoordf, TPixelCoordf > > &pro_pre_feats) |
bool | saveStateToFile (const string &filename) |
bool | loadStateFromFile (const string &filename) |
void | dumpToConsole () |
Private Types | |
typedef stlplus::smart_ptr < TImagePairData > | TImagePairDataPtr |
Private Member Functions | |
void | m_update_indexes (TImagePairData::img_data_t &data, size_t octave, const bool order) |
void | m_featlist_to_kpslist (CStereoOdometryEstimator::TImagePairData::img_data_t &img_data) |
void | m_adaptive_non_max_sup (const size_t &num_out_points, const vector< cv::KeyPoint > &keypoints, const cv::Mat &descriptors, vector< cv::KeyPoint > &out_kp_rad, cv::Mat &out_kp_desc, const double &min_radius_th=0) |
void | m_non_max_sup (const size_t &num_out_points, const vector< cv::KeyPoint > &keypoints, const cv::Mat &descriptors, vector< cv::KeyPoint > &out_kp_rad, cv::Mat &out_kp_desc, const size_t &imgH, const size_t &imgW, vector< bool > &survivors) |
void | m_non_max_sup (const vector< cv::KeyPoint > &keypoints, vector< bool > &survivors, const size_t &imgH, const size_t &imgW, const size_t &num_out_points) const |
bool | m_evalRGN (const TKeyPointList &list1_l, const TKeyPointList &list1_r, const TKeyPointList &list2_l, const TKeyPointList &list2_r, const vector< bool > &mask, const vector< TPoint3D > &lmks, const vector< double > &deltaPose, const mrpt::utils::TStereoCamera &stereoCam, Eigen::MatrixXd &out_newPose, Eigen::MatrixXd &out_gradient, vector< double > &out_residual, double &out_cost, VOErrorCode &out_error_code) |
void | m_pinhole_stereo_projection (const vector< TPoint3D > &lmks, const TStereoCamera &cam, const vector< double > &delta_pose, vector< pair< TPixelCoordf, TPixelCoordf > > &out_pixels, vector< Eigen::MatrixXd > &out_jacobian) |
bool | m_dump_keypoints_to_stream (std::ofstream &stream, const vector< cv::KeyPoint > &keypoints, const cv::Mat &descriptors) |
bool | m_dump_matches_to_stream (std::ofstream &stream, const vector< cv::DMatch > &matches, const vector< size_t > &matches_ids) |
bool | m_load_keypoints_from_stream (std::ifstream &stream, vector< cv::KeyPoint > &keypoints, cv::Mat &descriptors) |
bool | m_load_matches_from_stream (std::ifstream &stream, vector< cv::DMatch > &matches, vector< size_t > &matches_ids) |
bool | m_jacobian_is_good (Eigen::MatrixXd &jacobian) |
void | m_filter_by_fundmatrix (const vector< cv::Point2f > &prevPts, const vector< cv::Point2f > &nextPts, vector< uchar > &status) const |
void | stage1_prepare_rectify (TStereoOdometryRequest &in_imgs, TImagePairData &out_imgpair) |
void | stage2_detect_features (TImagePairData::img_data_t &img_data, mrpt::utils::CImage &gui_image, bool update_dyn_thresholds=false) |
void | stage3_match_left_right (CStereoOdometryEstimator::TImagePairData &imgpair, const TStereoCamera &stereoCamera) |
void | stage4_track (TTrackingData &out_tracked_feats, TImagePairData &prev_imgpair, TImagePairData &cur_imgpair) |
void | stage5_optimize (TTrackingData &out_tracked_feats, const mrpt::utils::TStereoCamera &stereoCam, TStereoOdometryResult &result, const vector< double > &initial_estimation=vector< double >(6, 0)) |
Private Attributes | |
mrpt::utils::CTimeLogger | m_profiler |
size_t | m_lastID |
Identificator of the last tracked feature. More... | |
size_t | m_num_tracked_pairs_from_last_kf |
size_t | m_num_tracked_pairs_from_last_frame |
size_t | m_last_kf_max_id |
Maximum ID of a match belonging to certain frame defined as 'KF'. More... | |
bool | m_reset |
vector< vector< size_t > > | m_kf_ids |
size_t | m_last_match_ID |
Identificator of the last match ID. More... | |
size_t | m_kf_max_match_ID |
int | m_current_fast_th |
int | m_current_orb_th |
bool | m_error_in_tracking |
VOErrorCode | m_error |
int | m_verbose_level |
0: None (only critical msgs), 1: verbose, 2:even more verbose More... | |
unsigned int | m_it_counter |
Iteration counter. More... | |
vector< double > | m_last_computed_pose |
TImagePairDataPtr | m_current_imgpair |
TImagePairDataPtr | m_prev_imgpair |
mrpt::vision::CStereoRectifyMap | m_stereo_rectifier |
std::vector< int > | m_threshold |
GUI stuff | |
mrpt::system::TThreadHandle | m_thread_gui |
bool | m_threads_must_close |
set to true at destruction to signal all threads that they must end. More... | |
int | m_win_keyhit |
TInfoForTheGUI * | m_next_gui_info |
TInfoForTheGUI | m_gui_info_cache [2] |
We only need two instances of this struct at once: one for writing the new data, and the "final" one sent to the GUI thread. More... | |
int | m_gui_info_cache_next_index |
Will alternate between 0 and 1. More... | |
TInfoForTheGUI * | m_gui_info |
mrpt::synch::CCriticalSection | m_gui_info_cs |
void | thread_gui () |
The main class of libstereo-odometry: it implements the Stereo Odometry problem and holds all the related options and parameters.
rso::CStereoOdometryEstimator::CStereoOdometryEstimator | ( | ) |
Default constructor
rso::CStereoOdometryEstimator::~CStereoOdometryEstimator | ( | ) |
Destructor: close windows & clean up
|
inline |
|
inline |
Enable or disables time profiling of all operations (default=enabled), which will be reported upon destruction
|
inline |
Access to the time profiler
bool rso::CStereoOdometryEstimator::getChangeInPose | ( | const vector_index_pairs_t & | tracked_pairs, |
const vector< cv::DMatch > & | pre_matches, | ||
const vector< cv::DMatch > & | cur_matches, | ||
const vector< cv::KeyPoint > & | pre_left_feats, | ||
const vector< cv::KeyPoint > & | pre_right_feats, | ||
const vector< cv::KeyPoint > & | cur_left_feats, | ||
const vector< cv::KeyPoint > & | cur_right_feats, | ||
const mrpt::utils::TStereoCamera & | stereo_camera, | ||
TStereoOdometryResult & | result, | ||
const vector< double > & | ini_estimation = vector< double >(6, 0) |
||
) |
this custom method gets info from two different frames and computes the change in pose between them
|
inline |
|
inline |
|
inline |
Sets and gets FAST detector threshold (within ORB)
int rso::CStereoOdometryEstimator::getKeyPressedOnGUI | ( | ) |
Return the key code of the last key pressed on the GUI window: ==0: means no key pressed on window; >0: is the key code, -1: the window was closed by the user.
|
inline |
Sets and gets ORB matching threshold
void rso::CStereoOdometryEstimator::getProjectedCoords | ( | const vector< cv::DMatch > & | pre_matches, |
const vector< cv::KeyPoint > & | pre_left_feats, | ||
const vector< cv::KeyPoint > & | pre_right_feats, | ||
const vector< pair< int, float > > & | other_matches_tracked, | ||
const mrpt::utils::TStereoCamera & | stereo_camera, | ||
const CPose3D & | change_pose, | ||
vector< pair< TPixelCoordf, TPixelCoordf > > & | pro_pre_feats | ||
) |
|
inline |
|
inline |
|
inline |
|
inline |
Returns copies to the inner structures
|
inline |
|
inline |
|
inline |
|
inline |
bool rso::CStereoOdometryEstimator::keyPressedOnGUI | ( | ) |
Return true if any key was pressed on the GUI window.
|
inline |
Loads configuration from an INI file Sections must be (in this order) related to: RECTIFY, DETECT, MATCH, IF-MATCH, LEAST_SQUARES, GUI, GENERAL
|
inline |
Loads configuration from an INI file from its name
bool rso::CStereoOdometryEstimator::loadStateFromFile | ( | const string & | filename | ) |
|
private |
Performs adaptive non maximal suppression for the detected features
|
private |
Saves a vector of keypoints to a strem
|
private |
Saves the matche sto a strem
|
private |
Performs one iteration of a robust Gauss-Newton minimization for the visual odometry
|
private |
Updates the row index matrix
|
private |
|
inlineprivate |
|
private |
|
private |
|
private |
Performs non maximal suppression for the detected features
|
private |
Performs non maximal suppression for the detected features without taking into account the descriptors (auxiliary method)
|
private |
|
private |
Updates the row index matrix
void rso::CStereoOdometryEstimator::processNewImagePair | ( | TStereoOdometryRequest & | request_data, |
TStereoOdometryResult & | result | ||
) |
The main entry point: process a new pair of images and returns the estimated camera pose increment.
|
inline |
|
inline |
|
inline |
bool rso::CStereoOdometryEstimator::saveStateToFile | ( | const string & | filename | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Sets/resets the match IDs generator
|
inline |
Changes the verbosity level: 0=None (only critical msgs), 1=verbose, 2=so verbose you'll have to say "Stop!"
|
private |
Stage1 operations:
|
private |
Stage2 operations:
|
private |
Stage3 operations:
|
private |
Stage4 operations:
|
private |
Stage5 operations:
|
private |
The thread for updating the GUI
|
private |
|
private |
At any time step, the current (latest) and previous pair of stereo images, already processed as pyramids, detectors.
|
private |
|
private |
|
private |
|
private |
This variable is set by processNewImagePair()
|
private |
We only need two instances of this struct at once: one for writing the new data, and the "final" one sent to the GUI thread.
|
private |
Will alternate between 0 and 1.
|
private |
|
private |
Iteration counter.
|
private |
|
private |
|
private |
|
private |
Maximum ID of a match belonging to certain frame defined as 'KF'.
|
private |
Identificator of the last match ID.
|
private |
Identificator of the last tracked feature.
|
private |
Each stage may add or modify this struct, which upon complete processing of one iteration, if sent to the GUI thread via m_gui_info
|
private |
|
private |
|
private |
|
mutableprivate |
Profiler for all SRBA operations Enabled by default, can be disabled with enable_time_profiler(false)
|
private |
|
private |
|
private |
|
private |
set to true at destruction to signal all threads that they must end.
|
private |
|
private |
0: None (only critical msgs), 1: verbose, 2:even more verbose
|
private |
==0: means no key pressed on window; >0: is the key code, -1: the window was closed by the user.
TDetectParams rso::CStereoOdometryEstimator::params_detect |
TGeneralParams rso::CStereoOdometryEstimator::params_general |
TGUIParams rso::CStereoOdometryEstimator::params_gui |
TInterFrameMatchingParams rso::CStereoOdometryEstimator::params_if_match |
TLeastSquaresParams rso::CStereoOdometryEstimator::params_least_squares |
TLeftRightMatchParams rso::CStereoOdometryEstimator::params_lr_match |
TRectifyParams rso::CStereoOdometryEstimator::params_rectify |
Different parameters for the SRBA methods