41 useOriFilter = cfg.read_bool(section,
"useOriFilter",
true,
false);
42 oriThreshold = cfg.read_double(section,
"oriThreshold",0.2,
false);
43 lastSeenThreshold = cfg.read_int(section,
"lastSeenThreshold",10,
false);
44 timesSeenThreshold = cfg.read_int(section,
"timesSeenThreshold",5,
false);
45 minFeaturesToFind = cfg.read_int(section,
"minFeaturesToFind",5,
false);
46 minFeaturesToBeLost = cfg.read_int(section,
"minFeaturesToBeLost",5,
false);
48 useDepthFilter = cfg.read_bool(section,
"useDepthFilter",
true,
false);
50 matchingThreshold = cfg.read_double(section,
"matchingThreshold",1e4,
false);
51 matchingRatioThreshold = cfg.read_double(section,
"matchingRatioThreshold",0.5,
false);
53 lowScl1 = cfg.read_int(section,
"lowScl1",0,
false);
54 lowScl2 = cfg.read_int(section,
"lowScl1",0,
false);
55 highScl1 = cfg.read_int(section,
"highScl1",6,
false);
56 highScl2 = cfg.read_int(section,
"highScl2",6,
false);
58 searchAreaSize = cfg.read_double(section,
"searchAreaSize",20,
false);
68 cfg.
write(section,
"useOriFilter",
"true" );
69 cfg.
write(section,
"oriThreshold", oriThreshold );
72 cfg.
write(section,
"useOriFilter",
"false" );
75 cfg.
write(section,
"useDepthFilter",
"true" );
77 cfg.
write(section,
"useDepthFilter",
"false" );
79 cfg.
write(section,
"matchingThreshold", matchingThreshold );
80 cfg.
write(section,
"matchingRatioThreshold", matchingRatioThreshold );
81 cfg.
write(section,
"lowScl1", lowScl1 );
82 cfg.
write(section,
"lowScl2", lowScl2 );
83 cfg.
write(section,
"highScl1", highScl1 );
84 cfg.
write(section,
"highScl2", highScl2 );
86 cfg.
write(section,
"searchAreaSize", searchAreaSize );
87 cfg.
write(section,
"lastSeenThreshold", lastSeenThreshold );
88 cfg.
write(section,
"timesSeenThreshold", timesSeenThreshold );
89 cfg.
write(section,
"minFeaturesToFind", minFeaturesToFind );
90 cfg.
write(section,
"minFeaturesToBeLost", minFeaturesToBeLost );
98 out.
printf(
"\n----------- [vision::TMultiResDescMatchOptions] ------------ \n");
99 out.
printf(
"Use orientation filter?: ");
103 out.
printf(
"· Orientation threshold: %.1f deg\n",
RAD2DEG(oriThreshold) );
107 out.
printf(
"Use depth filter?: ");
113 out.
printf(
"Lowest scale in list1: %d\n", lowScl1 );
114 out.
printf(
"Highest scale in list1: %d\n", highScl1 );
115 out.
printf(
"Lowest scale in list2: %d\n", lowScl2 );
116 out.
printf(
"Highest scale in list2: %d\n", highScl2 );
118 out.
printf(
"#frames last seen threshold: %d\n", lastSeenThreshold );
119 out.
printf(
"#frames to be stable threshold: %d\n", timesSeenThreshold );
120 out.
printf(
"min. # features in system: %d\n", minFeaturesToFind );
121 out.
printf(
"min. # features to be lost: %d\n", minFeaturesToBeLost );
122 out.
printf(
"Matching threshold: %.2f\n", matchingThreshold );
123 out.
printf(
"Matching ratio threshold: %.2f\n", matchingRatioThreshold );
124 out.
printf(
"Size of the search window: %d px\n", searchAreaSize );
125 out.
printf(
"-------------------------------------------------------- \n");
135 basePSize = cfg.
read_double(section,
"basePSize", 23,
false );
136 comLScl = cfg.
read_int(section,
"comLScl", 0,
false );
137 comHScl = cfg.
read_int(section,
"comHScl", 6,
false );
141 computeDepth = cfg.
read_bool(section,
"computeDepth",
true,
false );
142 blurImage = cfg.
read_bool(section,
"blurImage",
true,
false );
146 baseline = cfg.
read_double(section,
"baseline",0.0,
false);
147 computeHashCoeffs = cfg.
read_bool(section,
"computeHashCoeffs",
false,
false );
150 cfg.
read_vector(section,
"scales",vector<double>(),scales,
false);
151 if(scales.size() < 1)
169 cfg.
write(section,
"basePSize", basePSize);
170 cfg.
write(section,
"comLScl", comLScl );
171 cfg.
write(section,
"comHScl", comHScl );
172 cfg.
write(section,
"sg1", sg1 );
173 cfg.
write(section,
"sg2", sg2 );
174 cfg.
write(section,
"sg3", sg3 );
176 cfg.
write(section,
"computeDepth", computeDepth ?
"true" :
"false" );
177 cfg.
write(section,
"blurImage", blurImage ?
"true" :
"false" );
178 cfg.
write(section,
"fx", fx );
179 cfg.
write(section,
"cx", cx );
180 cfg.
write(section,
"cy", cy );
181 cfg.
write(section,
"baseline", baseline );
182 cfg.
write(section,
"computeHashCoeffs", computeHashCoeffs ?
"true" :
"false" );
185 for(
unsigned int k = 0; k < scales.size(); ++k)
187 cfg.
write(section,
"scales", buf );
195 out.
printf(
"\n----------- [vision::TMultiResDescOptions] ------------ \n");
196 out.
printf(
"Base patch size: %d px\n", basePSize);
197 out.
printf(
"Lowest scale to compute: %d\n", comLScl );
198 out.
printf(
"Highest scale to compute: %d\n", comHScl );
199 out.
printf(
"Image smoothing sigma: %.2f px\n", sg1 );
200 out.
printf(
"Orientation histogram sigma: %.2f\n", sg2 );
201 out.
printf(
"Descriptor histogram sigma: %.2f\n", sg3 );
202 out.
printf(
"Compute depth: ");
206 out.
printf(
"Focal length: %.2f px\n", fx );
207 out.
printf(
"Principal point (cx): %.2f px\n", cx );
208 out.
printf(
"Principal point (cy): %.2f px\n", cy );
209 out.
printf(
"Baseline: %.2f m\n", baseline );
214 out.
printf(
"Compute Hash Coeffs: ");
215 if( computeHashCoeffs )
220 out.
printf(
"Blur image previously: ");
227 for(
unsigned int k = 0; k < scales.size(); ++k)
228 out.
printf(
"%.2f ", scales[k] );
230 out.
printf(
"-------------------------------------------------------- \n");
235 out.
printf(
"\n----------- [vision::CFeature] ------------ \n");
236 out.
printf(
"Feature ID: %d\n", (
int)ID);
237 out.
printf(
"Coordinates: (%.2f,%.2f) px\n",
x,
y );
238 out.
printf(
"PatchSize: %d\n", patchSize );
242 case -1: out.
printf(
"Not defined\n");
break;
243 case 0: out.
printf(
"KLT\n");
break;
244 case 1: out.
printf(
"Harris\n");
break;
245 case 2: out.
printf(
"BCD\n");
break;
246 case 3: out.
printf(
"SIFT\n");
break;
247 case 4: out.
printf(
"SURF\n");
break;
248 case 5: out.
printf(
"Beacon\n");
break;
249 case 6: out.
printf(
"FAST\n");
break;
250 case 7: out.
printf(
"FASTER-9\n");
break;
251 case 8: out.
printf(
"FASTER-10\n");
break;
252 case 9: out.
printf(
"FASTER-12\n");
break;
253 case 10:out.
printf(
"ORB");
break;
256 switch( track_status )
258 case 0: out.
printf(
"Idle\n");
break;
259 case 1: out.
printf(
"[KLT] Out of bounds [KLT]\n");
break;
260 case 5: out.
printf(
"[KLT] Tracked\n");
break;
261 case 10: out.
printf(
"[KLT] Lost\n");
break;
264 out.
printf(
"Response: %.2f\n", response );
265 out.
printf(
"Main orientation: %.2f\n", orientation );
267 out.
printf(
"# frames seen: %d\n", nTimesSeen );
268 out.
printf(
"# frames not seen: %d\n", nTimesNotSeen );
269 out.
printf(
"# frames since last seen: %d\n", nTimesLastSeen );
270 out.
printf(
"Initial Depth: %.2f m\n", initialDepth );
272 out.
printf(
"3D point: (%.2f,%.2f,%.2f) m\n", p3D.x, p3D.y, p3D.z );
273 out.
printf(
"Is point feature?: ");
274 isPointFeature() ? out.
printf(
"Yes\n") : out.
printf(
"No\n");
276 out.
printf(
"Has SIFT descriptor?: ");
277 descriptors.hasDescriptorSIFT() ? out.
printf(
"Yes\n") : out.
printf(
"No\n");
278 out.
printf(
"Has SURF descriptor?: ");
279 descriptors.hasDescriptorSURF() ? out.
printf(
"Yes\n") : out.
printf(
"No\n");
280 out.
printf(
"Has Spin image descriptor?: ");
281 descriptors.hasDescriptorSpinImg() ? out.
printf(
"Yes\n") : out.
printf(
"No\n");
282 out.
printf(
"Has Polar descriptor?: ");
283 descriptors.hasDescriptorPolarImg() ? out.
printf(
"Yes\n") : out.
printf(
"No\n");
284 out.
printf(
"Has Log Polar descriptor?: ");
285 descriptors.hasDescriptorLogPolarImg() ? out.
printf(
"Yes\n") : out.
printf(
"No\n");
286 out.
printf(
"Has ORB descriptor?: ");
287 descriptors.hasDescriptorORB() ? out.
printf(
"Yes\n") : out.
printf(
"No\n");
290 out.
printf(
"Has multiscale?: ");
291 if( !descriptors.hasDescriptorMultiSIFT() )
295 out.
printf(
"Yes [%d]\n", (
int)multiScales.size());
296 for(
int k = 0; k < (int)multiScales.size(); ++k )
298 out.
printf(
" · Scale %d: %.2f\n", k, multiScales[k] );
299 for(
int m = 0; m < (int)multiOrientations[k].
size(); ++m )
301 out.
printf(
" ·· Orientation %d: %.2f\n", m, multiOrientations[k][m] );
303 for(
int n = 0;
n < (int)descriptors.multiSIFTDescriptors[k][m].size(); ++
n )
304 out.
printf(
"%d ", descriptors.multiSIFTDescriptors[k][m][
n] );
306 if( multiHashCoeffs.size() > 0 )
307 out.
printf(
" ·· HASH coefficients %d,%d,%d\n", multiHashCoeffs[k][m][0], multiHashCoeffs[k][m][1],multiHashCoeffs[k][m][2] );
316 dumpToTextStream( myOut );
348 << descriptors.SpinImg
349 << descriptors.SpinImg_range_rows
350 << descriptors.PolarImg
351 << descriptors.LogPolarImg
352 << descriptors.polarImgsNoRotation
353 << descriptors.multiSIFTDescriptors
391 in >> descriptors.SIFT
393 >> descriptors.SpinImg
394 >> descriptors.SpinImg_range_rows
395 >> descriptors.PolarImg
396 >> descriptors.LogPolarImg
397 >> descriptors.polarImgsNoRotation;
399 in >> descriptors.multiSIFTDescriptors;
401 in >> descriptors.ORB;
418 orientation(0.0),
scale(0.0), user_flags(0),
419 nTimesSeen(1), nTimesNotSeen(0), nTimesLastSeen(0),
depth( 0 ), initialDepth( 0 ), p3D(),
420 multiScales(), multiOrientations(), multiHashCoeffs(), descriptors()
427 SpinImg(), SpinImg_range_rows(0),
430 polarImgsNoRotation(false),
454 return 0.5 - 0.5*max_val;
466 bool normalize_distances )
const 485 else THROW_EXCEPTION(
"Feature has no descriptors and descriptorToUse=descAny")
488 switch (descriptorToUse)
528 itDesc1++, itDesc2++ )
530 dist +=
square(*itDesc1 - *itDesc2);
534 if (normalize_distances) dist/= 64.0f;
550 itDesc1++, itDesc2++ )
552 dist +=
square(*itDesc1 - *itDesc2);
556 if (normalize_distances) dist/= 0.20f;
573 itDesc1++, itDesc2++ )
575 dist +=
square(*itDesc1 - *itDesc2);
578 if (normalize_by_vector_length)
592 bool normalize_distances,
593 bool dont_shift_angle )
598 unsigned int delta,i,j,ii,
height = desc1.getRowCount(),
width = desc1.getColCount();
599 float dist, minDist=0;
603 #define LM_CORR_METHOD_EUCLID 607 #if defined(LM_CORR_BIAS_MEAN) || defined(LM_CORR_METHOD_CORRELATION) 608 const float desc1_mean = desc1.sum() /
static_cast<float>(
width*
height);
609 const float desc2_mean = desc2.sum() /
static_cast<float>(
width*
height);
614 for (delta=0;delta<
height;delta++)
617 #if defined(LM_CORR_METHOD_CORRELATION) 626 ii = (i + delta) %
height;
627 for (j=0;j<
width;j++)
629 #ifdef LM_CORR_METHOD_EUCLID 630 #ifdef LM_CORR_BIAS_MEAN 631 dist+=
square( desc1.get_unsafe(i,j) - desc1_mean - desc2.get_unsafe(ii,j) + desc2_mean );
633 dist+=
square( desc1.get_unsafe(i,j) - desc2.get_unsafe(ii,j) );
635 #elif defined(LM_CORR_METHOD_MANHATTAN) 636 #ifdef LM_CORR_BIAS_MEAN 637 dist+= abs( desc1.get_unsafe(i,j) - desc1_mean - desc2.get_unsafe(ii,j) + desc2_mean );
639 dist+= abs( desc1.get_unsafe(i,j) - desc2.get_unsafe(ii,j) );
641 #elif defined(LM_CORR_METHOD_CORRELATION) 642 float d1 = desc1.get_unsafe(i,j) - desc1_mean;
643 float d2 = desc2.get_unsafe(ii,j) - desc2_mean;
648 #error A LM_CORR_METHOD_XXX method must be selected! 654 if (normalize_distances)
657 #ifdef LM_CORR_METHOD_EUCLID 661 #if defined(LM_CORR_METHOD_CORRELATION) 662 dist = 1 - (s12 / sqrt(s11 * s22));
665 distances[delta] = dist;
666 if (!delta && dont_shift_angle) { distances.resize(1);
break; }
670 minDist = distances.minimum(&minDistIdx);
672 double dist_mean,dist_std;
677 cout <<
"min dist: " << minDist << endl;
680 win.
plot(distances,
"b.4");
693 minDistAngle = minDistIdx *
M_2PI /
static_cast<float>(
width) ;
705 bool normalize_distances)
const 731 bool normalize_distances)
const 764 for(
uint8_t k = 0; k < t_desc.size(); ++k )
766 uint8_t x_or = t_desc[k] ^ o_desc[k];
795 if( !f.open(filename,APPEND) )
796 THROW_EXCEPTION(
"[CFeature::saveToTextFile] ERROR: File could not be open for writing" );
798 f.printf(
"%5u %2d %7.3f %7.3f %6.2f %6.2f %2d %6.3f ",
799 (
unsigned int)this->
ID, (
int)this->
get_type(), this->
x, this->
y,
808 f.printf(
"%4d ", this->descriptors.SIFT[k]);
816 f.printf(
"%8.5f ", this->descriptors.SURF[k]);
822 for(
int k = 0; k < int(this->
multiScales.size()); ++k )
829 f.printf(
"%4d ", this->descriptors.multiSIFTDescriptors[k][m][
n]);
837 f.printf(
"%d ", this->descriptors.ORB[k] );
871 if( !f.open(filename,APPEND) )
872 THROW_EXCEPTION(
"[CFeatureList::saveToTextFile] ERROR: File could not be open for writing" );
875 "%% Dump of mrpt::vision::CFeatureList. Each line format is:\n" 876 "%% ID TYPE X Y ORIENTATION SCALE TRACK_STATUS RESPONSE HAS_SIFT [SIFT] HAS_SURF [SURF]\n" 877 "%% \\---------------------- feature ------------------/ \\--------- descriptors -------/\n" 879 "%% TYPE : The used detector: 0:KLT, 1: Harris, 2: BCD, 3: SIFT, 4: SURF, 5: Beacon, 6: FAST\n" 880 "%% HAS_* : 1 if a descriptor of that type is associated to the feature. \n" 881 "%% SIFT : Present if HAS_SIFT=1: N DESC_0 ... DESC_N-1 \n" 882 "%% SURF : Present if HAS_SURF=1: N DESC_0 ... DESC_N-1 \n" 883 "%%-------------------------------------------------------------------------------------------\n");
887 f.printf(
"%5u %2d %7.3f %7.3f %6.2f %6.2f %2d %6.3f ",
888 (
unsigned int)(*it)->ID, (
int)(*it)->get_type(), (*it)->x, (*it)->y,
889 (*it)->orientation, (*it)->scale,
890 (int)(*it)->track_status, (*it)->response );
892 f.printf(
"%2d ",
int((*it)->descriptors.hasDescriptorSIFT() ? 1:0) );
893 if( (*it)->descriptors.hasDescriptorSIFT() )
895 f.printf(
"%4d ",
int((*it)->descriptors.SIFT.size()) );
896 for(
unsigned int k = 0; k < (*it)->descriptors.SIFT.size(); k++ )
897 f.printf(
"%4d ", (*it)->descriptors.SIFT[k]);
900 f.printf(
"%2d ",
int((*it)->descriptors.hasDescriptorSURF() ? 1:0) );
901 if( (*it)->descriptors.hasDescriptorSURF() )
903 f.printf(
"%4d ",
int((*it)->descriptors.SURF.size()) );
904 for(
unsigned int k = 0; k < (*it)->descriptors.SURF.size(); k++ )
905 f.printf(
"%8.5f ", (*it)->descriptors.SURF[k]);
924 std::istringstream line;
926 while( parser.getNextLine(line) )
931 CFeature* feat = feat_ptr.pointer();
941 if (!(line >> feat->
x >> feat->
y ))
throw std::string(
"x,y");
946 if (!(line >> _track_st ))
throw std::string(
"track_status");
952 if (!(line >> hasSIFT))
throw std::string(
"hasSIFT");
958 for (
size_t i=0;i<N;i++)
969 if (!(line >> hasSURF))
throw std::string(
"hasSURF");
975 for (
size_t i=0;i<N;i++)
984 THROW_EXCEPTION(
format(
"%s:%d: Error parsing features text file (%s).",filename.c_str(), (int)parser.getCurrentLineNumber(), msg.c_str() ))
996 this->resize( otherList.
size() );
999 for( it1 = otherList.
begin(), it2 = this->
begin(); it1 != otherList.
end(); ++it1, ++it2 )
1000 (*it2) = CFeaturePtr( dynamic_cast<CFeature*>((*it1)->clone()));
1009 if( (*it)->ID ==
ID )
1012 return CFeaturePtr();
1022 if( (*it)->ID ==
ID )
1028 return CFeaturePtr();
1038 out.reserve( IDs.size() );
1039 outIndex.reserve( IDs.size() );
1041 for(
int k = 0; k < int(IDs.size()); ++k )
1044 CFeaturePtr f = getByID( IDs[k], idx );
1046 outIndex.push_back( idx );
1056 return CFeaturePtr();
1058 float closest_x,closest_y;
1059 float closest_sqDist;
1062 const size_t closest_idx = this->kdTreeClosestPoint2D(
x,
y,closest_x,closest_y,closest_sqDist);
1063 float closest_dist = std::sqrt(closest_sqDist);
1065 if (closest_dist<=dist_prev)
1067 dist_prev = closest_dist;
1068 return m_feats[closest_idx];
1070 else return CFeaturePtr();
1111 FILE *f =
os::fopen( filename.c_str(),
"wt" );
1115 for( it = this->
begin(); it != this->
end(); it++ )
1118 (
unsigned int)(*it->first).ID, (*it->first).x, (*it->first).y,
1119 (
unsigned int)(*it->second).ID, (*it->second).x, (*it->second).y);
1131 for( it =
begin(); it !=
end(); ++it )
1133 CFeaturePtr feat = (idx ==
firstList) ? it->first : it->second;
1134 if( feat->ID == ID )
1137 return CFeaturePtr();
1191 list1[k] = it->first;
1192 list2[k] = it->second;
1222 for (
size_t r=0;
r<nR;
r++)
1223 for (
size_t c=0;
c<nC;
c++)
1224 desc.coeffRef(
r,
c) = *itD++;
void updateMaxID(const TListIdx &idx)
Updates the value of the maximum ID of the features in the matched list, i.e.
float descriptorDistanceTo(const CFeature &oFeature, TDescriptorType descriptorToUse=descAny, bool normalize_distances=true) const
Computes the Euclidean Distance between this feature's and other feature's descriptors, using the given descriptor or the first present one.
int waitForKey(bool ignoreControlKeys=true, mrptKeyModifier *out_pushModifier=NULL)
Waits for any key to be pushed on the image or the console, and returns the key code.
GLuint GLuint GLsizei count
FILE BASE_IMPEXP * fopen(const char *fileName, const char *mode) MRPT_NO_THROWS
An OS-independent version of fopen.
CFeaturePtr nearest(const float x, const float y, double &max_dist) const
Get a reference to the nearest feature to the a given 2D point (version returning distance to closest...
Non-defined feature (also used for Occupancy features)
TFeatureID ID
ID of the feature.
EIGEN_STRONG_INLINE bool empty() const
bool read_bool(const std::string §ion, const std::string &name, bool defaultValue, bool failIfNotFound=false) const
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
uint8_t descriptorORBDistanceTo(const CFeature &oFeature) const
Computes the Hamming distance "this" and the "other" descriptor ORB descriptor.
float descriptorSpinImgDistanceTo(const CFeature &oFeature, bool normalize_distances=true) const
Computes the Euclidean Distance between "this" and the "other" descriptors.
float scale
Feature scale into the scale space.
Used in some methods to mean "any of the present descriptors".
void loadFromTextFile(const std::string &fileName)
Save feature list to a text file.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
Create a GUI window and display plots with MATLAB-like interfaces and commands.
The virtual base class which provides a unified interface for all persistent objects in MRPT...
int BASE_IMPEXP void BASE_IMPEXP fclose(FILE *f)
An OS-independent version of fclose.
A class for storing images as grayscale or RGB bitmaps.
void dumpToTextStream(mrpt::utils::CStream &out) const MRPT_OVERRIDE
This method should clearly display all the contents of the structure in textual form, sending it to a CStream.
bool hasDescriptorLogPolarImg() const
Whether this feature has this kind of descriptor.
GLenum GLenum GLenum GLenum GLenum scale
TFeatureTrackStatus track_status
Status of the feature tracking process (old name: KLT_status)
bool hasDescriptorSpinImg() const
void dumpToConsole() const
#define THROW_EXCEPTION(msg)
float descriptorSIFTDistanceTo(const CFeature &oFeature, bool normalize_distances=true) const
Computes the Euclidean Distance between "this" and the "other" descriptors.
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
float descriptorSURFDistanceTo(const CFeature &oFeature, bool normalize_distances=true) const
Computes the Euclidean Distance between "this" and the "other" descriptors.
This CStdOutStream derived class allow printing to standard out, normally the console text output...
EIGEN_STRONG_INLINE iterator begin()
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction...
bool hasDescriptorSIFT() const
CFeaturePtr getByID(const TFeatureID &ID, const TListIdx &idx)
Returns a smart pointer to the feature with the provided ID or a empty one if not found...
EIGEN_STRONG_INLINE void push_back(Scalar val)
Insert an element at the end of the container (for 1D vectors/arrays)
std::vector< float > SURF
SURF feature descriptor.
std::deque< double > multiScales
A set of scales where the multi-resolution descriptor has been computed.
int BASE_IMPEXP fprintf(FILE *fil, const char *format,...) MRPT_NO_THROWS MRPT_printf_format_check(2
An OS-independent version of fprintf.
TInternalFeatList::const_iterator const_iterator
GLint GLint GLsizei GLsizei GLsizei depth
const Scalar * const_iterator
TFeatureType get_type() const
Get the type of the feature.
mrpt::math::CMatrix LogPolarImg
A log-polar image centered at the interest point.
CMatchedFeatureList()
Constructor.
float y
Coordinates in the image.
IMPLEMENTS_SERIALIZABLE(CLogFileRecord_FullEval, CHolonomicLogFileRecord, mrpt::nav) IMPLEMENTS_SERIALIZABLE(CHolonomicFullEval
bool hasDescriptorMultiSIFT() const
Whether this feature has this kind of descriptor.
void image(const utils::CImage &img, const float &x_left, const float &y_bottom, const float &x_width, const float &y_height, const std::string &plotName=std::string("image"))
Adds a bitmap image layer.
void dumpToTextStream(mrpt::utils::CStream &out) const MRPT_OVERRIDE
This method should clearly display all the contents of the structure in textual form, sending it to a CStream.
This class allows loading and storing values and vectors of different types from a configuration text...
T square(const T x)
Inline function for the square of a number.
Inactive (right after detection, and before being tried to track)
int read_int(const std::string §ion, const std::string &name, int defaultValue, bool failIfNotFound=false) const
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
bool polarImgsNoRotation
If set to true (manually, default=false) the call to "descriptorDistanceTo" will not consider all the...
TFeatureType type
Type of the feature: featNotDefined, featSIFT, featKLT, featHarris, featSURF, featBeacon.
void getBothFeatureLists(CFeatureList &list1, CFeatureList &list2)
Returns the matching features as two separate CFeatureLists.
void saveToTextFile(const std::string &filename, bool APPEND=false)
Save the feature to a text file in this format: "%% Dump of mrpt::vision::CFeatureList. Each line format is:\n" "%% ID TYPE X Y ORIENTATION SCALE TRACK_STATUS RESPONSE HAS_SIFT [SIFT] HAS_SURF [SURF] HAS_MULTI [MULTI_i] HAS_ORB [ORB]" "%% |---------------------- feature ------------------| |---------------------- descriptors ------------------------|" "%% with:\n" "%% TYPE : The used detector: 0:KLT, 1: Harris, 2: BCD, 3: SIFT, 4: SURF, 5: Beacon, 6: FAST, 7: ORB\n" "%% HAS_* : 1 if a descriptor of that type is associated to the feature." "%% SIFT : Present if HAS_SIFT=1: N DESC_0 ... DESC_N-1" "%% SURF : Present if HAS_SURF=1: N DESC_0 ... DESC_N-1" "%% MULTI : Present if HAS_MULTI=1: SCALE ORI N DESC_0 ... DESC_N-1" "%% ORB : Present if HAS_ORB=1: DESC_0 ...
This base provides a set of functions for maths stuff.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
This CStream derived class allow using a file as a write-only, binary stream.
void getMaxID(const TListIdx &idx, TFeatureID &firstListID, TFeatureID &secondListID)
Returns the maximum ID of the features in the list.
void saveToConfigFile(mrpt::utils::CConfigFileBase &cfg, const std::string §ion) const MRPT_OVERRIDE
This method saves the options to a ".ini"-like file or memory-stored string list. ...
static float internal_distanceBetweenPolarImages(const mrpt::math::CMatrix &desc1, const mrpt::math::CMatrix &desc2, float &minDistAngle, bool normalize_distances, bool dont_shift_angle)
Internal function used by "descriptorLogPolarImgDistanceTo" and "descriptorPolarImgDistanceTo".
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) MRPT_OVERRIDE
Load all the params from a config source, in the format described in saveToConfigFile() ...
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
void cross_correlation(const CImage &patch_img, size_t &u_max, size_t &v_max, double &max_val, int u_search_ini=-1, int v_search_ini=-1, int u_search_size=-1, int v_search_size=-1, CImage *out_corr_image=NULL) const
Computes the correlation between this image and another one, encapsulating the openCV function cvMatc...
Scale Invariant Feature Transform [LOWE'04].
void read_vector(const std::string §ion, const std::string &name, const VECTOR_TYPE &defaultValue, VECTOR_TYPE &outValues, bool failIfNotFound=false) const
Reads a configuration parameter of type vector, stored in the file as a string: "[v1 v2 v3 ...
std::vector< uint8_t > SIFT
SIFT feature descriptor.
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
std::deque< std::vector< double > > multiOrientations
A vector of main orientations (there is a vector of orientations for each scale)
Classes for computer vision, detectors, features, etc.
uint16_t SpinImg_range_rows
The number of rows (corresponding to range bins in the 2D histogram) of the original matrix from whic...
A generic 2D feature from an image, extracted with CFeatureExtraction Each feature may have one or mo...
A class for parsing text files, returning each non-empty and non-comment line, along its line number...
void plot(const std::vector< T1 > &x, const std::vector< T2 > &y, const std::string &lineFormat=std::string("b-"), const std::string &plotName=std::string("plotXY"))
Adds a new layer with a 2D plot based on two vectors of X and Y points, using a MATLAB-like syntax...
uint64_t TFeatureID
Definition of a feature ID.
Bit-based feature descriptor.
bool hasDescriptorORB() const
Whether this feature has this kind of descriptor.
void saveToTextFile(const std::string &fileName)
Save list of matched features to a text file.
GLsizei const GLchar ** string
A list of visual features, to be used as output by detectors, as input/output by trackers, etc.
TDescriptorType
The bitwise OR combination of values of TDescriptorType are used in CFeatureExtraction::computeDescri...
void dumpToTextStream(mrpt::utils::CStream &out) const
Dump feature information into a text stream.
TFeatureType
Types of features - This means that the point has been detected with this algorithm, which is independent of additional descriptors a feature may also have.
void saveToTextFile(const std::string &fileName, bool APPEND=false)
Save feature list to a text file.
float response
A measure of the "goodness" of the feature (old name: KLT_val)
bool getFirstDescriptorAsMatrix(mrpt::math::CMatrixFloat &desc) const
Return the first found descriptor, as a matrix.
virtual ~CFeatureList()
Virtual destructor.
CFeatureList()
Constructor.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLdouble GLdouble GLdouble r
void meanAndStd(const VECTORLIKE &v, double &out_mean, double &out_std, bool unbiased=true)
Computes the standard deviation of a vector.
Log-Polar image descriptor.
void write(const std::string §ion, const std::string &name, const data_t &value, const int name_padding_width=-1, const int value_padding_width=-1, const std::string &comment=std::string())
std::vector< float > SpinImg
The 2D histogram as a single row.
Speeded Up Robust Feature [BAY'06].
double read_double(const std::string §ion, const std::string &name, double defaultValue, bool failIfNotFound=false) const
float descriptorPolarImgDistanceTo(const CFeature &oFeature, float &minDistAngle, bool normalize_distances=true) const
Returns the minimum Euclidean Distance between "this" and the "other" polar image descriptor...
float patchCorrelationTo(const CFeature &oFeature) const
Computes the normalized cross-correlation between the patches of this and another feature (normalized...
virtual ~CMatchedFeatureList()
Virtual destructor.
A matrix of dynamic size.
TFeatureID getMaxID() const
Get the maximum ID into the list.
void getByMultiIDs(const std::vector< TFeatureID > &IDs, std::vector< CFeaturePtr > &out, std::vector< int > &outIndex) const
Get a vector of references to a subset of features from their IDs.
Struct containing the options when matching multi-resolution SIFT-like descriptors.
TInternalFeatList::iterator iterator
static CFeaturePtr Create()
int BASE_IMPEXP sprintf(char *buf, size_t bufSize, const char *format,...) MRPT_NO_THROWS MRPT_printf_format_check(3
An OS-independent version of sprintf (Notice the bufSize param, which may be ignored in some compiler...
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
Intensity-domain spin image descriptors.
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
mrpt::utils::CImage patch
A patch of the image surrounding the feature.
bool hasDescriptorPolarImg() const
Whether this feature has this kind of descriptor.
struct VISION_IMPEXP mrpt::vision::CFeature::TDescriptors descriptors
CFeaturePtr getByID(const TFeatureID &ID) const
Get a reference to a Feature from its ID.
float orientation
Main orientation of the feature.
float descriptorLogPolarImgDistanceTo(const CFeature &oFeature, float &minDistAngle, bool normalize_distances=true) const
Returns the minimum Euclidean Distance between "this" and the "other" log-polar image descriptor...
This class is a "CSerializable" wrapper for "CMatrixFloat".
GLenum GLsizei GLsizei height
unsigned __int32 uint32_t
size_t getWidth() const MRPT_OVERRIDE
Returns the width of the image in pixels.
GLuint GLuint GLsizei GLenum type
std::deque< std::vector< std::vector< int32_t > > > multiSIFTDescriptors
A set of SIFT-like descriptors for each orientation and scale of the multiResolution feature (there i...
void keep_max(T &var, const K test_val)
If the second argument is above the first one, set the first argument to this higher value...
double BASE_IMPEXP distance(const TPoint2D &p1, const TPoint2D &p2)
Gets the distance between two points in a 2D space.
virtual int printf(const char *fmt,...) MRPT_printf_format_check(2
Writes a string to the stream in a textual form.
mrpt::math::CMatrix PolarImg
A polar image centered at the interest point.
void copyListFrom(const CFeatureList &otherList)
Copies the content of another CFeatureList inside this one.
size_t getHeight() const MRPT_OVERRIDE
Returns the height of the image in pixels.
bool isPointFeature() const
Return false only for Blob detectors (SIFT, SURF)
void saveToConfigFile(mrpt::utils::CConfigFileBase &cfg, const std::string §ion) const MRPT_OVERRIDE
This method saves the options to a ".ini"-like file or memory-stored string list. ...
bool hasDescriptorSURF() const
Whether this feature has this kind of descriptor.
std::vector< uint8_t > ORB
ORB feature descriptor.