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
597 itDesc1 != this->descriptors.SIFT.end(); itDesc1++, itDesc2++)
599 dist +=
square(*itDesc1 - *itDesc2);
603 if (normalize_distances) dist /= 64.0f;
611 const CFeature& oFeature,
bool normalize_distances)
const
622 itDesc1 != this->descriptors.SURF.end(); itDesc1++, itDesc2++)
624 dist +=
square(*itDesc1 - *itDesc2);
628 if (normalize_distances)
638 const CFeature& oFeature,
bool normalize_by_vector_length)
const
652 itDesc1 != this->descriptors.SpinImg.end(); itDesc1++, itDesc2++)
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
853 for (
uint8_t k = 0; k < t_desc.size(); ++k)
855 uint8_t x_or = t_desc[k] ^ o_desc[k];
872 const CFeature& oFeature,
bool normalize_distances)
const
883 itDesc1 != this->descriptors.BLD.end(); itDesc1++, itDesc2++)
885 dist +=
square(*itDesc1 - *itDesc2);
889 if (normalize_distances) dist /= 64.0f;
897 const CFeature& oFeature,
bool normalize_distances)
const
909 itDesc1 != this->descriptors.LATCH.end(); itDesc1++, itDesc2++)
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");
1140 if (!(line >> _track_st))
throw std::string(
"track_status");
1146 if (!(line >> hasSIFT))
throw std::string(
"hasSIFT");
1152 for (
size_t i = 0; i < N; i++)
1166 if (!(line >> hasBLD))
throw std::string(
"hasBLD");
1172 for (
size_t i = 0; i < N; i++)
1186 if (!(line >> hasLATCH))
throw std::string(
"hasLATCH");
1192 for (
size_t i = 0; i < N; i++)
1206 if (!(line >> hasSURF))
throw std::string(
"hasSURF");
1212 for (
size_t i = 0; i < N; 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++;
#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.
Create a GUI window and display plots with MATLAB-like interfaces and commands.
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.
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 is a "CSerializable" wrapper for "CMatrixFloat".
A matrix of dynamic size.
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction.
This class allows loading and storing values and vectors of different types from a configuration text...
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 ....
bool read_bool(const std::string §ion, const std::string &name, bool defaultValue, bool failIfNotFound=false) const
double read_double(const std::string §ion, const std::string &name, double defaultValue, bool failIfNotFound=false) const
int read_int(const std::string §ion, const std::string &name, int defaultValue, bool failIfNotFound=false) const
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())
This CStream derived class allow using a file as a write-only, binary stream.
A class for storing images as grayscale or RGB bitmaps.
size_t getHeight() const override
Returns the height of the image in pixels.
size_t getWidth() const override
Returns the width of the image in pixels.
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...
The virtual base class which provides a unified interface for all persistent objects in MRPT.
This CStdOutStream derived class allow printing to standard out, normally the console text output.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
virtual int printf(const char *fmt,...) MRPT_printf_format_check(2
Writes a string to the stream in a textual form.
A class for parsing text files, returning each non-empty and non-comment line, along its line number.
A generic 2D feature from an image, extracted with CFeatureExtraction Each feature may have one or mo...
TFeatureType type
be an odd number)
float descriptorSIFTDistanceTo(const CFeature &oFeature, bool normalize_distances=true) const
Computes the Euclidean Distance between "this" and the "other" descriptors.
struct mrpt::vision::CFeature::TDescriptors descriptors
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::deque< std::vector< double > > multiOrientations
multi-resolution descriptor has been computed
float response
process (old name: KLT_status)
float y
Coordinates in the image.
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...
bool isPointFeature() const
a HASH table of descriptors
mrpt::utils::CImage patch
A patch of the image surrounding the feature.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const override
Introduces a pure virtual method responsible for writing to a CStream.
float patchCorrelationTo(const CFeature &oFeature) const
Computes the normalized cross-correlation between the patches of this and another feature (normalized...
float scale
Feature scale into the scale space.
void dumpToTextStream(mrpt::utils::CStream &out) const
Dump feature information into a text stream.
float descriptorBLDDistanceTo(const CFeature &oFeature, bool normalize_distances=true) const
Computes the Euclidean Distance between "this" and the "other" descriptors.
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".
float descriptorSURFDistanceTo(const CFeature &oFeature, bool normalize_distances=true) const
Computes the Euclidean Distance between "this" and the "other" descriptors.
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,...
float descriptorSpinImgDistanceTo(const CFeature &oFeature, bool normalize_distances=true) const
Computes the Euclidean Distance between "this" and the "other" descriptors.
std::deque< double > multiScales
A set of scales where the.
float descriptorLATCHDistanceTo(const CFeature &oFeature, bool normalize_distances=true) const
Computes the Euclidean Distance between "this" and the "other" descriptors.
std::shared_ptr< CFeature > Ptr
uint8_t descriptorORBDistanceTo(const CFeature &oFeature) const
Computes the Hamming distance "this" and the "other" descriptor ORB descriptor.
void saveToTextFile(const std::string &filename, bool APPEND=false)
Save the feature to a text file in this format: "%% Dump of mrpt::vision::CFeatureList....
float orientation
KLT_val)
bool getFirstDescriptorAsMatrix(mrpt::math::CMatrixFloat &desc) const
Return the first found descriptor, as a matrix.
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,...
TFeatureID ID
ID of the feature.
TFeatureTrackStatus track_status
featKLT, featHarris, featSURF, featBeacon
void dumpToConsole() const
TFeatureType get_type() const
Get the type of the feature.
A list of visual features, to be used as output by detectors, as input/output by trackers,...
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...
CFeature::Ptr getByID(const TFeatureID &ID) const
Get a reference to a Feature from its ID.
void saveToTextFile(const std::string &fileName, bool APPEND=false)
Save feature list to a text file.
TFeatureID getMaxID() const
Get the maximum ID into the list.
virtual ~CFeatureList()
Virtual destructor.
TInternalFeatList::const_iterator const_iterator
TInternalFeatList::iterator iterator
void copyListFrom(const CFeatureList &otherList)
Copies the content of another CFeatureList inside this one.
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.
CFeatureList()
Constructor.
void loadFromTextFile(const std::string &fileName)
Save feature list to a text file.
virtual ~CMatchedFeatureList()
Virtual destructor.
void getBothFeatureLists(CFeatureList &list1, CFeatureList &list2)
Returns the matching features as two separate CFeatureLists.
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.
void updateMaxID(const TListIdx &idx)
Updates the value of the maximum ID of the features in the matched list, i.e.
void getMaxID(const TListIdx &idx, TFeatureID &firstListID, TFeatureID &secondListID)
Returns the maximum ID of the features in the list.
void saveToTextFile(const std::string &fileName)
Save list of matched features to a text file.
CMatchedFeatureList()
Constructor.
EIGEN_STRONG_INLINE bool empty() const
const Scalar * const_iterator
EIGEN_STRONG_INLINE void push_back(Scalar val)
Insert an element at the end of the container (for 1D vectors/arrays)
EIGEN_STRONG_INLINE iterator begin()
GLint GLint GLsizei GLsizei GLsizei depth
GLenum GLenum GLenum GLenum GLenum scale
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
GLuint GLuint GLsizei count
GLuint GLuint GLsizei GLenum type
GLdouble GLdouble GLdouble r
GLenum GLsizei GLsizei height
GLsizei const GLchar ** string
double distance(const TPoint2D &p1, const TPoint2D &p2)
Gets the distance between two points in a 2D space.
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...
int void fclose(FILE *f)
An OS-independent version of fclose.
FILE * fopen(const char *fileName, const char *mode) noexcept
An OS-independent version of fopen.
int fprintf(FILE *fil, const char *format,...) noexcept MRPT_printf_format_check(2
An OS-independent version of fprintf.
TDescriptorType
The bitwise OR combination of values of TDescriptorType are used in CFeatureExtraction::computeDescri...
TFeatureType
Types of features - This means that the point has been detected with this algorithm,...
uint64_t TFeatureID
Definition of a feature ID.
@ status_IDLE
Inactive (right after detection, and before being tried to track)
@ descLATCH
LATCH Line descriptor.
@ descSURF
SURF descriptors.
@ descBLD
BLD Line descriptor.
@ descLogPolarImages
Log-Polar image descriptor.
@ descSpinImages
Intensity-domain spin image descriptors.
@ descPolarImages
Polar image descriptor.
@ descSIFT
SIFT descriptors.
@ descORB
Bit-based feature descriptor.
@ descAny
Used in some methods to mean "any of the present descriptors".
@ featSURF
Speeded Up Robust Feature [BAY'06].
@ featSIFT
Scale Invariant Feature Transform [LOWE'04].
@ featNotDefined
Non-defined feature (also used for Occupancy features)
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
#define THROW_EXCEPTION(msg)
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
This base provides a set of functions for maths stuff.
T square(const T x)
Inline function for the square of a number.
void meanAndStd(const VECTORLIKE &v, double &out_mean, double &out_std, bool unbiased=true)
Computes the standard deviation of a vector.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...
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.
Classes for computer vision, detectors, features, etc.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
unsigned __int32 uint32_t
uint16_t SpinImg_range_rows
The number of rows (corresponding to.
bool hasDescriptorPolarImg() const
Whether this feature has this kind of descriptor.
mrpt::math::CMatrix PolarImg
range bins in the 2D histogram) of the original matrix from which SpinImg was extracted as a vector.
bool hasDescriptorSIFT() const
bool hasDescriptorMultiSIFT() const
Whether this feature has this kind of descriptor.
std::vector< uint8_t > LATCH
LATCH feature descriptor.
bool hasDescriptorSURF() const
Whether this feature has this kind of descriptor.
bool hasDescriptorORB() const
Whether this feature has this kind of descriptor.
std::vector< float > SpinImg
The 2D histogram as a single row.
std::vector< float > SURF
SURF feature descriptor.
std::deque< std::vector< std::vector< int32_t > > > multiSIFTDescriptors
the call to "descriptorDistanceTo" will not consider all the rotations between polar image descriptor...
bool hasDescriptorLATCH() const
Whether this feature has this kind of descriptor.
bool polarImgsNoRotation
If set to true (manually, default=false)
mrpt::math::CMatrix LogPolarImg
A log-polar image centered at the interest point.
bool hasDescriptorBLD() const
Whether this feature has this kind of descriptor.
std::vector< uint8_t > SIFT
SIFT feature descriptor.
bool hasDescriptorLogPolarImg() const
Whether this feature has this kind of descriptor.
std::vector< uint8_t > BLD
BLD feature descriptor.
std::vector< uint8_t > ORB
orientation and scale of the multiResolution feature (there is a vector of descriptors for each scale...
bool hasDescriptorSpinImg() const
Struct containing the options when matching multi-resolution SIFT-like 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.
void dumpToTextStream(mrpt::utils::CStream &out) const override
This method should clearly display all the contents of the structure in textual form,...
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()
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.
void dumpToTextStream(mrpt::utils::CStream &out) const override
This method should clearly display all the contents of the structure in textual form,...