29 #include <opencv2/opencv.hpp>
30 #include <opencv2/core/version.hpp>
31 #if CV_MAJOR_VERSION < 3 // OpenCV < 3.0.0
32 #include <opencv2/highgui/highgui.hpp>
33 #include <opencv2/imgproc/imgproc.hpp>
34 #include <opencv2/features2d/features2d.hpp>
35 #else // OpenCV >= 3.0.0
36 #include <opencv2/highgui.hpp>
37 #include <opencv2/imgproc.hpp>
38 #include <opencv2/features2d.hpp>
65 #include <mrpt/version.h>
66 #if MRPT_VERSION>=0x130
67 # include <mrpt/obs/CObservationStereoImages.h>
69 # include <mrpt/slam/CObservationStereoImages.h>
73 #define SQUARE(_X) _X*_X
74 #define INVALID_IDX -1
75 #define DUMP_BOOL_VAR(_B) _B ? cout << "Yes" : cout << "No"; cout << endl;
76 #define SHOW_WARNING(MSG) cout << "[Visual Odometry] " << MSG << endl;
77 #define DUMP_VO_ERROR_CODE( _CODE ) \
78 cout << "[sVO] ERROR: "; \
79 switch( _CODE ) { case voecBadCondNumber : cout << "(LS) Bad Condition Number" << endl; break; \
80 case voecIncrFuncCostStg1 : cout << "(LS) (Initial) Function cost increased too many times" << endl; break; \
81 case voecIncrFuncCostStg2 : cout << "(LS) (Final) Function cost increased too many times" << endl; break; \
82 case voecFirstIteration : cout << "First iteration, no change in pose can be computed" << endl; break; \
83 case voecBadTracking : cout << "Number of tracked features is low " << endl; break; \
84 case voecNone : default : cout << "None" << endl; break; }
85 #define DUMP_VECTOR(_V) \
86 for(size_t k = 0; k < _V.size()-1; ++k) \
87 cout << _V[k] << ","; \
88 cout << _V[_V.size()-1] << endl;
94 using namespace mrpt::vision;
95 using namespace mrpt::utils;
96 using namespace mrpt::math;
97 using namespace mrpt::poses;
98 using namespace mrpt::system;
100 #if MRPT_VERSION>=0x130
102 using mrpt::obs::CObservationStereoImagesPtr;
104 using mrpt::slam::CObservationStereoImages;
105 using mrpt::slam::CObservationStereoImagesPtr;
114 KpRadiusSorter(
const std::vector<double> & radius_data ) : m_radius_data( radius_data ) { }
115 bool operator() (
size_t k1,
size_t k2 )
const {
116 return ( m_radius_data[k1] > m_radius_data[k2] );
120 struct KpRowSorter :
public std::binary_function<size_t,size_t,bool>
124 bool operator() (
size_t k1,
size_t k2 )
const {
125 return (m_data[k1].pt.y < m_data[k2].pt.y);
135 t_change_in_pose_output() : change_in_pose( mrpt::poses::
CPose3D() ), out_residual( std::vector<double>() ), num_gn_iterations( 0 ), num_gn_final_iterations( 0 ) {}
157 void processNewImagePair(
162 bool getChangeInPose(
164 const vector<cv::DMatch> & pre_matches,
165 const vector<cv::DMatch> & cur_matches,
166 const vector<cv::KeyPoint> & pre_left_feats,
167 const vector<cv::KeyPoint> & pre_right_feats,
168 const vector<cv::KeyPoint> & cur_left_feats,
169 const vector<cv::KeyPoint> & cur_right_feats,
172 const vector<double> & ini_estimation = vector<double>(6,0) );
175 void getProjectedCoords(
176 const vector<cv::DMatch> & pre_matches,
177 const vector<cv::KeyPoint> & pre_left_feats,
178 const vector<cv::KeyPoint> & pre_right_feats,
179 const vector< pair<int,float> > & other_matches_tracked,
182 vector< pair<TPixelCoordf,TPixelCoordf> > & pro_pre_feats );
184 bool saveStateToFile(
const string & filename );
185 bool loadStateFromFile(
const string & filename );
189 cout <<
"---------------------------------------------------------" << endl;
190 cout <<
" Visual Odometry parameters" << endl;
191 cout <<
"---------------------------------------------------------" << endl;
192 params_general.dumpToConsole();
193 params_rectify.dumpToConsole();
194 params_detect.dumpToConsole();
195 params_lr_match.dumpToConsole();
196 params_least_squares.dumpToConsole();
197 params_gui.dumpToConsole();
225 use_precomputed_data(false),
226 precomputed_left_feats(NULL),
227 precomputed_right_feats(NULL),
228 precomputed_left_desc(NULL),
229 precomputed_right_desc(NULL),
230 precomputed_matches(NULL),
231 precomputed_matches_ID(NULL),
246 tracked_feats_from_last_frame;
253 outliers(vector<size_t>()),
254 out_residual(vector<double>()),
259 tracked_feats_from_last_KF(0),
260 tracked_feats_from_last_frame(0),
277 cout <<
" [GENERAL] Track the IDs of the matches?: "; vo_use_matches_ids ? cout <<
"Yes" : cout <<
"No"; cout << endl;
278 cout <<
" [GENERAL] Save information files?: "; vo_save_files ? cout <<
"Yes" : cout <<
"No"; cout << endl;
279 cout <<
" [GENERAL] Debug?: "; vo_debug ? cout <<
"Yes" : cout <<
"No"; cout << endl;
280 cout <<
" [GENERAL] Pause after each iteration?: "; vo_pause_it ? cout <<
"Yes" : cout <<
"No"; cout << endl;
281 cout <<
" [GENERAL] Output directory: " << vo_out_dir << endl;
287 MRPT_TODO(
"Set default values for these parameters and check unused ones")
288 MRPT_TODO(
"Implement fundamental matrix rejection for IF matches")
291 enum TIFMMethod {ifmDescBF = 0, ifmDescWin, ifmSAD, ifmOpticalFlow };
335 cout <<
" [LS] Use Robust Kernel?: "; use_robust_kernel ? cout <<
"Yes" : cout <<
"No"; cout << endl;
336 if( use_robust_kernel ) cout <<
" [LS] Robust kernel param: " << kernel_param << endl;
338 cout <<
" [LS] Use previous estimated pose as initial pose?: "; use_previous_pose_as_initial ? cout <<
"Yes" : cout <<
"No"; cout << endl;
340 cout <<
" [LS] Initial maximum number of iterations: " << initial_max_iters << endl;
341 cout <<
" [LS] Final maximum number of iterations: " << max_iters << endl;
342 cout <<
" [LS] Minimum modulus of the step output vector to continue iterating: " << min_mod_out_vector << endl;
343 cout <<
" [LS] Maximum allowed number of times the cost can grow: " << max_incr_cost << endl;
345 cout <<
" [LS] STD noise for the feature coordinates: " << std_noise_pixels << endl;
346 cout <<
" [LS] Residual threshold for detecting outliers: " << residual_threshold << endl;
348 cout <<
" [LS] Minimum number of tracked features to yield a tracking error: " << bad_tracking_th << endl;
360 cout <<
" [RECTIFY] Number of octaves: " << nOctaves << endl;
375 cout <<
" [GUI] Show GUI?: "; show_gui ? cout <<
"Yes" : cout <<
"No"; cout << endl;
376 cout <<
" [GUI] Draw Raw Features?: "; draw_all_raw_feats ? cout <<
"Yes" : cout <<
"No"; cout << endl;
377 cout <<
" [GUI] Draw Stereo Matches?: "; draw_lr_pairings ? cout <<
"Yes" : cout <<
"No"; cout << endl;
378 cout <<
" [GUI] Draw Tracked Matches?: "; draw_tracking ? cout <<
"Yes" : cout <<
"No"; cout << endl;
388 enum TDMethod { dmORB, dmFAST_ORB, dmFASTER, dmKLT };
413 cout <<
" [DETECT] Detection method: ";
414 switch( detect_method )
416 case dmFASTER : cout <<
"FASTER" << endl;
break;
418 cout <<
"ORB" << endl;
419 cout <<
" [DETECT] Number of desired ORB features: " << orb_nfeats << endl;
420 cout <<
" [DETECT] Number of desired ORB levels in scale space: " << orb_nlevels << endl;
421 cout <<
" [DETECT] Minimum ORB (Harris) response to consider a feature: " << minimum_ORB_response << endl;
422 cout <<
" [DETECT] FAST threshold limits: " << fast_min_th <<
":" << fast_max_th << endl;
425 cout <<
"FAST + ORB" << endl;
426 cout <<
" [DETECT] Desired number of features per square pixel: " << target_feats_per_pixel << endl;
427 cout <<
" [DETECT] Initial FAST threshold: " << initial_FAST_threshold << endl;
428 cout <<
" [DETECT] FAST threshold limits: " << fast_min_th <<
":" << fast_max_th << endl;
429 cout <<
" [DETECT] Window for the KLT response evaluation: " << KLT_win << endl;
430 cout <<
" [DETECT] Minimum KLT response to consider a feature: " << minimum_KLT_response << endl;
433 cout <<
"KLT" << endl;
434 cout <<
" [DETECT] Minimum KLT response to consider a feature: " << minimum_KLT_response << endl;
437 cout <<
" [DETECT] Perform Non Maximal Suppression (NMS)?: ";
439 cout <<
" [DETECT] NMS Method: ";
442 case nmsmStandard : cout <<
"Standard" << endl;
break;
443 case nmsmAdaptive : cout <<
"Adaptive" << endl;
break;
445 cout <<
" [DETECT] Allowed minimum distance between features: " << min_distance << endl;
473 cout <<
" [MATCH] Method: ";
474 switch( match_method )
477 cout <<
"SAD" << endl;
478 cout <<
" [MATCH] Maximum Sum of Absolute Differences (SAD): " << sad_max_distance << endl;
479 cout <<
" [MATCH] Maximum SAD ratio: " << sad_max_ratio << endl;
482 cout <<
"Descriptor (Brute-force)" << endl;
483 cout <<
" [MATCH] Maximum ORB distance: " << orb_max_distance << endl;
484 cout <<
" [MATCH] ORB distance limits: " << orb_min_th <<
"/" << orb_max_th << endl;
487 cout <<
"Descriptor (Row-by-row) -- requires row-ordered keypoint vector (from top to bottom)" << endl;
488 cout <<
" [MATCH] Maximum ORB distance: " << orb_max_distance << endl;
489 cout <<
" [MATCH] ORB distance limits: " << orb_min_th <<
"/" << orb_max_th << endl;
492 cout <<
" [MATCH] Enable robust 1 to 1 match?: ";
494 cout <<
" [MATCH] Stereo pair has parallel optical axes?: ";
496 if( rectified_images ) cout <<
" [MATCH] Maximum 'y' distance allowed between matched features: " << max_y_diff << endl;
497 cout <<
" [MATCH] Min/Max value for the Z coordinate of 3D feature to be considered: " << min_z <<
"/" << max_z << endl;
531 inline void setFASTThreshold(
int value ) { m_current_fast_th = std::min(params_detect.fast_max_th,std::max(params_detect.fast_min_th,value)); }
533 inline bool isFASTThMin( ) {
return m_current_fast_th == params_detect.fast_min_th; }
534 inline bool isFASTThMax( ) {
return m_current_fast_th == params_detect.fast_max_th; }
538 inline void setORBThreshold(
int value ) { m_current_orb_th = std::min(params_lr_match.orb_max_th,std::max(params_lr_match.orb_min_th,value)); }
540 inline bool isORBThMin( ) {
return m_current_orb_th == params_lr_match.orb_min_th; }
541 inline bool isORBThMax( ) {
return m_current_orb_th == params_lr_match.orb_max_th; }
543 bool keyPressedOnGUI();
549 int getKeyPressedOnGUI();
558 if( sections[0].
size() > 0 )
559 params_rectify.nOctaves = iniFile.
read_int(sections[0],
"nOctaves", params_rectify.nOctaves,
false);
561 if( sections[1].
size() > 0 )
564 params_detect.detect_method =
static_cast<TDetectParams::TDMethod>( iniFile.
read_int(sections[1],
"detect_method", params_detect.detect_method,
false) );
565 params_detect.min_distance = iniFile.
read_int(sections[1],
"min_distance",params_detect.min_distance,
false);
568 params_detect.target_feats_per_pixel = iniFile.
read_double(sections[1],
"target_feats_per_pixel", params_detect.target_feats_per_pixel,
false);
569 params_detect.initial_FAST_threshold = iniFile.
read_int(sections[1],
"initial_FAST_threshold", params_detect.initial_FAST_threshold,
false);
570 params_detect.fast_min_th = iniFile.
read_int(sections[1],
"fast_min_th",params_detect.fast_min_th,
false);
571 params_detect.fast_max_th = iniFile.
read_int(sections[1],
"fast_max_th",params_detect.fast_max_th,
false);
574 params_detect.KLT_win = iniFile.
read_int(sections[1],
"KLT_win", params_detect.KLT_win,
false);
575 params_detect.minimum_KLT_response = iniFile.
read_double(sections[1],
"minimum_KLT_response", params_detect.minimum_KLT_response,
false);
578 params_detect.orb_nfeats = iniFile.
read_int(sections[1],
"orb_nfeats",params_detect.orb_nfeats,
false);
579 params_detect.orb_nlevels = iniFile.
read_int(sections[1],
"orb_nlevels",params_detect.orb_nlevels,
false);
580 params_detect.minimum_ORB_response = iniFile.
read_double(sections[1],
"minimum_ORB_response", params_detect.minimum_ORB_response,
false);
583 params_detect.non_maximal_suppression = iniFile.
read_bool(sections[1],
"non_maximal_suppression", params_detect.non_maximal_suppression,
false);
587 if( sections[2].
size() > 0 )
591 params_lr_match.max_y_diff = iniFile.
read_double(sections[2],
"max_y_diff", params_lr_match.max_y_diff,
false);
592 params_lr_match.enable_robust_1to1_match = iniFile.
read_bool(sections[2],
"enable_robust_1to1_match", params_lr_match.enable_robust_1to1_match,
false);
593 params_lr_match.rectified_images = iniFile.
read_bool(sections[2],
"rectified_images", params_lr_match.rectified_images,
false);
594 params_lr_match.min_z = iniFile.
read_double(sections[2],
"min_z", params_lr_match.min_z,
false);
595 params_lr_match.max_z = iniFile.
read_double(sections[2],
"max_z", params_lr_match.max_z,
false);
598 params_lr_match.sad_max_ratio = iniFile.
read_double(sections[2],
"sad_max_ratio", params_lr_match.sad_max_ratio,
false);
599 params_lr_match.sad_max_distance = iniFile.
read_int(sections[2],
"sad_max_distance", params_lr_match.sad_max_distance,
false);
602 params_lr_match.orb_min_th = iniFile.
read_int(sections[2],
"orb_min_th", params_lr_match.orb_min_th,
false);
603 params_lr_match.orb_max_th = iniFile.
read_int(sections[2],
"orb_max_th", params_lr_match.orb_max_th,
false);
604 params_lr_match.orb_max_distance = iniFile.
read_double(sections[2],
"orb_max_distance", params_lr_match.orb_max_distance,
false);
607 if( sections[3].
size() > 0 )
611 params_if_match.filter_fund_matrix = iniFile.
read_bool(sections[3],
"filter_fund_matrix", params_if_match.filter_fund_matrix,
false);
614 params_if_match.ifm_win_h = iniFile.
read_int(sections[3],
"window_height", params_if_match.ifm_win_h,
false);
615 params_if_match.ifm_win_w = iniFile.
read_int(sections[3],
"window_width", params_if_match.ifm_win_w,
false);
618 params_if_match.sad_max_ratio = iniFile.
read_double(sections[3],
"sad_max_ratio", params_if_match.sad_max_ratio,
false);
619 params_if_match.sad_max_distance = iniFile.
read_int(sections[3],
"sad_max_distance", params_if_match.sad_max_distance,
false);
622 params_if_match.orb_max_distance = iniFile.
read_double(sections[3],
"orb_max_distance", params_if_match.orb_max_distance,
false);;
625 if( sections[4].
size() > 0 )
628 params_least_squares.std_noise_pixels = iniFile.
read_double(sections[4],
"std_noise_pixels", params_least_squares.std_noise_pixels,
false);
629 params_least_squares.use_previous_pose_as_initial = iniFile.
read_bool(sections[4],
"use_previous_pose_as_initial", params_least_squares.use_previous_pose_as_initial,
false);
631 params_least_squares.initial_max_iters = iniFile.
read_int(sections[4],
"initial_max_iters", params_least_squares.initial_max_iters,
false);
632 params_least_squares.max_iters = iniFile.
read_int(sections[4],
"max_iters", params_least_squares.max_iters,
false);
634 params_least_squares.min_mod_out_vector = iniFile.
read_double(sections[4],
"min_mod_out_vector", params_least_squares.min_mod_out_vector,
false);
635 params_least_squares.max_incr_cost = iniFile.
read_int(sections[4],
"max_incr_cost", params_least_squares.max_incr_cost,
false);
636 params_least_squares.residual_threshold = iniFile.
read_double(sections[4],
"residual_threshold", params_least_squares.residual_threshold,
false);
637 params_least_squares.bad_tracking_th = iniFile.
read_int(sections[4],
"bad_tracking_th", params_least_squares.bad_tracking_th,
false);
640 params_least_squares.use_robust_kernel = iniFile.
read_bool(sections[4],
"use_robust_kernel", params_least_squares.use_robust_kernel,
false);
641 params_least_squares.kernel_param = iniFile.
read_double(sections[4],
"kernel_param", params_least_squares.kernel_param,
false);
644 if( sections[5].
size() > 0 )
646 params_gui.show_gui = iniFile.
read_bool(sections[5],
"show_gui", params_gui.show_gui,
false);
647 params_gui.draw_all_raw_feats = iniFile.
read_bool(sections[5],
"draw_all_raw_feats", params_gui.draw_all_raw_feats,
false);
648 params_gui.draw_lr_pairings = iniFile.
read_bool(sections[5],
"draw_lr_pairings", params_gui.draw_lr_pairings,
false);
649 params_gui.draw_tracking = iniFile.
read_bool(sections[5],
"draw_tracking", params_gui.draw_tracking,
false);
652 if( sections[6].
size() > 0 )
654 params_general.vo_use_matches_ids = iniFile.
read_bool(sections[6],
"vo_use_matches_ids", params_general.vo_use_matches_ids,
false);
655 params_general.vo_save_files = iniFile.
read_bool(sections[6],
"vo_save_files", params_general.vo_save_files,
false);
656 params_general.vo_debug = iniFile.
read_bool(sections[6],
"vo_debug", params_general.vo_debug,
false);
657 params_general.vo_pause_it = iniFile.
read_bool(sections[6],
"vo_pause_it", params_general.vo_pause_it,
false);
658 params_general.vo_out_dir = iniFile.
read_string(sections[6],
"vo_out_dir", params_general.vo_out_dir,
false );
661 resetFASTThreshold();
669 ASSERT_(mrpt::system::fileExists(fileName))
671 loadParamsFromConfigFile(iniFile,sections);
677 ASSERTMSG_(m_current_imgpair,
"[VO Error -- setThisFrameAsKF] Current frame does not exist")
678 ASSERTMSG_(m_current_imgpair->lr_pairing_data.size() > 0,
"[VO Error -- setThisFrameAsKF] No existing lr_pairing_data")
680 const size_t octave = 0;
681 const vector<size_t> & v = m_current_imgpair->lr_pairing_data[octave].matches_IDs;
682 m_last_kf_max_id = *std::max_element(v.begin(),v.end());
685 void inline setIds(
const vector<size_t> & ids ) {
686 if( m_current_imgpair ) {
687 m_current_imgpair->lr_pairing_data[0].matches_IDs.resize(ids.size());
688 std::copy(ids.begin(), ids.end(), m_current_imgpair->lr_pairing_data[0].matches_IDs.begin());
691 m_prev_imgpair->lr_pairing_data[0].matches_IDs.resize(ids.size());
692 std::copy(ids.begin(), ids.end(), m_prev_imgpair->lr_pairing_data[0].matches_IDs.begin());
701 vector<size_t> &
getRefCurrentIDs(
const size_t octave) {
return m_current_imgpair->lr_pairing_data[octave].matches_IDs; }
704 void getValues( vector<cv::KeyPoint> & leftKP, vector<cv::KeyPoint> & rightKP,
705 cv::Mat &leftDesc, cv::Mat &rightDesc,
706 vector<cv::DMatch> & matches,
707 vector<size_t> & matches_id )
709 const size_t octave = 0;
710 leftKP.resize( m_current_imgpair->left.pyr_feats_kps[octave].size() );
711 std::copy( m_current_imgpair->left.pyr_feats_kps[octave].begin(), m_current_imgpair->left.pyr_feats_kps[octave].end(), leftKP.begin() );
713 rightKP.resize( m_current_imgpair->right.pyr_feats_kps[octave].size() );
714 std::copy( m_current_imgpair->right.pyr_feats_kps[octave].begin(), m_current_imgpair->right.pyr_feats_kps[octave].end(), rightKP.begin() );
716 m_current_imgpair->left.pyr_feats_desc[octave].copyTo( leftDesc );
717 m_current_imgpair->right.pyr_feats_desc[octave].copyTo( rightDesc );
719 matches.resize( m_current_imgpair->lr_pairing_data[octave].matches_lr_dm.size() );
720 std::copy( m_current_imgpair->lr_pairing_data[octave].matches_lr_dm.begin(), m_current_imgpair->lr_pairing_data[octave].matches_lr_dm.end(), matches.begin() );
722 matches_id.resize( m_current_imgpair->lr_pairing_data[octave].matches_IDs.size() );
723 std::copy( m_current_imgpair->lr_pairing_data[octave].matches_IDs.begin(), m_current_imgpair->lr_pairing_data[octave].matches_IDs.end(), matches_id.begin() );
761 std::vector<mrpt::vision::TSimpleFeatureList>
pyr_feats;
843 void m_adaptive_non_max_sup(
844 const size_t & num_out_points,
845 const vector<cv::KeyPoint> & keypoints,
846 const cv::Mat & descriptors,
847 vector<cv::KeyPoint> & out_kp_rad,
848 cv::Mat & out_kp_desc,
849 const double & min_radius_th = 0 );
854 const size_t & num_out_points,
855 const vector<cv::KeyPoint> & keypoints,
856 const cv::Mat & descriptors,
857 vector<cv::KeyPoint> & out_kp_rad,
858 cv::Mat & out_kp_desc,
861 vector<bool> & survivors );
866 const vector<cv::KeyPoint> & keypoints,
867 vector<bool> & survivors,
870 const size_t & num_out_points )
const;
879 const vector<bool> & mask,
880 const vector<TPoint3D> & lmks,
881 const vector<double> & deltaPose,
883 Eigen::MatrixXd & out_newPose,
884 Eigen::MatrixXd & out_gradient,
885 vector<double> & out_residual,
889 void m_pinhole_stereo_projection(
890 const vector<TPoint3D> &lmks,
892 const vector<double> &delta_pose,
893 vector< pair<TPixelCoordf,TPixelCoordf> > &out_pixels,
894 vector<Eigen::MatrixXd> &out_jacobian);
898 bool m_dump_keypoints_to_stream(
899 std::ofstream & stream,
900 const vector<cv::KeyPoint> & keypoints,
901 const cv::Mat & descriptors );
904 bool m_dump_matches_to_stream(
905 std::ofstream & stream,
906 const vector<cv::DMatch> & matches,
907 const vector<size_t> & matches_ids );
909 bool m_load_keypoints_from_stream(
910 std::ifstream & stream,
911 vector<cv::KeyPoint> & keypoints,
912 cv::Mat & descriptors );
914 bool m_load_matches_from_stream(
915 std::ifstream & stream,
916 vector<cv::DMatch> & matches,
917 vector<size_t> & matches_ids );
921 for(
int r = 0; r < jacobian.rows(); ++r ) {
922 for(
int c = 0; c < jacobian.cols(); ++c ) {
923 if( mrpt::math::isNaN(jacobian(r,c)) || !mrpt::math::isFinite(jacobian(r,c)) )
930 void m_filter_by_fundmatrix(
931 const vector<cv::Point2f> & prevPts,
932 const vector<cv::Point2f> & nextPts,
933 vector<uchar> & status )
const;
1009 void stage1_prepare_rectify(
1017 void stage2_detect_features(
1020 bool update_dyn_thresholds =
false );
1025 void stage3_match_left_right(
1041 void stage5_optimize(
1045 const vector<double> & initial_estimation = vector<double>(6,0) );
std::vector< cv::KeyPoint > orb_feats
Definition: libstereo-odometry.h:767
bool isORBThMax()
Definition: libstereo-odometry.h:541
void dumpToConsole()
Definition: libstereo-odometry.h:306
CImage & getRefCurrentImageLeft()
Definition: libstereo-odometry.h:696
std::vector< cv::Mat > pyr_feats_desc
ORB Descriptors of the features.
Definition: libstereo-odometry.h:764
cv::Mat orb_desc
Definition: libstereo-odometry.h:768
Definition: libstereo-odometry.h:147
std::vector< size_t > matches_lr_row_index
Definition: libstereo-odometry.h:789
bool enable_robust_1to1_match
Only match if a pair of L/R features have the best match score to each other (default: false) ...
Definition: libstereo-odometry.h:466
CImage getCopyCurrentImageRight()
Definition: libstereo-odometry.h:699
void dumpToConsole()
Definition: libstereo-odometry.h:373
mrpt::synch::CCriticalSection m_gui_info_cs
Definition: libstereo-odometry.h:999
int getORBThreshold()
Definition: libstereo-odometry.h:537
int m_current_fast_th
Definition: libstereo-odometry.h:745
std::vector< cv::DMatch > TDMatchList
Definition: libstereo-odometry.h:109
double minimum_KLT_response
Minimum KLT response to not to discard a feature as being in a textureless zone (Default: 10) ...
Definition: libstereo-odometry.h:397
int KLT_win
Window for the KLT response evaluation (Default: 4)
Definition: libstereo-odometry.h:396
void setThisFrameAsKF()
Definition: libstereo-odometry.h:675
Definition: libstereo-odometry.h:815
bool vo_debug
(def:false) Set/Unset showing application debugging info
Definition: libstereo-odometry.h:271
void resetORBThreshold()
Definition: libstereo-odometry.h:539
void dumpToConsole()
Definition: libstereo-odometry.h:411
unsigned int num_gn_iterations
Definition: libstereo-odometry.h:132
KpRadiusSorter(const std::vector< double > &radius_data)
Definition: libstereo-odometry.h:114
bool isFASTThMax()
Definition: libstereo-odometry.h:534
int ifm_win_w
Definition: libstereo-odometry.h:294
size_t orb_nfeats
Number of features to be detected (only for ORB)
Definition: libstereo-odometry.h:405
double minimum_ORB_response
Minimum ORB response [Harris response] to not to discard a feature as being in a textureless zone (De...
Definition: libstereo-odometry.h:407
#define DUMP_BOOL_VAR(_B)
Definition: libstereo-odometry.h:75
double min_z
Definition: libstereo-odometry.h:469
bool draw_tracking
Default = true.
Definition: libstereo-odometry.h:371
double std_noise_pixels
(def:1) – The standard deviation assumed for feature coordinates (this parameter is only needed to sc...
Definition: libstereo-odometry.h:325
void copyFromForceLoad(const CImage &o)
void dumpToConsole()
Definition: libstereo-odometry.h:471
bool vo_use_matches_ids
(def:false) Set/Unset tracking of the IDs of the matches through time
Definition: libstereo-odometry.h:269
Definition: libstereo-odometry.h:142
CPose3D inc_pose
Definition: libstereo-odometry.h:965
size_t img_w
Definition: libstereo-odometry.h:808
TRectifyParams params_rectify
Definition: libstereo-odometry.h:502
std::string text_msg_from_optimization
Definition: libstereo-odometry.h:964
rso::vector_pixel_pairs_t draw_pairings_all
Definition: libstereo-odometry.h:967
const std::vector< double > & m_radius_data
Definition: libstereo-odometry.h:113
void setIds(const vector< size_t > &ids)
Definition: libstereo-odometry.h:685
stlplus::smart_ptr< TImagePairData > TImagePairDataPtr
Definition: libstereo-odometry.h:813
std::vector< cv::DMatch > orb_matches
Definition: libstereo-odometry.h:802
TSMMethod
Definition: libstereo-odometry.h:454
int initial_FAST_threshold
The initial threshold of the FAST feature detector, which will be dynamically adapted to fulfill targ...
Definition: libstereo-odometry.h:409
vector< size_t > outliers
outliers in each octave after optimization : includes NMS and residual thresholding (idx of current m...
Definition: libstereo-odometry.h:239
TStereoOdometryResult()
Definition: libstereo-odometry.h:251
int getFASTThreshold()
Definition: libstereo-odometry.h:530
bool vo_pause_it
(def:false) Set/Unset pausing the application after each iteration
Definition: libstereo-odometry.h:272
vector< double > m_last_computed_pose
Definition: libstereo-odometry.h:754
Definition: libstereo-odometry.h:387
CObservationStereoImagesPtr stereo_imgs
Definition: libstereo-odometry.h:208
vector< vector< size_t > > * precomputed_matches_ID
Definition: libstereo-odometry.h:218
void resetIds()
Definition: libstereo-odometry.h:684
double sad_max_ratio
The maximum ratio between the two smallest SAD when searching for pairings (Default: 0...
Definition: libstereo-odometry.h:298
void setORBThreshold(int value)
Definition: libstereo-odometry.h:538
Definition: libstereo-odometry.h:313
TInfoForTheGUI * m_next_gui_info
Definition: libstereo-odometry.h:993
std::vector< int > stats_feats_per_octave
Definition: libstereo-odometry.h:958
bool read_bool(const std::string §ion, const std::string &name, bool defaultValue, bool failIfNotFound=false) const
double max_y_diff
Maximum allowed distance in pixels from the same row in the images for corresponding feats...
Definition: libstereo-odometry.h:468
mrpt::utils::CImage img_left
Definition: libstereo-odometry.h:957
size_t m_num_tracked_pairs_from_last_frame
Definition: libstereo-odometry.h:737
mrpt::system::TTimeStamp timestamp
Definition: libstereo-odometry.h:771
size_t m_last_match_ID
Identificator of the last match ID.
Definition: libstereo-odometry.h:741
double residual_threshold
(def:10) – Residual threshold for detecting outliers
Definition: libstereo-odometry.h:327
bool use_robust_kernel
(def:true) – Set/Unset using robust kernel for optimization
Definition: libstereo-odometry.h:319
std::vector< size_t > matches_IDs
Definition: libstereo-odometry.h:794
TDMethod detect_method
Method to detect features (also affects to the matching process)
Definition: libstereo-odometry.h:390
bool isFASTThMin()
Definition: libstereo-odometry.h:533
int orb_min_th
Definition: libstereo-odometry.h:463
string vo_out_dir
(def:'out') Sets the output directory for saving debug files
Definition: libstereo-odometry.h:273
Definition: libstereo-odometry.h:449
struct rso::t_change_in_pose_output t_change_in_pose_output
Definition: libstereo-odometry.h:235
int read_int(const std::string §ion, const std::string &name, int defaultValue, bool failIfNotFound=false) const
std::vector< size_t > orb_matches_ID
Definition: libstereo-odometry.h:805
int m_gui_info_cache_next_index
Will alternate between 0 and 1.
Definition: libstereo-odometry.h:995
Definition: libstereo-odometry.h:142
uint32_t sad_max_distance
The maximum SAD value to consider a pairing as a potential match (Default: ~400)
Definition: libstereo-odometry.h:458
double min_mod_out_vector
(def:0.001) – Minimum modulus of the step output vector to continue iterating (ending condition) ...
Definition: libstereo-odometry.h:324
bool use_precomputed_data
Definition: libstereo-odometry.h:214
TInterFrameMatchingParams params_if_match
Definition: libstereo-odometry.h:505
TLeftRightMatchParams params_lr_match
Definition: libstereo-odometry.h:504
double target_feats_per_pixel
Desired number of features per square pixel (Default: 10/1000)
Definition: libstereo-odometry.h:393
int num_it_final
number of iterations in the two stages of optimization
Definition: libstereo-odometry.h:241
bool draw_all_raw_feats
Default = false.
Definition: libstereo-odometry.h:369
mrpt::system::TThreadHandle m_thread_gui
Definition: libstereo-odometry.h:941
Definition: libstereo-odometry.h:365
double kernel_param
(def:3) – Robust kernel parameter (pseudo-Huber)
Definition: libstereo-odometry.h:320
std::string text_msg_from_conseq_match
Definition: libstereo-odometry.h:963
mrpt::utils::CTimeLogger m_profiler
Definition: libstereo-odometry.h:732
void setVerbosityLevel(int level)
Definition: libstereo-odometry.h:527
std::vector< std::pair< mrpt::utils::TPixelCoord, mrpt::utils::TPixelCoord > > vector_pixel_pairs_t
Definition: libstereo-odometry.h:140
TStereoOdometryRequest()
Definition: libstereo-odometry.h:223
mrpt::poses::CPose3D change_in_pose
Definition: libstereo-odometry.h:130
int m_verbose_level
0: None (only critical msgs), 1: verbose, 2:even more verbose
Definition: libstereo-odometry.h:752
Definition: libstereo-odometry.h:142
TInfoForTheGUI * m_gui_info
Definition: libstereo-odometry.h:998
VOErrorCode
Definition: libstereo-odometry.h:142
Definition: libstereo-odometry.h:954
CImage getCopyCurrentImageLeft()
Definition: libstereo-odometry.h:698
Definition: libstereo-odometry.h:142
size_t bad_tracking_th
(def:5) – Minimum number of tracked features to yield a tracking error
Definition: libstereo-odometry.h:328
vector< pair< size_t, size_t > > detected_feats
number of detected features in each octave : .first (left image) and .second (right image) ...
Definition: libstereo-odometry.h:248
Definition: libstereo-odometry.h:285
void dumpToConsole()
Definition: libstereo-odometry.h:333
vector< TKeyPointList > * precomputed_right_feats
Definition: libstereo-odometry.h:215
NMSMethod nmsMethod
Method to perform non maximal suppression.
Definition: libstereo-odometry.h:401
Definition: libstereo-odometry.h:949
unsigned int num_gn_final_iterations
Definition: libstereo-odometry.h:133
bool m_threads_must_close
set to true at destruction to signal all threads that they must end.
Definition: libstereo-odometry.h:942
VOErrorCode m_error
Definition: libstereo-odometry.h:749
std::vector< int > stats_FAST_thresholds_per_octave
Definition: libstereo-odometry.h:959
Definition: libstereo-odometry.h:111
mrpt::vision::CStereoRectifyMap m_stereo_rectifier
Definition: libstereo-odometry.h:830
void enable_time_profiler(bool enable=true)
Definition: libstereo-odometry.h:521
Definition: libstereo-odometry.h:266
Definition: libstereo-odometry.h:756
double read_double(const std::string §ion, const std::string &name, double defaultValue, bool failIfNotFound=false) const
vector< size_t > stereo_matches
number of stereo matches in each octave :
Definition: libstereo-odometry.h:249
const TImagePairData * prev_imgpair
Definition: libstereo-odometry.h:818
TDetectParams params_detect
Definition: libstereo-odometry.h:503
bool rectified_images
Indicates if the stereo pair has parallel optical axes.
Definition: libstereo-odometry.h:467
mrpt::utils::CImage img_right
Images to be shown on the left & right panels of the display.
Definition: libstereo-odometry.h:957
double sad_max_ratio
The maximum ratio between the two smallest SAD when searching for pairings (Default: 0...
Definition: libstereo-odometry.h:459
int fast_min_th
Definition: libstereo-odometry.h:408
mrpt::vision::CImagePyramid pyr
Pyramid of grayscale images.
Definition: libstereo-odometry.h:760
bool use_custom_initial_pose
(def:false) – Use the (input) custom initial pose but do not save it for later use (useful when getCh...
Definition: libstereo-odometry.h:330
Definition: libstereo-odometry.h:142
vector< double > out_residual
residual for each observation (tracked match)
Definition: libstereo-odometry.h:240
Definition: libstereo-odometry.h:120
CPose3D outPose
Definition: libstereo-odometry.h:238
bool isORBThMin()
Definition: libstereo-odometry.h:540
void setMaxMatchID(const size_t id)
Definition: libstereo-odometry.h:726
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)
Definition: libstereo-odometry.h:704
vector_index_pairs_t matches_lr
Definition: libstereo-odometry.h:779
size_t initial_max_iters
(def:10) – Maximum number of iterations for the initial stage
Definition: libstereo-odometry.h:323
unsigned int m_it_counter
Iteration counter.
Definition: libstereo-odometry.h:753
#define INVALID_TIMESTAMP
KpRowSorter(const TKeyPointList &data)
Definition: libstereo-odometry.h:123
void setFASTThreshold(int value)
Definition: libstereo-odometry.h:531
img_data_t right
Definition: libstereo-odometry.h:772
const TKeyPointList & m_data
Definition: libstereo-odometry.h:122
TDMethod
Definition: libstereo-odometry.h:388
std::vector< vector_index_pairs_t > tracked_pairs
Definition: libstereo-odometry.h:823
mrpt::utils::TStereoCamera stereo_cam
Definition: libstereo-odometry.h:211
mrpt::utils::CTimeLogger & get_time_profiler()
Definition: libstereo-odometry.h:524
std::vector< TKeyPointList > pyr_feats_kps
Features in each pyramid (keypoint version) <- will substitute [orb_matches].
Definition: libstereo-odometry.h:762
size_t m_lastID
Identificator of the last tracked feature.
Definition: libstereo-odometry.h:733
bool non_maximal_suppression
Enable/disable the non-maximal suppression after the detection (5x5 windows is used) ...
Definition: libstereo-odometry.h:400
TIFMMethod
Definition: libstereo-odometry.h:291
std::vector< cv::KeyPoint > TKeyPointList
Definition: libstereo-odometry.h:108
bool filter_fund_matrix
Whether or not use fundamental matrix to remove outliers between inter-frame matches (unused by now) ...
Definition: libstereo-odometry.h:304
std::vector< std::pair< size_t, size_t > > vector_index_pairs_t
Definition: libstereo-odometry.h:139
std::string read_string(const std::string §ion, const std::string &name, const std::string &defaultValue, bool failIfNotFound=false) const
void swap(TInfoForTheGUI &o)
Definition: libstereo-odometry.h:971
vector< vector< size_t > > m_kf_ids
Definition: libstereo-odometry.h:740
TSMMethod match_method
The selected method to perform stereo matching. Compatibility: {smSAD} -> {ORB,KLT,FAST[ER],FAST[ER]+ORB} and {smDescBF,smDescRbR} -> {ORB,FAST[ER]+ORB}.
Definition: libstereo-odometry.h:455
std::vector< img_pairing_data_t > lr_pairing_data
Definition: libstereo-odometry.h:799
mrpt::utils::TPixelCoord px_pR
Definition: libstereo-odometry.h:951
TLeastSquaresParams params_least_squares
Definition: libstereo-odometry.h:506
std::vector< mrpt::vector_size_t > pyr_feats_index
Index of feature indices per row.
Definition: libstereo-odometry.h:763
TGeneralParams params_general
Definition: libstereo-odometry.h:508
Definition: libstereo-odometry.h:758
std::string text_msg_from_detect
Definition: libstereo-odometry.h:962
bool m_reset
Definition: libstereo-odometry.h:739
double orb_max_distance
Maximum allowed Hamming distance between a pair of features to be considered a match (unused by now) ...
Definition: libstereo-odometry.h:301
mrpt::system::TTimeStamp timestamp
This is the key field that signals when the whole structure's changed & GUI must be refreshed...
Definition: libstereo-odometry.h:956
bool show_gui
Show GUI? (Default = true)
Definition: libstereo-odometry.h:368
vector< size_t > & getRefCurrentIDs(const size_t octave)
Definition: libstereo-odometry.h:701
bool valid
whether or not the result is valid
Definition: libstereo-odometry.h:243
size_t size(const MATRIXLIKE &m, int dim)
Definition: libstereo-odometry.h:383
void loadParamsFromConfigFile(const mrpt::utils::CConfigFile &iniFile, const std::vector< std::string > §ions)
Definition: libstereo-odometry.h:554
Definition: libstereo-odometry.h:142
std::vector< TTrackedPixels > stats_tracked_feats
Definition: libstereo-odometry.h:960
Definition: libstereo-odometry.h:205
Definition: libstereo-odometry.h:129
std::string text_msg_from_lr_match
Definition: libstereo-odometry.h:961
bool m_error_in_tracking
Definition: libstereo-odometry.h:748
size_t m_last_kf_max_id
Maximum ID of a match belonging to certain frame defined as 'KF'.
Definition: libstereo-odometry.h:738
void dumpToConsole()
Definition: libstereo-odometry.h:275
size_t max_iters
(def:100) – Final maximum number of iterations for the refinement stage
Definition: libstereo-odometry.h:322
void dumpToConsole()
Definition: libstereo-odometry.h:187
TImagePairDataPtr m_prev_imgpair
Definition: libstereo-odometry.h:829
NMSMethod
Definition: libstereo-odometry.h:387
bool repeat
Definition: libstereo-odometry.h:221
vector< cv::Mat > * precomputed_right_desc
Definition: libstereo-odometry.h:216
bool use_previous_pose_as_initial
(def:true) – Use the previous computed pose as the initial one for the next frame ...
Definition: libstereo-odometry.h:329
void loadParamsFromConfigFileName(const std::string &fileName, const std::vector< std::string > §ions)
Definition: libstereo-odometry.h:666
VOErrorCode error_code
error code for the method
Definition: libstereo-odometry.h:244
t_change_in_pose_output()
Definition: libstereo-odometry.h:135
void dumpToConsole()
Definition: libstereo-odometry.h:358
Definition: libstereo-odometry.h:353
std::vector< mrpt::vision::TSimpleFeatureList > pyr_feats
Features in each pyramid.
Definition: libstereo-odometry.h:761
vector< size_t > draw_pairings_ids
Definition: libstereo-odometry.h:968
size_t tracked_feats_from_last_KF
Definition: libstereo-odometry.h:245
TImagePairData()
Definition: libstereo-odometry.h:810
void resetFASTThreshold()
Definition: libstereo-odometry.h:532
int m_current_orb_th
Definition: libstereo-odometry.h:746
std::vector< int > m_threshold
Definition: libstereo-odometry.h:831
uint32_t sad_max_distance
The maximum SAD value to consider a pairing as a potential match (Default: ~200)
Definition: libstereo-odometry.h:297
std::vector< double > out_residual
Definition: libstereo-odometry.h:131
size_t orb_nlevels
The number of pyramid levels.
Definition: libstereo-odometry.h:406
int nOctaves
Number of octaves to create.
Definition: libstereo-odometry.h:356
bool vo_save_files
(def:false) Set/Unset storage of some information of the system in files as the process runs ...
Definition: libstereo-odometry.h:270
double orb_max_distance
Maximum allowed Hamming distance between a pair of features to be considered a match.
Definition: libstereo-odometry.h:462
Definition: libstereo-odometry.h:774
bool m_jacobian_is_good(Eigen::MatrixXd &jacobian)
Definition: libstereo-odometry.h:919
#define ASSERTMSG_(f, __ERROR_MSG)
size_t m_kf_max_match_ID
Definition: libstereo-odometry.h:742
CImage & getRefCurrentImageRight()
Definition: libstereo-odometry.h:697
TIFMMethod ifm_method
Inter-frame matching method.
Definition: libstereo-odometry.h:292
size_t min_distance
The allowed minimun distance between features.
Definition: libstereo-odometry.h:402
bool draw_lr_pairings
Default = false.
Definition: libstereo-odometry.h:370
TGUIParams params_gui
Definition: libstereo-odometry.h:507
TDMatchList matches_lr_dm
Definition: libstereo-odometry.h:784
vector< TDMatchList > * precomputed_matches
Definition: libstereo-odometry.h:217
int m_win_keyhit
Definition: libstereo-odometry.h:947
size_t m_num_tracked_pairs_from_last_kf
Definition: libstereo-odometry.h:736
size_t max_incr_cost
(def:3) – Maximum allowed number of times the cost can grow
Definition: libstereo-odometry.h:326