42 useOriFilter = cfg.read_bool(section,
"useOriFilter",
true,
false);
43 oriThreshold = cfg.read_double(section,
"oriThreshold", 0.2,
false);
44 lastSeenThreshold = cfg.read_int(section,
"lastSeenThreshold", 10,
false);
45 timesSeenThreshold = cfg.read_int(section,
"timesSeenThreshold", 5,
false);
46 minFeaturesToFind = cfg.read_int(section,
"minFeaturesToFind", 5,
false);
48 cfg.read_int(section,
"minFeaturesToBeLost", 5,
false);
50 useDepthFilter = cfg.read_bool(section,
"useDepthFilter",
true,
false);
53 cfg.read_double(section,
"matchingThreshold", 1e4,
false);
54 matchingRatioThreshold =
55 cfg.read_double(section,
"matchingRatioThreshold", 0.5,
false);
57 lowScl1 = cfg.read_int(section,
"lowScl1", 0,
false);
58 lowScl2 = cfg.read_int(section,
"lowScl1", 0,
false);
59 highScl1 = cfg.read_int(section,
"highScl1", 6,
false);
60 highScl2 = cfg.read_int(section,
"highScl2", 6,
false);
62 searchAreaSize = cfg.read_double(section,
"searchAreaSize", 20,
false);
73 cfg.
write(section,
"useOriFilter",
"true");
74 cfg.
write(section,
"oriThreshold", oriThreshold);
77 cfg.
write(section,
"useOriFilter",
"false");
80 cfg.
write(section,
"useDepthFilter",
"true");
82 cfg.
write(section,
"useDepthFilter",
"false");
84 cfg.
write(section,
"matchingThreshold", matchingThreshold);
85 cfg.
write(section,
"matchingRatioThreshold", matchingRatioThreshold);
86 cfg.
write(section,
"lowScl1", lowScl1);
87 cfg.
write(section,
"lowScl2", lowScl2);
88 cfg.
write(section,
"highScl1", highScl1);
89 cfg.
write(section,
"highScl2", highScl2);
91 cfg.
write(section,
"searchAreaSize", searchAreaSize);
92 cfg.
write(section,
"lastSeenThreshold", lastSeenThreshold);
93 cfg.
write(section,
"timesSeenThreshold", timesSeenThreshold);
94 cfg.
write(section,
"minFeaturesToFind", minFeaturesToFind);
95 cfg.
write(section,
"minFeaturesToBeLost", minFeaturesToBeLost);
105 "\n----------- [vision::TMultiResDescMatchOptions] ------------ \n");
106 out.
printf(
"Use orientation filter?: ");
111 "ยท Orientation threshold: %.1f deg\n",
116 out.
printf(
"Use depth filter?: ");
122 out.
printf(
"Lowest scale in list1: %d\n", lowScl1);
123 out.
printf(
"Highest scale in list1: %d\n", highScl1);
124 out.
printf(
"Lowest scale in list2: %d\n", lowScl2);
125 out.
printf(
"Highest scale in list2: %d\n", highScl2);
127 out.
printf(
"#frames last seen threshold: %d\n", lastSeenThreshold);
128 out.
printf(
"#frames to be stable threshold: %d\n", timesSeenThreshold);
129 out.
printf(
"min. # features in system: %d\n", minFeaturesToFind);
130 out.
printf(
"min. # features to be lost: %d\n", minFeaturesToBeLost);
131 out.
printf(
"Matching threshold: %.2f\n", matchingThreshold);
133 "Matching ratio threshold: %.2f\n", matchingRatioThreshold);
134 out.
printf(
"Size of the search window: %d px\n", searchAreaSize);
135 out.
printf(
"-------------------------------------------------------- \n");
147 basePSize = cfg.
read_double(section,
"basePSize", 23,
false);
148 comLScl = cfg.
read_int(section,
"comLScl", 0,
false);
149 comHScl = cfg.
read_int(section,
"comHScl", 6,
false);
153 computeDepth = cfg.
read_bool(section,
"computeDepth",
true,
false);
154 blurImage = cfg.
read_bool(section,
"blurImage",
true,
false);
158 baseline = cfg.
read_double(section,
"baseline", 0.0,
false);
160 cfg.
read_bool(section,
"computeHashCoeffs",
false,
false);
162 cfg.
read_vector(section,
"scales", vector<double>(), scales,
false);
163 if (scales.size() < 1)
182 cfg.
write(section,
"basePSize", basePSize);
183 cfg.
write(section,
"comLScl", comLScl);
184 cfg.
write(section,
"comHScl", comHScl);
185 cfg.
write(section,
"sg1", sg1);
186 cfg.
write(section,
"sg2", sg2);
187 cfg.
write(section,
"sg3", sg3);
189 cfg.
write(section,
"computeDepth", computeDepth ?
"true" :
"false");
190 cfg.
write(section,
"blurImage", blurImage ?
"true" :
"false");
191 cfg.
write(section,
"fx", fx);
192 cfg.
write(section,
"cx", cx);
193 cfg.
write(section,
"cy", cy);
194 cfg.
write(section,
"baseline", baseline);
196 section,
"computeHashCoeffs", computeHashCoeffs ?
"true" :
"false");
199 for (
unsigned int k = 0; k < scales.size(); ++k)
201 cfg.
write(section,
"scales", buf);
209 out.
printf(
"\n----------- [vision::TMultiResDescOptions] ------------ \n");
210 out.
printf(
"Base patch size: %d px\n", basePSize);
211 out.
printf(
"Lowest scale to compute: %d\n", comLScl);
212 out.
printf(
"Highest scale to compute: %d\n", comHScl);
213 out.
printf(
"Image smoothing sigma: %.2f px\n", sg1);
214 out.
printf(
"Orientation histogram sigma: %.2f\n", sg2);
215 out.
printf(
"Descriptor histogram sigma: %.2f\n", sg3);
216 out.
printf(
"Compute depth: ");
220 out.
printf(
"Focal length: %.2f px\n", fx);
221 out.
printf(
"Principal point (cx): %.2f px\n", cx);
222 out.
printf(
"Principal point (cy): %.2f px\n", cy);
223 out.
printf(
"Baseline: %.2f m\n", baseline);
228 out.
printf(
"Compute Hash Coeffs: ");
229 if (computeHashCoeffs)
234 out.
printf(
"Blur image previously: ");
241 for (
unsigned int k = 0; k < scales.size(); ++k)
242 out.
printf(
"%.2f ", scales[k]);
244 out.
printf(
"-------------------------------------------------------- \n");
249 out.
printf(
"\n----------- [vision::CFeature] ------------ \n");
250 out.
printf(
"Feature ID: %d\n", (
int)ID);
251 out.
printf(
"Coordinates: (%.2f,%.2f) px\n",
x,
y);
252 out.
printf(
"PatchSize: %d\n", patchSize);
257 out.
printf(
"Not defined\n");
284 out.
printf(
"FASTER-10\n");
287 out.
printf(
"FASTER-12\n");
300 switch (track_status)
306 out.
printf(
"[KLT] Out of bounds [KLT]\n");
309 out.
printf(
"[KLT] Tracked\n");
312 out.
printf(
"[KLT] Lost\n");
316 out.
printf(
"Response: %.2f\n", response);
317 out.
printf(
"Main orientation: %.2f\n", orientation);
319 out.
printf(
"# frames seen: %d\n", nTimesSeen);
320 out.
printf(
"# frames not seen: %d\n", nTimesNotSeen);
321 out.
printf(
"# frames since last seen: %d\n", nTimesLastSeen);
322 out.
printf(
"Initial Depth: %.2f m\n", initialDepth);
325 "3D point: (%.2f,%.2f,%.2f) m\n", p3D.x, p3D.y,
327 out.
printf(
"Is point feature?: ");
328 isPointFeature() ? out.
printf(
"Yes\n") : out.
printf(
"No\n");
330 out.
printf(
"Has SIFT descriptor?: ");
331 descriptors.hasDescriptorSIFT() ? out.
printf(
"Yes\n") : out.
printf(
"No\n");
332 out.
printf(
"Has SURF descriptor?: ");
333 descriptors.hasDescriptorSURF() ? out.
printf(
"Yes\n") : out.
printf(
"No\n");
334 out.
printf(
"Has Spin image descriptor?: ");
335 descriptors.hasDescriptorSpinImg() ? out.
printf(
"Yes\n")
337 out.
printf(
"Has Polar descriptor?: ");
338 descriptors.hasDescriptorPolarImg() ? out.
printf(
"Yes\n")
340 out.
printf(
"Has Log Polar descriptor?: ");
341 descriptors.hasDescriptorLogPolarImg() ? out.
printf(
"Yes\n")
343 out.
printf(
"Has ORB descriptor?: ");
344 descriptors.hasDescriptorORB() ? out.
printf(
"Yes\n") : out.
printf(
"No\n");
346 out.
printf(
"Has BLD descriptor?: ");
347 descriptors.hasDescriptorBLD() ? out.
printf(
"Yes\n") : out.
printf(
"No\n");
348 out.
printf(
"Has LATCH descriptor?: ");
349 descriptors.hasDescriptorLATCH() ? out.
printf(
"Yes\n") : out.
printf(
"No\n");
351 out.
printf(
"Has multiscale?: ");
352 if (!descriptors.hasDescriptorMultiSIFT())
356 out.
printf(
"Yes [%d]\n", (
int)multiScales.size());
357 for (
int k = 0; k < (int)multiScales.size(); ++k)
359 out.
printf(
" ยท Scale %d: %.2f\n", k, multiScales[k]);
360 for (
int m = 0; m < (int)multiOrientations[k].
size(); ++m)
363 " ยทยท Orientation %d: %.2f\n", m, multiOrientations[k][m]);
366 n < (int)descriptors.multiSIFTDescriptors[k][m].size();
369 "%d ", descriptors.multiSIFTDescriptors[k][m][
n]);
371 if (multiHashCoeffs.size() > 0)
373 " ยทยท HASH coefficients %d,%d,%d\n",
374 multiHashCoeffs[k][m][0], multiHashCoeffs[k][m][1],
375 multiHashCoeffs[k][m][2]);
384 dumpToTextStream(myOut);
395 << (
uint32_t)track_status << response << orientation <<
scale 396 << user_flags << nTimesSeen << nTimesNotSeen << nTimesLastSeen
397 <<
depth << initialDepth << p3D << multiScales << multiOrientations
398 << multiHashCoeffs << descriptors.SIFT << descriptors.SURF
399 << descriptors.SpinImg << descriptors.SpinImg_range_rows
400 << descriptors.PolarImg << descriptors.LogPolarImg
401 << descriptors.polarImgsNoRotation
402 << descriptors.multiSIFTDescriptors << descriptors.ORB
404 << descriptors.BLD << descriptors.LATCH;
418 in >>
x >>
y >> ID >> patch >> patchSize >> aux_type >> aux_KLTS >>
419 response >> orientation >>
scale >> user_flags;
422 in >> nTimesSeen >> nTimesNotSeen >> nTimesLastSeen >>
depth >>
423 initialDepth >> p3D >> multiScales >> multiOrientations >>
426 in >> descriptors.SIFT >> descriptors.SURF >> descriptors.SpinImg >>
427 descriptors.SpinImg_range_rows >> descriptors.PolarImg >>
428 descriptors.LogPolarImg >> descriptors.polarImgsNoRotation
430 >> descriptors.BLD >> descriptors.LATCH;
431 if (version > 0)
in >> descriptors.multiSIFTDescriptors;
432 if (version > 1)
in >> descriptors.ORB;
476 SpinImg_range_rows(0),
479 polarImgsNoRotation(false),
517 bool normalize_distances)
const 522 if (descriptorToUse ==
descAny)
543 "Feature has no descriptors and descriptorToUse=descAny")
546 switch (descriptorToUse)
558 oFeature, minAng, normalize_distances);
564 oFeature, minAng, normalize_distances);
575 "Unknown value for 'descriptorToUse'=%u",
576 (
unsigned)descriptorToUse);
586 const CFeature& oFeature,
bool normalize_distances)
const 599 dist +=
square(*itDesc1 - *itDesc2);
603 if (normalize_distances) dist /= 64.0f;
611 const CFeature& oFeature,
bool normalize_distances)
const 624 dist +=
square(*itDesc1 - *itDesc2);
628 if (normalize_distances)
638 const CFeature& oFeature,
bool normalize_by_vector_length)
const 654 dist +=
square(*itDesc1 - *itDesc2);
667 bool normalize_distances,
bool dont_shift_angle)
672 unsigned int delta, i, j, ii,
height = desc1.getRowCount(),
673 width = desc1.getColCount();
674 float dist, minDist = 0;
678 #define LM_CORR_METHOD_EUCLID 682 #if defined(LM_CORR_BIAS_MEAN) || defined(LM_CORR_METHOD_CORRELATION) 683 const float desc1_mean = desc1.sum() /
static_cast<float>(
width *
height);
684 const float desc2_mean = desc2.sum() /
static_cast<float>(
width *
height);
689 for (delta = 0; delta <
height; delta++)
691 #if defined(LM_CORR_METHOD_CORRELATION) 698 for (i = 0; i <
height; i++)
700 ii = (i + delta) %
height;
701 for (j = 0; j <
width; j++)
703 #ifdef LM_CORR_METHOD_EUCLID 704 #ifdef LM_CORR_BIAS_MEAN 706 desc1.get_unsafe(i, j) - desc1_mean -
707 desc2.get_unsafe(ii, j) + desc2_mean);
710 square(desc1.get_unsafe(i, j) - desc2.get_unsafe(ii, j));
712 #elif defined(LM_CORR_METHOD_MANHATTAN) 713 #ifdef LM_CORR_BIAS_MEAN 715 abs(desc1.get_unsafe(i, j) - desc1_mean -
716 desc2.get_unsafe(ii, j) + desc2_mean);
718 dist += abs(desc1.get_unsafe(i, j) - desc2.get_unsafe(ii, j));
720 #elif defined(LM_CORR_METHOD_CORRELATION) 721 float d1 = desc1.get_unsafe(i, j) - desc1_mean;
722 float d2 = desc2.get_unsafe(ii, j) - desc2_mean;
727 #error A LM_CORR_METHOD_XXX method must be selected! 733 if (normalize_distances) dist /=
static_cast<float>(
width *
height);
735 #ifdef LM_CORR_METHOD_EUCLID 739 #if defined(LM_CORR_METHOD_CORRELATION) 740 dist = 1 - (s12 / sqrt(s11 * s22));
743 distances[delta] = dist;
744 if (!delta && dont_shift_angle)
752 minDist = distances.minimum(&minDistIdx);
754 double dist_mean, dist_std;
759 cout <<
"min dist: " << minDist << endl;
762 win.
plot(distances,
"b.4");
775 minDistAngle = minDistIdx *
M_2PI /
static_cast<float>(
width);
785 const CFeature& oFeature,
float& minDistAngle,
786 bool normalize_distances)
const 812 const CFeature& oFeature,
float& minDistAngle,
813 bool normalize_distances)
const 855 uint8_t x_or = t_desc[k] ^ o_desc[k];
872 const CFeature& oFeature,
bool normalize_distances)
const 885 dist +=
square(*itDesc1 - *itDesc2);
889 if (normalize_distances) dist /= 64.0f;
897 const CFeature& oFeature,
bool normalize_distances)
const 911 dist +=
square(*itDesc1 - *itDesc2);
915 if (normalize_distances) dist /= 64.0f;
942 if (!f.open(filename, APPEND))
944 "[CFeature::saveToTextFile] ERROR: File could not be open for " 948 "%5u %2d %7.3f %7.3f %6.2f %6.2f %2d %6.3f ", (
unsigned int)this->
ID,
957 f.printf(
"%4d ", this->descriptors.SIFT[k]);
965 f.printf(
"%8.5f ", this->descriptors.SURF[k]);
971 for (
int k = 0; k < int(this->
multiScales.size()); ++k)
981 for (
unsigned int n = 0;
986 this->descriptors.multiSIFTDescriptors[k][m][
n]);
994 f.printf(
"%d ", this->descriptors.ORB[k]);
1002 f.printf(
"%4d ", this->descriptors.BLD[k]);
1010 f.printf(
"%4d ", this->descriptors.LATCH[k]);
1041 if (!f.open(filename, APPEND))
1043 "[CFeatureList::saveToTextFile] ERROR: File could not be open for " 1047 "%% Dump of mrpt::vision::CFeatureList. Each line format is:\n" 1048 "%% ID TYPE X Y ORIENTATION SCALE TRACK_STATUS RESPONSE HAS_SIFT " 1049 "[SIFT] HAS_SURF [SURF]\n" 1050 "%% \\---------------------- feature ------------------/ \\--------- " 1051 "descriptors -------/\n" 1053 "%% TYPE : The used detector: 0:KLT, 1: Harris, 2: BCD, 3: SIFT, 4: " 1054 "SURF, 5: Beacon, 6: FAST\n" 1055 "%% HAS_* : 1 if a descriptor of that type is associated to the " 1057 "%% SIFT : Present if HAS_SIFT=1: N DESC_0 ... DESC_N-1 \n" 1058 "%% SURF : Present if HAS_SURF=1: N DESC_0 ... DESC_N-1 \n" 1059 "%%--------------------------------------------------------------------" 1060 "-----------------------\n");
1065 "%5u %2d %7.3f %7.3f %6.2f %6.2f %2d %6.3f ",
1066 (
unsigned int)(*it)->ID, (
int)(*it)->get_type(), (*it)->x, (*it)->y,
1067 (*it)->orientation, (*it)->scale, (int)(*it)->track_status,
1070 f.printf(
"%2d ",
int((*it)->descriptors.hasDescriptorSIFT() ? 1 : 0));
1071 if ((*it)->descriptors.hasDescriptorSIFT())
1073 f.printf(
"%4d ",
int((*it)->descriptors.SIFT.size()));
1074 for (
unsigned int k = 0; k < (*it)->descriptors.SIFT.size(); k++)
1075 f.printf(
"%4d ", (*it)->descriptors.SIFT[k]);
1078 f.printf(
"%2d ",
int((*it)->descriptors.hasDescriptorSURF() ? 1 : 0));
1079 if ((*it)->descriptors.hasDescriptorSURF())
1081 f.printf(
"%4d ",
int((*it)->descriptors.SURF.size()));
1082 for (
unsigned int k = 0; k < (*it)->descriptors.SURF.size(); k++)
1083 f.printf(
"%8.5f ", (*it)->descriptors.SURF[k]);
1086 f.printf(
"%2d ",
int((*it)->descriptors.hasDescriptorBLD() ? 1 : 0));
1087 if ((*it)->descriptors.hasDescriptorBLD())
1089 f.printf(
"%4d ",
int((*it)->descriptors.BLD.size()));
1090 for (
unsigned int k = 0; k < (*it)->descriptors.BLD.size(); k++)
1091 f.printf(
"%4d ", (*it)->descriptors.BLD[k]);
1094 f.printf(
"%2d ",
int((*it)->descriptors.hasDescriptorLATCH() ? 1 : 0));
1095 if ((*it)->descriptors.hasDescriptorLATCH())
1097 f.printf(
"%4d ",
int((*it)->descriptors.LATCH.size()));
1098 for (
unsigned int k = 0; k < (*it)->descriptors.LATCH.size(); k++)
1099 f.printf(
"%4d ", (*it)->descriptors.LATCH[k]);
1118 std::istringstream line;
1120 while (parser.getNextLine(line))
1135 if (!(line >> feat->x >> feat->y))
throw std::string(
"x,y");
1136 if (!(line >> feat->orientation))
throw std::string(
"orientation");
1137 if (!(line >> feat->scale))
throw std::string(
"scale");
1140 if (!(line >> _track_st))
throw std::string(
"track_status");
1143 if (!(line >> feat->response))
throw std::string(
"response");
1146 if (!(line >> hasSIFT))
throw std::string(
"hasSIFT");
1151 feat->descriptors.SIFT.resize(N);
1152 for (
size_t i = 0; i < N; i++)
1156 feat->descriptors.SIFT[i] =
1166 if (!(line >> hasBLD))
throw std::string(
"hasBLD");
1171 feat->descriptors.BLD.resize(N);
1172 for (
size_t i = 0; i < N; i++)
1176 feat->descriptors.BLD[i] =
1186 if (!(line >> hasLATCH))
throw std::string(
"hasLATCH");
1191 feat->descriptors.LATCH.resize(N);
1192 for (
size_t i = 0; i < N; i++)
1196 feat->descriptors.LATCH[i] =
1206 if (!(line >> hasSURF))
throw std::string(
"hasSURF");
1211 feat->descriptors.SURF.resize(N);
1212 for (
size_t i = 0; i < N; i++)
1213 line >> feat->descriptors.SURF[i];
1223 "%s:%d: Error parsing features text file (%s).",
1224 filename.c_str(), (int)parser.getCurrentLineNumber(),
1237 this->resize(otherList.
size());
1240 for (it1 = otherList.
begin(), it2 = this->
begin(); it1 != otherList.
end();
1244 (*it2).reset(dynamic_cast<CFeature*>((*it2)->clone()));
1254 if ((*it)->ID ==
ID)
return (*it);
1266 if ((*it)->ID ==
ID)
1279 const vector<TFeatureID>& IDs, vector<CFeature::Ptr>& out,
1280 vector<int>& outIndex)
const 1284 out.reserve(IDs.size());
1285 outIndex.reserve(IDs.size());
1287 for (
int k = 0; k < int(IDs.size()); ++k)
1292 outIndex.push_back(idx);
1300 const float x,
const float y,
double& dist_prev)
const 1304 float closest_x, closest_y;
1305 float closest_sqDist;
1308 const size_t closest_idx =
1309 this->kdTreeClosestPoint2D(
x,
y, closest_x, closest_y, closest_sqDist);
1310 float closest_dist = std::sqrt(closest_sqDist);
1312 if (closest_dist <= dist_prev)
1314 dist_prev = closest_dist;
1315 return m_feats[closest_idx];
1355 FILE* f =
os::fopen(filename.c_str(),
"wt");
1359 for (it = this->
begin(); it != this->
end(); it++)
1362 f,
"%d %.3f %.3f %d %.3f %.3f\n", (
unsigned int)(*it->first).ID,
1363 (*it->first).x, (*it->first).y, (
unsigned int)(*it->second).ID,
1364 (*it->second).x, (*it->second).y);
1377 for (it =
begin(); it !=
end(); ++it)
1380 if (feat->ID == ID)
return feat;
1436 list1[k] = it->first;
1437 list2[k] = it->second;
1480 desc.resize(nR, nC);
1482 for (
size_t r = 0;
r < nR;
r++)
1483 for (
size_t c = 0;
c < nC;
c++) 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.
std::shared_ptr< CFeature > Ptr
GLuint GLuint GLsizei count
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
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) override
Load all the params from a config source, in the format described in saveToConfigFile() ...
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.
bool hasDescriptorBLD() const
Whether this feature has this kind of descriptor.
Used in some methods to mean "any of the present descriptors".
void saveToConfigFile(mrpt::utils::CConfigFileBase &cfg, const std::string §ion) const override
This method saves the options to a ".ini"-like file or memory-stored string list. ...
std::vector< uint8_t > BLD
BLD feature descriptor.
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 void fclose(FILE *f)
An OS-independent version of fclose.
A class for storing images as grayscale or RGB bitmaps.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
int waitForKey(bool ignoreControlKeys=true, mrptKeyModifier *out_pushModifier=nullptr)
Waits for any key to be pushed on the image or the console, and returns the key code.
bool hasDescriptorLogPolarImg() const
Whether this feature has this kind of descriptor.
GLenum GLenum GLenum GLenum GLenum scale
TFeatureTrackStatus track_status
featKLT, featHarris, featSURF, featBeacon
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...
void dumpToTextStream(mrpt::utils::CStream &out) const override
This method should clearly display all the contents of the structure in textual form, sending it to a CStream.
void getByMultiIDs(const std::vector< TFeatureID > &IDs, std::vector< CFeature::Ptr > &out, std::vector< int > &outIndex) const
Get a vector of references to a subset of features from their IDs.
EIGEN_STRONG_INLINE iterator begin()
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction...
bool hasDescriptorSIFT() const
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.
for(ctr=DCTSIZE;ctr > 0;ctr--)
TInternalFeatList::const_iterator const_iterator
GLint GLint GLsizei GLsizei GLsizei depth
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=nullptr) const
Computes the correlation between this image and another one, encapsulating the openCV function cvMatc...
const Scalar * const_iterator
void saveToConfigFile(mrpt::utils::CConfigFileBase &cfg, const std::string §ion) const override
This method saves the options to a ".ini"-like file or memory-stored string list. ...
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.
bool hasDescriptorMultiSIFT() const
Whether this feature has this kind of descriptor.
void dumpToTextStream(mrpt::utils::CStream &out) const override
This method should clearly display all the contents of the structure in textual form, sending it to a CStream.
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.
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)
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.
This base provides a set of functions for maths stuff.
size_t getWidth() const override
Returns the width of the image in pixels.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const override
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.
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".
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
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.
size_t getHeight() const override
Returns the height of the image in pixels.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
std::deque< std::vector< double > > multiOrientations
multi-resolution descriptor has been computed
void readFromStream(mrpt::utils::CStream &in, int version) override
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
Classes for computer vision, detectors, features, etc.
uint16_t SpinImg_range_rows
The number of rows (corresponding to.
A generic 2D feature from an image, extracted with CFeatureExtraction Each feature may have one or mo...
float descriptorLATCHDistanceTo(const CFeature &oFeature, bool normalize_distances=true) const
Computes the Euclidean Distance between "this" and the "other" descriptors.
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.
int fprintf(FILE *fil, const char *format,...) noexcept MRPT_printf_format_check(2
An OS-independent version of fprintf.
CFeature::Ptr 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...
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.
bool hasDescriptorLATCH() const
Whether this feature has this kind of descriptor.
CFeature::Ptr 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...
struct mrpt::vision::CFeature::TDescriptors descriptors
void saveToTextFile(const std::string &fileName, bool APPEND=false)
Save feature list to a text file.
float response
process (old name: KLT_status)
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.
void write(const std::string §ion, const std::string &name, enum_t value, const int name_padding_width=-1, const int value_padding_width=-1, const std::string &comment=std::string())
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.
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...
std::vector< uint8_t > LATCH
LATCH feature 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.
Struct containing the options when matching multi-resolution SIFT-like descriptors.
TInternalFeatList::iterator iterator
Intensity-domain spin image descriptors.
FILE * fopen(const char *fileName, const char *mode) noexcept
An OS-independent version of fopen.
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.
float orientation
KLT_val)
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
float descriptorBLDDistanceTo(const CFeature &oFeature, bool normalize_distances=true) const
Computes the Euclidean Distance between "this" and the "other" descriptors.
GLuint GLuint GLsizei GLenum type
std::deque< std::vector< std::vector< int32_t > > > multiSIFTDescriptors
the call to "descriptorDistanceTo" will not consider all the rotations between polar image descriptor...
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...
CFeature::Ptr getByID(const TFeatureID &ID) const
Get a reference to a Feature from its ID.
double 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.
int sprintf(char *buf, size_t bufSize, const char *format,...) noexcept MRPT_printf_format_check(3
An OS-independent version of sprintf (Notice the bufSize param, which may be ignored in some compiler...
mrpt::math::CMatrix PolarImg
range bins in the 2D histogram) of the original matrix from which SpinImg was extracted as a vector...
void copyListFrom(const CFeatureList &otherList)
Copies the content of another CFeatureList inside this one.
bool isPointFeature() const
a HASH table of descriptors
bool hasDescriptorSURF() const
Whether this feature has this kind of descriptor.
std::vector< uint8_t > ORB
orientation and scale of the multiResolution feature (there is a vector of descriptors for each scale...