43 useOriFilter = cfg.read_bool(section,
"useOriFilter",
true,
false);
44 oriThreshold = cfg.read_double(section,
"oriThreshold", 0.2,
false);
45 lastSeenThreshold = cfg.read_int(section,
"lastSeenThreshold", 10,
false);
46 timesSeenThreshold = cfg.read_int(section,
"timesSeenThreshold", 5,
false);
47 minFeaturesToFind = cfg.read_int(section,
"minFeaturesToFind", 5,
false);
49 cfg.read_int(section,
"minFeaturesToBeLost", 5,
false);
51 useDepthFilter = cfg.read_bool(section,
"useDepthFilter",
true,
false);
54 cfg.read_double(section,
"matchingThreshold", 1e4,
false);
55 matchingRatioThreshold =
56 cfg.read_double(section,
"matchingRatioThreshold", 0.5,
false);
58 lowScl1 = cfg.read_int(section,
"lowScl1", 0,
false);
59 lowScl2 = cfg.read_int(section,
"lowScl1", 0,
false);
60 highScl1 = cfg.read_int(section,
"highScl1", 6,
false);
61 highScl2 = cfg.read_int(section,
"highScl2", 6,
false);
63 searchAreaSize = cfg.read_double(section,
"searchAreaSize", 20,
false);
74 cfg.
write(section,
"useOriFilter",
"true");
75 cfg.
write(section,
"oriThreshold", oriThreshold);
78 cfg.
write(section,
"useOriFilter",
"false");
81 cfg.
write(section,
"useDepthFilter",
"true");
83 cfg.
write(section,
"useDepthFilter",
"false");
85 cfg.
write(section,
"matchingThreshold", matchingThreshold);
86 cfg.
write(section,
"matchingRatioThreshold", matchingRatioThreshold);
87 cfg.
write(section,
"lowScl1", lowScl1);
88 cfg.
write(section,
"lowScl2", lowScl2);
89 cfg.
write(section,
"highScl1", highScl1);
90 cfg.
write(section,
"highScl2", highScl2);
92 cfg.
write(section,
"searchAreaSize", searchAreaSize);
93 cfg.
write(section,
"lastSeenThreshold", lastSeenThreshold);
94 cfg.
write(section,
"timesSeenThreshold", timesSeenThreshold);
95 cfg.
write(section,
"minFeaturesToFind", minFeaturesToFind);
96 cfg.
write(section,
"minFeaturesToBeLost", minFeaturesToBeLost);
105 "\n----------- [vision::TMultiResDescMatchOptions] ------------ \n");
111 "ยท Orientation threshold: %.1f deg\n",
122 out <<
mrpt::format(
"Lowest scale in list1: %d\n", lowScl1);
123 out <<
mrpt::format(
"Highest scale in list1: %d\n", highScl1);
124 out <<
mrpt::format(
"Lowest scale in list2: %d\n", lowScl2);
125 out <<
mrpt::format(
"Highest scale in list2: %d\n", highScl2);
128 "#frames last seen threshold: %d\n", lastSeenThreshold);
130 "#frames to be stable threshold: %d\n", timesSeenThreshold);
132 "min. # features in system: %d\n", minFeaturesToFind);
134 "min. # features to be lost: %d\n", minFeaturesToBeLost);
136 "Matching threshold: %.2f\n", matchingThreshold);
138 "Matching ratio threshold: %.2f\n", matchingRatioThreshold);
140 "Size of the search window: %d px\n", searchAreaSize);
142 "-------------------------------------------------------- \n");
154 basePSize = cfg.
read_double(section,
"basePSize", 23,
false);
155 comLScl = cfg.
read_int(section,
"comLScl", 0,
false);
156 comHScl = cfg.
read_int(section,
"comHScl", 6,
false);
160 computeDepth = cfg.
read_bool(section,
"computeDepth",
true,
false);
161 blurImage = cfg.
read_bool(section,
"blurImage",
true,
false);
165 baseline = cfg.
read_double(section,
"baseline", 0.0,
false);
167 cfg.
read_bool(section,
"computeHashCoeffs",
false,
false);
169 cfg.
read_vector(section,
"scales", vector<double>(), scales,
false);
170 if (scales.size() < 1)
189 cfg.
write(section,
"basePSize", basePSize);
190 cfg.
write(section,
"comLScl", comLScl);
191 cfg.
write(section,
"comHScl", comHScl);
192 cfg.
write(section,
"sg1", sg1);
193 cfg.
write(section,
"sg2", sg2);
194 cfg.
write(section,
"sg3", sg3);
196 cfg.
write(section,
"computeDepth", computeDepth ?
"true" :
"false");
197 cfg.
write(section,
"blurImage", blurImage ?
"true" :
"false");
198 cfg.
write(section,
"fx", fx);
199 cfg.
write(section,
"cx", cx);
200 cfg.
write(section,
"cy", cy);
201 cfg.
write(section,
"baseline", baseline);
203 section,
"computeHashCoeffs", computeHashCoeffs ?
"true" :
"false");
206 for (
unsigned int k = 0; k < scales.size(); ++k)
208 cfg.
write(section,
"scales", buf);
217 "\n----------- [vision::TMultiResDescOptions] ------------ \n");
218 out <<
mrpt::format(
"Base patch size: %d px\n", basePSize);
219 out <<
mrpt::format(
"Lowest scale to compute: %d\n", comLScl);
220 out <<
mrpt::format(
"Highest scale to compute: %d\n", comHScl);
221 out <<
mrpt::format(
"Image smoothing sigma: %.2f px\n", sg1);
222 out <<
mrpt::format(
"Orientation histogram sigma: %.2f\n", sg2);
223 out <<
mrpt::format(
"Descriptor histogram sigma: %.2f\n", sg3);
229 out <<
mrpt::format(
"Principal point (cx): %.2f px\n", cx);
230 out <<
mrpt::format(
"Principal point (cy): %.2f px\n", cy);
232 "Baseline: %.2f m\n", baseline);
238 if (computeHashCoeffs)
250 for (
unsigned int k = 0; k < scales.size(); ++k)
254 "-------------------------------------------------------- \n");
259 out <<
mrpt::format(
"\n----------- [vision::CFeature] ------------ \n");
262 "Coordinates: (%.2f,%.2f) px\n",
x,
y);
311 switch (track_status)
328 out <<
mrpt::format(
"Main orientation: %.2f\n", orientation);
331 out <<
mrpt::format(
"# frames not seen: %d\n", nTimesNotSeen);
332 out <<
mrpt::format(
"# frames since last seen: %d\n", nTimesLastSeen);
334 "Initial Depth: %.2f m\n", initialDepth);
337 "3D point: (%.2f,%.2f,%.2f) m\n", p3D.x, p3D.y,
344 descriptors.hasDescriptorSIFT() ? out <<
mrpt::format(
"Yes\n")
347 descriptors.hasDescriptorSURF() ? out <<
mrpt::format(
"Yes\n")
350 descriptors.hasDescriptorSpinImg() ? out <<
mrpt::format(
"Yes\n")
353 descriptors.hasDescriptorPolarImg() ? out <<
mrpt::format(
"Yes\n")
356 descriptors.hasDescriptorLogPolarImg() ? out <<
mrpt::format(
"Yes\n")
359 descriptors.hasDescriptorORB() ? out <<
mrpt::format(
"Yes\n")
363 descriptors.hasDescriptorBLD() ? out <<
mrpt::format(
"Yes\n")
366 descriptors.hasDescriptorLATCH() ? out <<
mrpt::format(
"Yes\n")
370 if (!descriptors.hasDescriptorMultiSIFT())
374 out <<
mrpt::format(
"Yes [%d]\n", (
int)multiScales.size());
375 for (
int k = 0; k < (int)multiScales.size(); ++k)
377 out <<
mrpt::format(
" ยท Scale %d: %.2f\n", k, multiScales[k]);
378 for (
int m = 0; m < (int)multiOrientations[k].
size(); ++m)
381 " ยทยท Orientation %d: %.2f\n", m, multiOrientations[k][m]);
384 n < (int)descriptors.multiSIFTDescriptors[k][m].size();
387 "%d ", descriptors.multiSIFTDescriptors[k][m][
n]);
389 if (multiHashCoeffs.size() > 0)
391 " ยทยท HASH coefficients %d,%d,%d\n",
392 multiHashCoeffs[k][m][0], multiHashCoeffs[k][m][1],
393 multiHashCoeffs[k][m][2]);
405 << (
uint32_t)track_status << response << orientation <<
scale
406 << user_flags << nTimesSeen << nTimesNotSeen << nTimesLastSeen <<
depth
407 << initialDepth << p3D << multiScales << multiOrientations
408 << multiHashCoeffs << descriptors.SIFT << descriptors.SURF
409 << descriptors.SpinImg << descriptors.SpinImg_range_rows
410 << descriptors.PolarImg << descriptors.LogPolarImg
411 << descriptors.polarImgsNoRotation << descriptors.multiSIFTDescriptors
414 << descriptors.BLD << descriptors.LATCH;
427 in >>
x >>
y >> ID >> patch >> patchSize >> aux_type >> aux_KLTS >>
428 response >> orientation >>
scale >> user_flags;
431 in >> nTimesSeen >> nTimesNotSeen >> nTimesLastSeen >>
depth >>
432 initialDepth >> p3D >> multiScales >> multiOrientations >>
435 in >> descriptors.SIFT >> descriptors.SURF >> descriptors.SpinImg >>
436 descriptors.SpinImg_range_rows >> descriptors.PolarImg >>
437 descriptors.LogPolarImg >> descriptors.polarImgsNoRotation
439 >> descriptors.BLD >> descriptors.LATCH;
440 if (version > 0)
in >> descriptors.multiSIFTDescriptors;
441 if (version > 1)
in >> descriptors.ORB;
485 SpinImg_range_rows(0),
488 polarImgsNoRotation(false),
525 bool normalize_distances)
const
530 if (descriptorToUse ==
descAny)
551 "Feature has no descriptors and descriptorToUse=descAny")
554 switch (descriptorToUse)
566 oFeature, minAng, normalize_distances);
572 oFeature, minAng, normalize_distances);
583 "Unknown value for 'descriptorToUse'=%u",
584 (
unsigned)descriptorToUse);
594 const CFeature& oFeature,
bool normalize_distances)
const
605 itDesc1 != this->descriptors.SIFT.end(); itDesc1++, itDesc2++)
607 dist +=
square(*itDesc1 - *itDesc2);
611 if (normalize_distances) dist /= 64.0f;
619 const CFeature& oFeature,
bool normalize_distances)
const
630 itDesc1 != this->descriptors.SURF.end(); itDesc1++, itDesc2++)
632 dist +=
square(*itDesc1 - *itDesc2);
636 if (normalize_distances)
646 const CFeature& oFeature,
bool normalize_by_vector_length)
const
659 itDesc1 != this->descriptors.SpinImg.end(); itDesc1++, itDesc2++)
661 dist +=
square(*itDesc1 - *itDesc2);
674 bool normalize_distances,
bool dont_shift_angle)
679 unsigned int delta, i, j, ii,
height = desc1.rows(),
width = desc1.cols();
680 float dist, minDist = 0;
684 #define LM_CORR_METHOD_EUCLID
688 #if defined(LM_CORR_BIAS_MEAN) || defined(LM_CORR_METHOD_CORRELATION)
689 const float desc1_mean = desc1.sum() /
static_cast<float>(
width *
height);
690 const float desc2_mean = desc2.sum() /
static_cast<float>(
width *
height);
695 for (delta = 0; delta <
height; delta++)
697 #if defined(LM_CORR_METHOD_CORRELATION)
704 for (i = 0; i <
height; i++)
706 ii = (i + delta) %
height;
707 for (j = 0; j <
width; j++)
709 #ifdef LM_CORR_METHOD_EUCLID
710 #ifdef LM_CORR_BIAS_MEAN
712 desc1.get_unsafe(i, j) - desc1_mean -
713 desc2.get_unsafe(ii, j) + desc2_mean);
716 square(desc1.get_unsafe(i, j) - desc2.get_unsafe(ii, j));
718 #elif defined(LM_CORR_METHOD_MANHATTAN)
719 #ifdef LM_CORR_BIAS_MEAN
721 abs(desc1.get_unsafe(i, j) - desc1_mean -
722 desc2.get_unsafe(ii, j) + desc2_mean);
724 dist += abs(desc1.get_unsafe(i, j) - desc2.get_unsafe(ii, j));
726 #elif defined(LM_CORR_METHOD_CORRELATION)
727 float d1 = desc1.get_unsafe(i, j) - desc1_mean;
728 float d2 = desc2.get_unsafe(ii, j) - desc2_mean;
733 #error A LM_CORR_METHOD_XXX method must be selected!
739 if (normalize_distances) dist /=
static_cast<float>(
width *
height);
741 #ifdef LM_CORR_METHOD_EUCLID
745 #if defined(LM_CORR_METHOD_CORRELATION)
746 dist = 1 - (s12 / sqrt(s11 * s22));
749 distances[delta] = dist;
750 if (!delta && dont_shift_angle)
758 minDist = distances.minimum(&minDistIdx);
760 double dist_mean, dist_std;
765 cout <<
"min dist: " << minDist << endl;
768 win.plot(distances,
"b.4");
770 win.image(img1,0,-0.5,0.4*
width,0.5,
"img1");
781 minDistAngle = minDistIdx *
M_2PI /
static_cast<float>(
width);
791 const CFeature& oFeature,
float& minDistAngle,
792 bool normalize_distances)
const
817 const CFeature& oFeature,
float& minDistAngle,
818 bool normalize_distances)
const
857 for (
uint8_t k = 0; k < t_desc.size(); ++k)
859 uint8_t x_or = t_desc[k] ^ o_desc[k];
876 const CFeature& oFeature,
bool normalize_distances)
const
887 itDesc1 != this->descriptors.BLD.end(); itDesc1++, itDesc2++)
889 dist +=
square(*itDesc1 - *itDesc2);
893 if (normalize_distances) dist /= 64.0f;
901 const CFeature& oFeature,
bool normalize_distances)
const
913 itDesc1 != this->descriptors.LATCH.end(); itDesc1++, itDesc2++)
915 dist +=
square(*itDesc1 - *itDesc2);
919 if (normalize_distances) dist /= 64.0f;
946 if (!f.open(filename, APPEND))
948 "[CFeature::saveToTextFile] ERROR: File could not be open for "
952 "%5u %2d %7.3f %7.3f %6.2f %6.2f %2d %6.3f ", (
unsigned int)this->
ID,
961 f.printf(
"%4d ", this->descriptors.SIFT[k]);
969 f.printf(
"%8.5f ", this->descriptors.SURF[k]);
975 for (
int k = 0; k < int(this->
multiScales.size()); ++k)
985 for (
unsigned int n = 0;
990 this->descriptors.multiSIFTDescriptors[k][m][
n]);
998 f.printf(
"%d ", this->descriptors.ORB[k]);
1006 f.printf(
"%4d ", this->descriptors.BLD[k]);
1014 f.printf(
"%4d ", this->descriptors.LATCH[k]);
1045 if (!f.open(filename, APPEND))
1047 "[CFeatureList::saveToTextFile] ERROR: File could not be open for "
1051 "%% Dump of mrpt::vision::CFeatureList. Each line format is:\n"
1052 "%% ID TYPE X Y ORIENTATION SCALE TRACK_STATUS RESPONSE HAS_SIFT "
1053 "[SIFT] HAS_SURF [SURF]\n"
1054 "%% \\---------------------- feature ------------------/ \\--------- "
1055 "descriptors -------/\n"
1057 "%% TYPE : The used detector: 0:KLT, 1: Harris, 2: BCD, 3: SIFT, 4: "
1058 "SURF, 5: Beacon, 6: FAST\n"
1059 "%% HAS_* : 1 if a descriptor of that type is associated to the "
1061 "%% SIFT : Present if HAS_SIFT=1: N DESC_0 ... DESC_N-1 \n"
1062 "%% SURF : Present if HAS_SURF=1: N DESC_0 ... DESC_N-1 \n"
1063 "%%--------------------------------------------------------------------"
1064 "-----------------------\n");
1069 "%5u %2d %7.3f %7.3f %6.2f %6.2f %2d %6.3f ",
1070 (
unsigned int)(*it)->ID, (int)(*it)->get_type(), (*it)->x, (*it)->y,
1071 (*it)->orientation, (*it)->scale, (int)(*it)->track_status,
1074 f.printf(
"%2d ",
int((*it)->descriptors.hasDescriptorSIFT() ? 1 : 0));
1075 if ((*it)->descriptors.hasDescriptorSIFT())
1077 f.printf(
"%4d ",
int((*it)->descriptors.SIFT.size()));
1078 for (
unsigned int k = 0; k < (*it)->descriptors.SIFT.size(); k++)
1079 f.printf(
"%4d ", (*it)->descriptors.SIFT[k]);
1082 f.printf(
"%2d ",
int((*it)->descriptors.hasDescriptorSURF() ? 1 : 0));
1083 if ((*it)->descriptors.hasDescriptorSURF())
1085 f.printf(
"%4d ",
int((*it)->descriptors.SURF.size()));
1086 for (
unsigned int k = 0; k < (*it)->descriptors.SURF.size(); k++)
1087 f.printf(
"%8.5f ", (*it)->descriptors.SURF[k]);
1090 f.printf(
"%2d ",
int((*it)->descriptors.hasDescriptorBLD() ? 1 : 0));
1091 if ((*it)->descriptors.hasDescriptorBLD())
1093 f.printf(
"%4d ",
int((*it)->descriptors.BLD.size()));
1094 for (
unsigned int k = 0; k < (*it)->descriptors.BLD.size(); k++)
1095 f.printf(
"%4d ", (*it)->descriptors.BLD[k]);
1098 f.printf(
"%2d ",
int((*it)->descriptors.hasDescriptorLATCH() ? 1 : 0));
1099 if ((*it)->descriptors.hasDescriptorLATCH())
1101 f.printf(
"%4d ",
int((*it)->descriptors.LATCH.size()));
1102 for (
unsigned int k = 0; k < (*it)->descriptors.LATCH.size(); k++)
1103 f.printf(
"%4d ", (*it)->descriptors.LATCH[k]);
1122 std::istringstream line;
1124 while (parser.getNextLine(line))
1139 if (!(line >> feat->
x >> feat->
y))
throw std::string(
"x,y");
1144 if (!(line >> _track_st))
throw std::string(
"track_status");
1150 if (!(line >> hasSIFT))
throw std::string(
"hasSIFT");
1156 for (
size_t i = 0; i < N; i++)
1170 if (!(line >> hasBLD))
throw std::string(
"hasBLD");
1176 for (
size_t i = 0; i < N; i++)
1190 if (!(line >> hasLATCH))
throw std::string(
"hasLATCH");
1196 for (
size_t i = 0; i < N; i++)
1210 if (!(line >> hasSURF))
throw std::string(
"hasSURF");
1216 for (
size_t i = 0; i < N; i++)
1227 "%s:%d: Error parsing features text file (%s).",
1228 filename.c_str(), (
int)parser.getCurrentLineNumber(),
1241 this->resize(otherList.
size());
1244 for (it1 = otherList.
begin(), it2 = this->begin(); it1 != otherList.
end();
1248 (*it2).reset(
dynamic_cast<CFeature*
>((*it2)->clone()));
1258 if ((*it)->ID ==
ID)
return (*it);
1270 if ((*it)->ID ==
ID)
1283 const vector<TFeatureID>& IDs, vector<CFeature::Ptr>& out,
1284 vector<int>& outIndex)
const
1288 out.reserve(IDs.size());
1289 outIndex.reserve(IDs.size());
1291 for (
int k = 0; k < int(IDs.size()); ++k)
1296 outIndex.push_back(idx);
1304 const float x,
const float y,
double& dist_prev)
const
1308 float closest_x, closest_y;
1309 float closest_sqDist;
1312 const size_t closest_idx =
1313 this->kdTreeClosestPoint2D(
x,
y, closest_x, closest_y, closest_sqDist);
1314 float closest_dist = std::sqrt(closest_sqDist);
1316 if (closest_dist <= dist_prev)
1318 dist_prev = closest_dist;
1319 return m_feats[closest_idx];
1359 FILE* f =
os::fopen(filename.c_str(),
"wt");
1363 for (it = this->
begin(); it != this->
end(); it++)
1366 f,
"%d %.3f %.3f %d %.3f %.3f\n", (
unsigned int)(*it->first).ID,
1367 (*it->first).x, (*it->first).y, (
unsigned int)(*it->second).ID,
1368 (*it->second).x, (*it->second).y);
1381 for (it =
begin(); it !=
end(); ++it)
1384 if (feat->ID == ID)
return feat;
1440 list1[k] = it->first;
1441 list2[k] = it->second;
1484 desc.resize(nR, nC);
1486 for (
size_t r = 0;
r < nR;
r++)
1487 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.
This class allows loading and storing values and vectors of different types from a configuration text...
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())
bool read_bool(const std::string §ion, const std::string &name, bool defaultValue, bool failIfNotFound=false) const
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 ....
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
Create a GUI window and display plots with MATLAB-like interfaces and commands.
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...
This CStream derived class allow using a file as a write-only, binary stream.
A class for parsing text files, returning each non-empty and non-comment line, along its line number.
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.
Virtual base class for "archives": classes abstracting I/O streams.
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
void dumpToTextStream(std::ostream &out) const
Dump feature information into a text stream.
float response
process (old name: KLT_status)
float y
Coordinates in the image.
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
bool isPointFeature() const
a HASH table of descriptors
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.
mrpt::img::CImage patch
A patch of the image surrounding the feature.
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.
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
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.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
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.
TInternalFeatList::const_iterator const_iterator
TFeatureID getMaxID() const
Get the maximum ID into the list.
virtual ~CFeatureList()
Virtual destructor.
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.
TInternalFeatList::iterator iterator
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
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()
const Scalar * const_iterator
#define ASSERT_(f)
Defines an assertion mechanism.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
#define THROW_EXCEPTION(msg)
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
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.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
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.
uint64_t TFeatureID
Definition of a feature ID.
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,...
@ 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)
This base provides a set of functions for maths stuff.
void meanAndStd(const VECTORLIKE &v, double &out_mean, double &out_std, bool unbiased=true)
Computes the standard deviation of a vector.
mrpt::config::CConfigFileBase CConfigFileBase
Classes for computer vision, detectors, features, etc.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
T square(const T x)
Inline function for the square of a number.
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 RAD2DEG(const double x)
Radians to degrees.
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::config::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(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form,...
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form,...
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string §ion) override
Load all the params from a config source, in the format described in saveToConfigFile()
void saveToConfigFile(mrpt::config::CConfigFileBase &cfg, const std::string §ion) const override
This method saves the options to a ".ini"-like file or memory-stored string list.
mrpt::gui::CDisplayWindow3D::Ptr win