18 #include <mrpt/otherlibs/do_opencv_includes.h> 32 template <
typename FEATLIST>
33 inline void trackFeatures_checkResponses(FEATLIST &featureList,
const CImage &cur_gray,
const float minimum_KLT_response,
const unsigned int KLT_response_half_win,
const unsigned int max_x,
const unsigned int max_y);
45 const unsigned int x = ft->
x;
46 const unsigned int y = ft->
y;
47 if (
x>KLT_response_half_win &&
y>KLT_response_half_win &&
x<max_x &&
y<max_y)
49 ft->
response = cur_gray.KLT_response(
x,
y,KLT_response_half_win);
52 if (ft->
response<minimum_KLT_response)
65 template <
class FEAT_LIST>
68 if (featureList.empty())
return;
70 typedef typename FEAT_LIST::feature_t::pixel_coord_t pixel_coord_t;
71 const pixel_coord_t half_win =
static_cast<pixel_coord_t
>(KLT_response_half_win);
72 const pixel_coord_t max_x =
static_cast<pixel_coord_t
>(max_x_);
73 const pixel_coord_t max_y =
static_cast<pixel_coord_t
>(max_y_);
75 for (
int N = featureList.size()-1; N>=0 ; --N)
77 typename FEAT_LIST::feature_t & ft = featureList[N];
81 if (ft.pt.x>half_win && ft.pt.y>half_win && ft.pt.x<max_x && ft.pt.y<max_y)
83 ft.response = cur_gray.
KLT_response(ft.pt.x,ft.pt.y,KLT_response_half_win);
86 if (ft.response<minimum_KLT_response)
102 trackFeatures_checkResponses_impl_simple<TSimpleFeatureList>(featureList,cur_gray,minimum_KLT_response,KLT_response_half_win,max_x,max_y);
107 trackFeatures_checkResponses_impl_simple<TSimpleFeaturefList>(featureList,cur_gray,minimum_KLT_response,KLT_response_half_win,max_x,max_y);
111 template <
typename FEATLIST>
125 if (patch_width>0 && patch_height>0)
129 const int offset = (int)patch_width/2;
130 cur_gray.extract_patch(
137 catch (std::exception &)
157 template <
typename FEATLIST>
158 inline void trackFeatures_addNewFeats(FEATLIST &featureList,
const TSimpleFeatureList &new_feats,
const std::vector<size_t> &sorted_indices,
const size_t nNewToCheck,
const size_t maxNumFeatures,
const float minimum_KLT_response_to_add,
const double threshold_sqr_dist_to_add_new,
const size_t patchSize,
const CImage &cur_gray,
TFeatureID &max_feat_ID_at_input);
163 const TImageSize imgSize = cur_gray.getSize();
164 const int offset = (int)patchSize/2 + 1;
165 const int w_off = int(imgSize.
x -
offset);
166 const int h_off = int(imgSize.
y -
offset);
168 for (
size_t i=0;i<nNewToCheck && featureList.size()<maxNumFeatures;i++)
172 if (feat.
response<minimum_KLT_response_to_add)
continue;
174 double min_dist_sqr =
square(10000);
176 if (!featureList.empty())
179 min_dist_sqr = featureList.kdTreeClosestPoint2DsqrError(feat.
pt.x,feat.
pt.y );
183 if (min_dist_sqr>threshold_sqr_dist_to_add_new &&
192 ft->ID = ++max_feat_ID_at_input;
198 ft->patchSize = patchSize;
201 cur_gray.extract_patch(
208 featureList.push_back( ft );
213 template <
class FEAT_LIST>
214 inline void trackFeatures_addNewFeats_simple_list(FEAT_LIST &featureList,
const TSimpleFeatureList &new_feats,
const std::vector<size_t> &sorted_indices,
const size_t nNewToCheck,
const size_t maxNumFeatures,
const float minimum_KLT_response_to_add,
const double threshold_sqr_dist_to_add_new,
const size_t patchSize,
const CImage &cur_gray,
TFeatureID &max_feat_ID_at_input)
218 const int max_manhatan_dist = std::sqrt(2*threshold_sqr_dist_to_add_new);
220 for (
size_t i=0;i<nNewToCheck && featureList.size()<maxNumFeatures;i++)
223 if (feat.
response<minimum_KLT_response_to_add)
break;
226 int manh_dist = std::numeric_limits<int>::max();
227 for (
size_t j=0;j<featureList.size();j++)
230 const int d = std::abs(existing.
pt.x-feat.
pt.x)+std::abs(existing.
pt.y-feat.
pt.y);
234 if (manh_dist<max_manhatan_dist)
238 featureList.push_back_fast(feat.
pt.x,feat.
pt.y);
244 newFeat.
ID = ++max_feat_ID_at_input;
251 const int grid_cell_log2 =
round( std::log(std::sqrt(threshold_sqr_dist_to_add_new)*0.5)/std::log(2.0));
253 int grid_lx = 1+(cur_gray.
getWidth() >> grid_cell_log2);
254 int grid_ly = 1+(cur_gray.
getHeight()>> grid_cell_log2);
258 occupied_sections.
setSize(grid_lx,grid_ly);
259 occupied_sections.
fillAll(
false);
261 for (
size_t i=0;i<featureList.size();i++)
264 const int section_idx_x = feat.
pt.x >> grid_cell_log2;
265 const int section_idx_y = feat.
pt.y >> grid_cell_log2;
267 if (!section_idx_x || !section_idx_y || section_idx_x>=grid_lx-1 || section_idx_y>=grid_ly-1)
271 bool *ptr1 = &occupied_sections.
get_unsafe(section_idx_x-1,section_idx_y-1);
272 bool *ptr2 = &occupied_sections.
get_unsafe(section_idx_x-1,section_idx_y );
273 bool *ptr3 = &occupied_sections.
get_unsafe(section_idx_x-1,section_idx_y+1);
274 ptr1[0]=ptr1[1]=ptr1[2]=
true;
275 ptr2[0]=ptr2[1]=ptr2[2]=
true;
276 ptr3[0]=ptr3[1]=ptr3[2]=
true;
279 for (
size_t i=0;i<nNewToCheck && featureList.size()<maxNumFeatures;i++)
282 if (feat.
response<minimum_KLT_response_to_add)
break;
285 const int section_idx_x = feat.
pt.x >> grid_cell_log2;
286 const int section_idx_y = feat.
pt.y >> grid_cell_log2;
288 if (!section_idx_x || !section_idx_y || section_idx_x>=grid_lx-2 || section_idx_y>=grid_ly-2)
291 if (occupied_sections(section_idx_x,section_idx_y))
295 bool *ptr1 = &occupied_sections.
get_unsafe(section_idx_x-1,section_idx_y-1);
296 bool *ptr2 = &occupied_sections.
get_unsafe(section_idx_x-1,section_idx_y );
297 bool *ptr3 = &occupied_sections.
get_unsafe(section_idx_x-1,section_idx_y+1);
299 ptr1[0]=ptr1[1]=ptr1[2]=
true;
300 ptr2[0]=ptr2[1]=ptr2[2]=
true;
301 ptr3[0]=ptr3[1]=ptr3[2]=
true;
304 featureList.push_back_fast(feat.
pt.x,feat.
pt.y);
310 newFeat.
ID = ++max_feat_ID_at_input;
321 for (
size_t i=0;i<nNewToCheck && featureList.size()<maxNumFeatures;i++)
324 if (feat.
response<minimum_KLT_response_to_add)
break;
327 double min_dist_sqr = std::numeric_limits<double>::max();
329 if (!featureList.empty())
332 min_dist_sqr = kdtree.kdTreeClosestPoint2DsqrError(feat.
pt.x,feat.
pt.y );
336 if (min_dist_sqr>threshold_sqr_dist_to_add_new)
339 featureList.push_back_fast(feat.
pt.x,feat.
pt.y);
340 kdtree.mark_as_outdated();
343 typename FEAT_LIST::feature_t &newFeat = featureList.back();
345 newFeat.ID = ++max_feat_ID_at_input;
358 trackFeatures_addNewFeats_simple_list<TSimpleFeatureList>(featureList,new_feats,sorted_indices,nNewToCheck,maxNumFeatures,minimum_KLT_response_to_add,threshold_sqr_dist_to_add_new,patchSize,cur_gray, max_feat_ID_at_input);
363 trackFeatures_addNewFeats_simple_list<TSimpleFeaturefList>(featureList,new_feats,sorted_indices,nNewToCheck,maxNumFeatures,minimum_KLT_response_to_add,threshold_sqr_dist_to_add_new,patchSize,cur_gray, max_feat_ID_at_input);
368 template <
typename FEATLIST>
370 FEATLIST &trackedFeats,
371 const size_t img_width,
const size_t img_height,
372 const int MIN_DIST_MARGIN_TO_STOP_TRACKING);
374 template <
typename FEATLIST>
376 FEATLIST &trackedFeats,
377 const size_t img_width,
const size_t img_height,
378 const int MIN_DIST_MARGIN_TO_STOP_TRACKING)
380 if (trackedFeats.empty())
return 0;
382 std::vector<size_t> survival_idxs;
383 const size_t N = trackedFeats.size();
386 survival_idxs.reserve(N);
387 for (
size_t i=0;i<N;i++)
389 const typename FEATLIST::feature_t &ft = trackedFeats[i];
395 const int x= ft.pt.x;
396 const int y= ft.pt.y;
397 if (
x<MIN_DIST_MARGIN_TO_STOP_TRACKING ||
y<MIN_DIST_MARGIN_TO_STOP_TRACKING ||
398 x>static_cast<int>(img_width-MIN_DIST_MARGIN_TO_STOP_TRACKING) ||
399 y>
static_cast<int>(img_height-MIN_DIST_MARGIN_TO_STOP_TRACKING))
404 if (!eras) survival_idxs.push_back(i);
408 const size_t N2 = survival_idxs.size();
409 const size_t n_removed = N-N2;
410 for (
size_t i=0;i<N2;i++)
412 if (survival_idxs[i]!=i)
413 trackedFeats[i] = trackedFeats[ survival_idxs[i] ];
415 trackedFeats.resize(N2);
422 const size_t img_width,
const size_t img_height,
423 const int MIN_DIST_MARGIN_TO_STOP_TRACKING)
425 return trackFeatures_deleteOOB_impl_simple_feat<TSimpleFeatureList>(trackedFeats,img_width,img_height,MIN_DIST_MARGIN_TO_STOP_TRACKING);
430 const size_t img_width,
const size_t img_height,
431 const int MIN_DIST_MARGIN_TO_STOP_TRACKING)
433 return trackFeatures_deleteOOB_impl_simple_feat<TSimpleFeaturefList>(trackedFeats,img_width,img_height,MIN_DIST_MARGIN_TO_STOP_TRACKING);
439 const size_t img_width,
const size_t img_height,
440 const int MIN_DIST_MARGIN_TO_STOP_TRACKING)
444 size_t n_removed = 0;
445 while (itFeat!=trackedFeats.
end())
452 const float x= (*itFeat)->x;
453 const float y= (*itFeat)->y;
454 static const float MIN_DIST_MARGIN_TO_STOP_TRACKING = 10;
455 if (
x<MIN_DIST_MARGIN_TO_STOP_TRACKING ||
y<MIN_DIST_MARGIN_TO_STOP_TRACKING ||
456 x>(img_width-MIN_DIST_MARGIN_TO_STOP_TRACKING) ||
457 y>(img_height-MIN_DIST_MARGIN_TO_STOP_TRACKING))
464 itFeat = trackedFeats.
erase(itFeat);
491 template <
typename FEATLIST>
495 FEATLIST &featureList )
497 m_timlog.enter(
"[CGenericFeatureTracker::trackFeatures] Complete iteration");
499 const size_t img_width = new_img.
getWidth();
500 const size_t img_height = new_img.
getHeight();
504 if (!featureList.empty())
505 max_feat_ID_at_input = featureList.getMaxID();
509 m_timlog.enter(
"[CGenericFeatureTracker] Convert grayscale");
514 m_timlog.leave(
"[CGenericFeatureTracker] Convert grayscale");
519 m_newly_detected_feats.clear();
521 m_timlog.enter(
"[CGenericFeatureTracker] trackFeatures_impl");
523 trackFeatures_impl(prev_gray,cur_gray,featureList);
525 m_timlog.leave(
"[CGenericFeatureTracker] trackFeatures_impl");
531 const int check_KLT_response_every = extra_params.getWithDefaultVal(
"check_KLT_response_every",0);
532 const float minimum_KLT_response = extra_params.getWithDefaultVal(
"minimum_KLT_response",5);
533 const unsigned int KLT_response_half_win = extra_params.getWithDefaultVal(
"KLT_response_half_win",4);
535 if (check_KLT_response_every>0 && ++m_check_KLT_counter>=
size_t(check_KLT_response_every))
537 m_timlog.enter(
"[CGenericFeatureTracker] check KLT responses");
538 m_check_KLT_counter = 0;
540 const unsigned int max_x = img_width - KLT_response_half_win;
541 const unsigned int max_y = img_height - KLT_response_half_win;
545 m_timlog.leave(
"[CGenericFeatureTracker] check KLT responses");
554 const bool remove_lost_features = extra_params.getWithDefaultVal(
"remove_lost_features",0)!=0;
556 if (remove_lost_features)
558 m_timlog.enter(
"[CGenericFeatureTracker] removal of OOB");
560 static const int MIN_DIST_MARGIN_TO_STOP_TRACKING = 10;
564 img_width, img_height,
565 MIN_DIST_MARGIN_TO_STOP_TRACKING);
567 m_timlog.leave(
"[CGenericFeatureTracker] removal of OOB");
569 last_execution_extra_info.num_deleted_feats = nRemoved;
573 last_execution_extra_info.num_deleted_feats = 0;
580 const int update_patches_every = extra_params.getWithDefaultVal(
"update_patches_every",0);
582 if (update_patches_every>0 && ++m_update_patches_counter>=
size_t(update_patches_every))
584 m_timlog.enter(
"[CGenericFeatureTracker] update patches");
585 m_update_patches_counter = 0;
590 m_timlog.leave(
"[CGenericFeatureTracker] update patches");
596 const bool add_new_features = extra_params.getWithDefaultVal(
"add_new_features",0)!=0;
597 const double threshold_dist_to_add_new = extra_params.getWithDefaultVal(
"add_new_feat_min_separation",15);
601 if (add_new_features)
603 m_timlog.enter(
"[CGenericFeatureTracker] add new features");
606 if (m_newly_detected_feats.empty())
611 m_newly_detected_feats,
612 m_detector_adaptive_thres );
615 const size_t N = m_newly_detected_feats.size();
617 last_execution_extra_info.raw_FAST_feats_detected = N;
620 const size_t desired_num_features = extra_params.getWithDefaultVal(
"desired_num_features_adapt",
size_t( (img_width*img_height)>>9 ) );
621 updateAdaptiveNewFeatsThreshold(N,desired_num_features);
625 const unsigned int max_x = img_width-KLT_response_half_win;
626 const unsigned int max_y = img_height-KLT_response_half_win;
627 for (
size_t i=0;i<N;i++)
629 const unsigned int x = m_newly_detected_feats[i].pt.x;
630 const unsigned int y = m_newly_detected_feats[i].pt.y;
631 if (
x>KLT_response_half_win &&
y>KLT_response_half_win &&
x<max_x &&
y<max_y)
632 m_newly_detected_feats[i].response = cur_gray.
KLT_response(
x,
y,KLT_response_half_win);
633 else m_newly_detected_feats[i].response = 0;
639 std::vector<size_t> sorted_indices(N);
640 for (
size_t i=0;i<N;i++) sorted_indices[i]=i;
647 const size_t nNewToCheck =
std::min(
size_t(1500), N );
648 const double threshold_sqr_dist_to_add_new =
square(threshold_dist_to_add_new);
649 const size_t maxNumFeatures = extra_params.getWithDefaultVal(
"add_new_feat_max_features",100);
650 const size_t patchSize = extra_params.getWithDefaultVal(
"add_new_feat_patch_size",11);
652 const float minimum_KLT_response_to_add = extra_params.getWithDefaultVal(
"minimum_KLT_response_to_add",10);
655 detail::trackFeatures_addNewFeats(featureList,m_newly_detected_feats,sorted_indices,nNewToCheck,maxNumFeatures,minimum_KLT_response_to_add,threshold_sqr_dist_to_add_new,patchSize,cur_gray,max_feat_ID_at_input);
657 m_timlog.leave(
"[CGenericFeatureTracker] add new features");
660 m_timlog.leave(
"[CGenericFeatureTracker::trackFeatures] Complete iteration");
670 internal_trackFeatures<CFeatureList>(old_img,new_img,featureList);
678 internal_trackFeatures<TSimpleFeatureList>(old_img,new_img,featureList);
686 internal_trackFeatures<TSimpleFeaturefList>(old_img,new_img,featureList);
690 const size_t nNewlyDetectedFeats,
691 const size_t desired_num_features)
693 const size_t hysteresis_min_num_feats = desired_num_features * 0.9;
694 const size_t hysteresis_max_num_feats = desired_num_features * 1.1;
696 if (nNewlyDetectedFeats<hysteresis_min_num_feats)
697 m_detector_adaptive_thres = std::max(2.0,
std::min(m_detector_adaptive_thres-1.0, m_detector_adaptive_thres*0.8));
698 else if (nNewlyDetectedFeats>hysteresis_max_num_feats)
699 m_detector_adaptive_thres = std::max(m_detector_adaptive_thres+1.0, m_detector_adaptive_thres*1.2);
718 for( itLeft = leftList.
begin(), itRight = rightList.
begin(); itLeft != leftList.
end(); )
720 bool delFeat =
false;
721 if( (*itLeft)->x < 0 || (*itLeft)->y < 0 ||
722 (*itRight)->x < 0 || (*itRight)->y < 0 ||
723 fabs( (*itLeft)->y - (*itRight)->y ) > options.
epipolar_TH )
726 std::cout <<
"Bad tracked match:";
727 if( (*itLeft)->x < 0 || (*itLeft)->y < 0 || (*itRight)->x < 0 || (*itRight)->y < 0 )
728 std::cout <<
" Out of bounds: (" << (*itLeft)->x <<
"," << (*itLeft)->y <<
" & (" << (*itRight)->x <<
"," << (*itRight)->y <<
")" << std::endl;
730 if( fabs( (*itLeft)->y - (*itRight)->y ) > options.
epipolar_TH )
731 std::cout <<
" Bad row checking: " << fabs( (*itLeft)->y - (*itRight)->y ) << std::endl;
742 std::cout <<
"Bad tracked match (correlation failed):" <<
" CC Value: " <<
res << std::endl;
749 itLeft = leftList.
erase( itLeft );
750 itRight = rightList.
erase( itRight );
774 double v_mean, v_std;
775 unsigned int count = 0;
777 dist.setSize( feat_list.size(), 1 );
782 for( itPair = feat_list.begin(); itPair != feat_list.end() ; itPair++,
count++ ) {
785 dist(
count, 0 ) = sqrt(
square( itPair->other_x - itPair->this_x ) +
square( itPair->other_y - itPair->this_y ) +
square( itPair->other_z - itPair->this_z ) );
788 dist.meanAndStdAll( v_mean, v_std );
790 cout << endl <<
"*****************************************************" << endl;
791 cout <<
"Mean: " << v_mean <<
" - STD: " << v_std << endl;
792 cout << endl <<
"*****************************************************" << endl;
795 unsigned int idx = 0;
797 for( itPair = feat_list.begin(); itPair != feat_list.end(); idx++)
800 if( fabs( dist(idx,0) - v_mean ) > v_std*numberOfSigmas )
802 cout <<
"Outlier deleted: " << dist( idx, 0 ) <<
" vs " << v_std*numberOfSigmas << endl;
803 itPair = feat_list.erase( itPair );
void trackFeatures_addNewFeats(FEATLIST &featureList, const TSimpleFeatureList &new_feats, const std::vector< size_t > &sorted_indices, const size_t nNewToCheck, const size_t maxNumFeatures, const float minimum_KLT_response_to_add, const double threshold_sqr_dist_to_add_new, const size_t patchSize, const CImage &cur_gray, TFeatureID &max_feat_ID_at_input)
const T & get_unsafe(size_t row, size_t col) const
Fast but unsafe method to read a value from the matrix.
GLuint GLuint GLsizei count
Helper class: KD-tree search class for vector<KeyPoint>: Call mark_as_outdated() to force rebuilding ...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Declares a matrix of booleans (non serializable).
void trackFeatures_updatePatch< TSimpleFeaturefList >(TSimpleFeaturefList &featureList, const CImage &cur_gray)
void trackFeatures(const mrpt::utils::CImage &old_img, const mrpt::utils::CImage &new_img, TSimpleFeatureList &inout_featureList)
Perform feature tracking from "old_img" to "new_img", with a (possibly empty) list of previously trac...
A class for storing images as grayscale or RGB bitmaps.
static void detectFeatures_SSE2_FASTER12(const mrpt::utils::CImage &img, TSimpleFeatureList &corners, const int threshold=20, bool append_to_list=false, uint8_t octave=0, std::vector< size_t > *out_feats_index_by_row=NULL)
Just like detectFeatures_SSE2_FASTER9() for another version of the detector.
size_t trackFeatures_deleteOOB_impl_simple_feat(FEATLIST &trackedFeats, const size_t img_width, const size_t img_height, const int MIN_DIST_MARGIN_TO_STOP_TRACKING)
TFeatureTrackStatus track_status
Status of the feature tracking process (old name: KLT_status)
#define THROW_EXCEPTION(msg)
A pair (x,y) of pixel coordinates (integer resolution).
float epipolar_TH
Epipolar constraint (rows of pixels)
Feature correctly tracked.
void VISION_IMPEXP filterBadCorrsByDistance(mrpt::utils::TMatchingPairList &list, unsigned int numberOfSigmas)
Filter bad correspondences by distance ...
float y
Coordinates in the image.
void keep_min(T &var, const K test_val)
If the second argument is below the first one, set the first argument to this lower value...
TFeatureTrackStatus track_status
Status of the feature tracking process.
T square(const T x)
Inline function for the square of a number.
virtual void trackFeatures_impl(const mrpt::utils::CImage &old_img, const mrpt::utils::CImage &new_img, TSimpleFeaturefList &inout_featureList)
The tracking method implementation, to be implemented in children classes.
void trackFeatures_checkResponses_impl_simple(FEAT_LIST &featureList, const CImage &cur_gray, const float minimum_KLT_response, const unsigned int KLT_response_half_win, const unsigned int max_x_, const unsigned int max_y_)
FAST feature detector, OpenCV's implementation ("Faster and better: A machine learning approach to co...
Inactive (right after detection, and before being tried to track)
A helper struct to sort keypoints by their response: It can be used with these types: ...
This base provides a set of functions for maths stuff.
float KLT_response(const unsigned int x, const unsigned int y, const unsigned int half_window_size) const
Compute the KLT response at a given pixel (x,y) - Only for grayscale images (for efficiency it avoids...
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
void trackFeatures_addNewFeats< TSimpleFeaturefList >(TSimpleFeaturefList &featureList, const TSimpleFeatureList &new_feats, const std::vector< size_t > &sorted_indices, const size_t nNewToCheck, const size_t maxNumFeatures, const float minimum_KLT_response_to_add, const double threshold_sqr_dist_to_add_new, const size_t patchSize, const CImage &cur_gray, TFeatureID &max_feat_ID_at_input)
void trackFeatures_updatePatch< TSimpleFeatureList >(TSimpleFeatureList &featureList, const CImage &cur_gray)
void VISION_IMPEXP openCV_cross_correlation(const mrpt::utils::CImage &img, const mrpt::utils::CImage &patch_img, size_t &x_max, size_t &y_max, double &max_val, int x_search_ini=-1, int y_search_ini=-1, int x_search_size=-1, int y_search_size=-1)
Computes the correlation between this image and another one, encapsulating the openCV function cvMatc...
void updateAdaptiveNewFeatsThreshold(const size_t nNewlyDetectedFeats, const size_t desired_num_features)
Adapts the threshold m_detector_adaptive_thres according to the real and desired number of features j...
void trackFeatures_addNewFeats< TSimpleFeatureList >(TSimpleFeatureList &featureList, const TSimpleFeatureList &new_feats, const std::vector< size_t > &sorted_indices, const size_t nNewToCheck, const size_t maxNumFeatures, const float minimum_KLT_response_to_add, const double threshold_sqr_dist_to_add_new, const size_t patchSize, const CImage &cur_gray, TFeatureID &max_feat_ID_at_input)
Classes for computer vision, detectors, features, etc.
A generic 2D feature from an image, extracted with CFeatureExtraction Each feature may have one or mo...
uint8_t octave
The image octave the image was found in: 0=original image, 1=1/2 image, 2=1/4 image, etc.
iterator erase(const iterator &it)
uint64_t TFeatureID
Definition of a feature ID.
A list of visual features, to be used as output by detectors, as input/output by trackers, etc.
Unable to track this feature (mismatch is too high for the given tracking window: lack of texture...
void VISION_IMPEXP checkTrackedFeatures(CFeatureList &leftList, CFeatureList &rightList, vision::TMatchingOptions options)
Search for correspondences which are not in the same row and deletes them ...
float response
A measure of the "goodness" of the feature (old name: KLT_val)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void trackFeatures_addNewFeats< CFeatureList >(CFeatureList &featureList, const TSimpleFeatureList &new_feats, const std::vector< size_t > &sorted_indices, const size_t nNewToCheck, const size_t maxNumFeatures, const float minimum_KLT_response_to_add, const double threshold_sqr_dist_to_add_new, const size_t patchSize, const CImage &cur_gray, TFeatureID &max_feat_ID_at_input)
void trackFeatures_checkResponses(FEATLIST &featureList, const CImage &cur_gray, const float minimum_KLT_response, const unsigned int KLT_response_half_win, const unsigned int max_x, const unsigned int max_y)
void trackFeatures_addNewFeats_simple_list(FEAT_LIST &featureList, const TSimpleFeatureList &new_feats, const std::vector< size_t > &sorted_indices, const size_t nNewToCheck, const size_t maxNumFeatures, const float minimum_KLT_response_to_add, const double threshold_sqr_dist_to_add_new, const size_t patchSize, const CImage &cur_gray, TFeatureID &max_feat_ID_at_input)
TFeatureID ID
ID of the feature.
size_t trackFeatures_deleteOOB(FEATLIST &trackedFeats, const size_t img_width, const size_t img_height, const int MIN_DIST_MARGIN_TO_STOP_TRACKING)
pixel_coords_t pt
Coordinates in the image.
float response
A measure of the "goodness" of the feature (typically, the KLT_response value)
A structure containing options for the matching.
A simple structure for representing one image feature (without descriptor nor patch) - This is the te...
void trackFeatures_updatePatch< CFeatureList >(CFeatureList &featureList, const CImage &cur_gray)
int round(const T value)
Returns the closer integer (int) to x.
TInternalFeatList::iterator iterator
static CFeaturePtr Create()
float minCC_TH
Minimum Value of the Cross Correlation.
void setSize(size_t row, size_t col, bool zeroNewElements=false)
Changes the size of matrix, maintaining the previous contents.
void trackFeatures_checkResponses< CFeatureList >(CFeatureList &featureList, const CImage &cur_gray, const float minimum_KLT_response, const unsigned int KLT_response_half_win, const unsigned int max_x, const unsigned int max_y)
mrpt::utils::CImage patch
A patch of the image surrounding the feature.
void trackFeatures_checkResponses< TSimpleFeatureList >(TSimpleFeatureList &featureList, const CImage &cur_gray, const float minimum_KLT_response, const unsigned int KLT_response_half_win, const unsigned int max_x, const unsigned int max_y)
Feature fell Out Of Bounds (out of the image limits, too close to image borders)
This class is a "CSerializable" wrapper for "CMatrixFloat".
size_t getWidth() const MRPT_OVERRIDE
Returns the width of the image in pixels.
void trackFeatures_updatePatch(FEATLIST &featureList, const CImage &cur_gray)
size_t trackFeatures_deleteOOB(CFeatureList &trackedFeats, const size_t img_width, const size_t img_height, const int MIN_DIST_MARGIN_TO_STOP_TRACKING)
void trackFeatures_checkResponses< TSimpleFeaturefList >(TSimpleFeaturefList &featureList, const CImage &cur_gray, const float minimum_KLT_response, const unsigned int KLT_response_half_win, const unsigned int max_x, const unsigned int max_y)
void internal_trackFeatures(const mrpt::utils::CImage &old_img, const mrpt::utils::CImage &new_img, FEATLIST &inout_featureList)
Perform feature tracking from "old_img" to "new_img", with a (possibly empty) list of previously trac...
size_t getHeight() const MRPT_OVERRIDE
Returns the height of the image in pixels.
void fillAll(const T &val)