44 useOriFilter = cfg.read_bool(section,
"useOriFilter",
true,
false);
45 oriThreshold = cfg.read_double(section,
"oriThreshold", 0.2,
false);
46 lastSeenThreshold = cfg.read_int(section,
"lastSeenThreshold", 10,
false);
47 timesSeenThreshold = cfg.read_int(section,
"timesSeenThreshold", 5,
false);
48 minFeaturesToFind = cfg.read_int(section,
"minFeaturesToFind", 5,
false);
50 cfg.read_int(section,
"minFeaturesToBeLost", 5,
false);
52 useDepthFilter = cfg.read_bool(section,
"useDepthFilter",
true,
false);
55 cfg.read_double(section,
"matchingThreshold", 1e4,
false);
56 matchingRatioThreshold =
57 cfg.read_double(section,
"matchingRatioThreshold", 0.5,
false);
59 lowScl1 = cfg.read_int(section,
"lowScl1", 0,
false);
60 lowScl2 = cfg.read_int(section,
"lowScl1", 0,
false);
61 highScl1 = cfg.read_int(section,
"highScl1", 6,
false);
62 highScl2 = cfg.read_int(section,
"highScl2", 6,
false);
64 searchAreaSize = cfg.read_uint64_t(section,
"searchAreaSize", 20,
false);
75 cfg.
write(section,
"useOriFilter",
"true");
76 cfg.
write(section,
"oriThreshold", oriThreshold);
79 cfg.
write(section,
"useOriFilter",
"false");
82 cfg.
write(section,
"useDepthFilter",
"true");
84 cfg.
write(section,
"useDepthFilter",
"false");
86 cfg.
write(section,
"matchingThreshold", matchingThreshold);
87 cfg.
write(section,
"matchingRatioThreshold", matchingRatioThreshold);
88 cfg.
write(section,
"lowScl1", lowScl1);
89 cfg.
write(section,
"lowScl2", lowScl2);
90 cfg.
write(section,
"highScl1", highScl1);
91 cfg.
write(section,
"highScl2", highScl2);
93 cfg.
write(section,
"searchAreaSize", searchAreaSize);
94 cfg.
write(section,
"lastSeenThreshold", lastSeenThreshold);
95 cfg.
write(section,
"timesSeenThreshold", timesSeenThreshold);
96 cfg.
write(section,
"minFeaturesToFind", minFeaturesToFind);
97 cfg.
write(section,
"minFeaturesToBeLost", minFeaturesToBeLost);
105 out <<
"\n----------- [vision::TMultiResDescMatchOptions] ------------ \n";
106 out <<
"Use orientation filter?: ";
111 "ยท Orientation threshold: %.1f deg\n",
116 out <<
"Use depth filter?: ";
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);
141 out <<
"-------------------------------------------------------- \n";
153 basePSize = cfg.
read_uint64_t(section,
"basePSize", 23,
false);
154 comLScl = cfg.
read_int(section,
"comLScl", 0,
false);
155 comHScl = cfg.
read_int(section,
"comHScl", 6,
false);
159 computeDepth = cfg.
read_bool(section,
"computeDepth",
true,
false);
160 blurImage = cfg.
read_bool(section,
"blurImage",
true,
false);
164 baseline = cfg.
read_double(section,
"baseline", 0.0,
false);
166 cfg.
read_bool(section,
"computeHashCoeffs",
false,
false);
168 cfg.
read_vector(section,
"scales", vector<double>(), scales,
false);
169 if (scales.size() < 1)
188 cfg.
write(section,
"basePSize", basePSize);
189 cfg.
write(section,
"comLScl", comLScl);
190 cfg.
write(section,
"comHScl", comHScl);
191 cfg.
write(section,
"sg1", sg1);
192 cfg.
write(section,
"sg2", sg2);
193 cfg.
write(section,
"sg3", sg3);
195 cfg.
write(section,
"computeDepth", computeDepth ?
"true" :
"false");
196 cfg.
write(section,
"blurImage", blurImage ?
"true" :
"false");
197 cfg.
write(section,
"fx", fx);
198 cfg.
write(section,
"cx", cx);
199 cfg.
write(section,
"cy", cy);
200 cfg.
write(section,
"baseline", baseline);
202 section,
"computeHashCoeffs", computeHashCoeffs ?
"true" :
"false");
205 for (
double scale : scales)
207 cfg.
write(section,
"scales", buf);
215 out <<
"\n----------- [vision::TMultiResDescOptions] ------------ \n";
222 out <<
"Compute depth: ";
230 "Baseline: %.2f m\n", baseline);
235 out <<
"Compute Hash Coeffs: ";
236 if (computeHashCoeffs)
241 out <<
"Blur image previously: ";
250 out <<
"-------------------------------------------------------- \n";
255 out <<
"\n----------- [vision::CFeature] ------------ \n";
257 "Feature ID: %d\n", (
int)keypoint.ID);
259 "Coordinates: (%.2f,%.2f) px\n", keypoint.pt.x,
265 switch (track_status)
271 out <<
"[KLT] Out of bounds [KLT]\n";
274 out <<
"[KLT] Tracked\n";
277 out <<
"[KLT] Lost\n";
284 "Initial Depth: %.2f m\n", initialDepth);
287 "3D point: (%.2f,%.2f,%.2f) m\n", p3D.x, p3D.y,
289 out <<
"Is point feature?: ";
290 isPointFeature() ?
out <<
"Yes\n" :
out <<
"No\n";
292 out <<
"Has SIFT descriptor?: ";
293 descriptors.hasDescriptorSIFT() ?
out <<
"Yes\n" :
out <<
"No\n";
294 out <<
"Has SURF descriptor?: ";
295 descriptors.hasDescriptorSURF() ?
out <<
"Yes\n" :
out <<
"No\n";
296 out <<
"Has Spin image descriptor?: ";
297 descriptors.hasDescriptorSpinImg() ?
out <<
"Yes\n" :
out <<
"No\n";
298 out <<
"Has Polar descriptor?: ";
299 descriptors.hasDescriptorPolarImg() ?
out <<
"Yes\n" :
out <<
"No\n";
300 out <<
"Has Log Polar descriptor?: ";
301 descriptors.hasDescriptorLogPolarImg() ?
out <<
"Yes\n" :
out <<
"No\n";
302 out <<
"Has ORB descriptor?: ";
303 descriptors.hasDescriptorORB() ?
out <<
"Yes\n" :
out <<
"No\n";
305 out <<
"Has BLD descriptor?: ";
306 descriptors.hasDescriptorBLD() ?
out <<
"Yes\n" :
out <<
"No\n";
307 out <<
"Has LATCH descriptor?: ";
308 descriptors.hasDescriptorLATCH() ?
out <<
"Yes\n" :
out <<
"No\n";
317 out << keypoint.pt.x << keypoint.pt.y << keypoint.ID << patch << patchSize
318 << (uint32_t)type << (uint32_t)keypoint.track_status
319 << keypoint.response << orientation << keypoint.octave << user_flags
320 << depth << initialDepth << p3D << descriptors.SIFT << descriptors.SURF
321 << descriptors.SpinImg << descriptors.SpinImg_range_rows
322 << descriptors.PolarImg << descriptors.LogPolarImg
323 << descriptors.polarImgsNoRotation << descriptors.ORB << descriptors.BLD
324 << descriptors.LATCH;
336 uint32_t aux_type, aux_KLTS;
337 in >> keypoint.pt.x >> keypoint.pt.y >> keypoint.ID >> patch >>
338 patchSize >> aux_type >> aux_KLTS >> keypoint.response >>
339 orientation >> keypoint.octave >> user_flags;
342 in >> depth >> initialDepth >> p3D;
344 in >> descriptors.SIFT >> descriptors.SURF >> descriptors.SpinImg >>
345 descriptors.SpinImg_range_rows >> descriptors.PolarImg >>
346 descriptors.LogPolarImg >> descriptors.polarImgsNoRotation >>
347 descriptors.BLD >> descriptors.LATCH;
348 if (version > 1) in >> descriptors.ORB;
377 ASSERT_(patch->getWidth() == oFeature.
patch->getWidth());
378 ASSERT_(patch->getHeight() == oFeature.
patch->getHeight());
379 ASSERT_(patch->getHeight() > 0 && patch->getWidth() > 0);
383 *patch, *oFeature.
patch, x_max, y_max, max_val);
386 return d2f(0.5 - 0.5 * max_val);
396 bool normalize_distances)
const
401 if (descriptorToUse ==
descAny)
403 if (descriptors.hasDescriptorSIFT())
405 else if (descriptors.hasDescriptorSURF())
407 else if (descriptors.hasDescriptorSpinImg())
409 else if (descriptors.hasDescriptorPolarImg())
411 else if (descriptors.hasDescriptorLogPolarImg())
413 else if (descriptors.hasDescriptorORB())
416 else if (descriptors.hasDescriptorBLD())
418 else if (descriptors.hasDescriptorLATCH())
422 "Feature has no descriptors and descriptorToUse=descAny");
425 switch (descriptorToUse)
428 return descriptorSIFTDistanceTo(oFeature, normalize_distances);
430 return descriptorSURFDistanceTo(oFeature, normalize_distances);
432 return descriptorSpinImgDistanceTo(oFeature, normalize_distances);
436 return descriptorPolarImgDistanceTo(
437 oFeature, minAng, normalize_distances);
442 return descriptorLogPolarImgDistanceTo(
443 oFeature, minAng, normalize_distances);
446 return float(descriptorORBDistanceTo(oFeature));
449 return (descriptorBLDDistanceTo(oFeature));
451 return (descriptorLATCHDistanceTo(oFeature));
454 "Unknown value for 'descriptorToUse'=%u",
455 (
unsigned)descriptorToUse);
465 const CFeature& oFeature,
bool normalize_distances)
const
471 descriptors.hasDescriptorSIFT() &&
475 std::vector<unsigned char>::const_iterator itDesc1, itDesc2;
476 for (itDesc1 = descriptors.SIFT->begin(),
478 itDesc1 != descriptors.SIFT->end(); itDesc1++, itDesc2++)
480 dist +=
square(*itDesc1 - *itDesc2);
482 if (normalize_distances) dist /= descriptors.SIFT->size();
484 if (normalize_distances) dist /= 64.0f;
492 const CFeature& oFeature,
bool normalize_distances)
const
497 descriptors.hasDescriptorSURF() &&
501 std::vector<float>::const_iterator itDesc1, itDesc2;
502 for (itDesc1 = descriptors.SURF->begin(),
504 itDesc1 != descriptors.SURF->end(); itDesc1++, itDesc2++)
506 dist +=
square(*itDesc1 - *itDesc2);
508 if (normalize_distances) dist /= descriptors.SURF->size();
510 if (normalize_distances)
520 const CFeature& oFeature,
bool normalize_by_vector_length)
const
527 descriptors.hasDescriptorSpinImg() &&
529 ASSERT_(!descriptors.SpinImg->empty());
531 std::vector<float>::const_iterator itDesc1, itDesc2;
532 for (itDesc1 = descriptors.SpinImg->begin(),
534 itDesc1 != descriptors.SpinImg->end(); itDesc1++, itDesc2++)
536 dist +=
square(*itDesc1 - *itDesc2);
539 if (normalize_by_vector_length) dist /= 0.25f * descriptors.SpinImg->size();
549 bool normalize_distances,
bool dont_shift_angle)
554 unsigned int delta, i, j, ii, height = desc1.
rows(), width = desc1.
cols();
555 float dist, minDist = 0;
559 #define LM_CORR_METHOD_EUCLID
563 #if defined(LM_CORR_BIAS_MEAN) || defined(LM_CORR_METHOD_CORRELATION)
564 const float desc1_mean = desc1.
sum() /
d2f(width * height);
565 const float desc2_mean = desc2.
sum() /
d2f(width * height);
570 for (delta = 0; delta < height; delta++)
572 #if defined(LM_CORR_METHOD_CORRELATION)
579 for (i = 0; i < height; i++)
581 ii = (i + delta) % height;
582 for (j = 0; j < width; j++)
584 #ifdef LM_CORR_METHOD_EUCLID
585 #ifdef LM_CORR_BIAS_MEAN
587 desc1(i, j) - desc1_mean - desc2(ii, j) + desc2_mean);
589 dist +=
square(desc1(i, j) - desc2(ii, j));
591 #elif defined(LM_CORR_METHOD_MANHATTAN)
592 #ifdef LM_CORR_BIAS_MEAN
594 desc1(i, j) - desc1_mean - desc2(ii, j) + desc2_mean);
596 dist += std::abs(desc1(i, j) - desc2(ii, j));
598 #elif defined(LM_CORR_METHOD_CORRELATION)
599 float d1 = desc1(i, j) - desc1_mean;
600 float d2 = desc2(ii, j) - desc2_mean;
605 #error A LM_CORR_METHOD_XXX method must be selected!
611 if (normalize_distances) dist /=
d2f(width * height);
613 #ifdef LM_CORR_METHOD_EUCLID
617 #if defined(LM_CORR_METHOD_CORRELATION)
618 dist = 1 - (s12 / sqrt(s11 * s22));
621 distances[delta] = dist;
622 if (!delta && dont_shift_angle)
630 minDist = distances.
minCoeff(minDistIdx);
632 double dist_mean, dist_std;
637 cout <<
"min dist: " << minDist << endl;
640 win.plot(distances,
"b.4");
642 win.image(img1,0,-0.5,0.4*width,0.5,
"img1");
645 win.image(img2,0.6*width,-0.5,0.4*width,0.5,
"img2");
653 minDistAngle = minDistIdx *
d2f(
M_2PI / width);
663 const CFeature& oFeature,
float& minDistAngle,
664 bool normalize_distances)
const
674 descriptors.hasDescriptorPolarImg() &&
680 return internal_distanceBetweenPolarImages(
682 normalize_distances, descriptors.polarImgsNoRotation);
691 const CFeature& oFeature,
float& minDistAngle,
692 bool normalize_distances)
const
696 ASSERT_(descriptors.LogPolarImg);
698 descriptors.LogPolarImg->rows() ==
701 descriptors.LogPolarImg->cols() ==
704 descriptors.hasDescriptorLogPolarImg() &&
707 descriptors.LogPolarImg->rows() > 1 &&
708 descriptors.LogPolarImg->cols() > 1);
711 return internal_distanceBetweenPolarImages(
713 minDistAngle, normalize_distances, descriptors.polarImgsNoRotation);
724 descriptors.hasDescriptorORB() &&
727 const std::vector<uint8_t>& t_desc = *descriptors.ORB;
732 for (uint8_t k = 0; k < t_desc.size(); ++k)
737 uint8_t x_or = t_desc[k] ^ o_desc[k];
739 for (count = 0; x_or; count++)
752 const CFeature& oFeature,
bool normalize_distances)
const
756 descriptors.hasDescriptorBLD() &&
760 std::vector<unsigned char>::const_iterator itDesc1, itDesc2;
761 for (itDesc1 = descriptors.BLD->begin(),
763 itDesc1 != descriptors.BLD->end(); itDesc1++, itDesc2++)
765 dist +=
square(*itDesc1 - *itDesc2);
767 if (normalize_distances) dist /= descriptors.BLD->size();
769 if (normalize_distances) dist /= 64.0f;
777 const CFeature& oFeature,
bool normalize_distances)
const
781 descriptors.hasDescriptorLATCH() &&
785 std::vector<unsigned char>::const_iterator itDesc1, itDesc2;
786 for (itDesc1 = descriptors.LATCH->begin(),
788 itDesc1 != descriptors.LATCH->end(); itDesc1++, itDesc2++)
790 dist +=
square(*itDesc1 - *itDesc2);
792 if (normalize_distances) dist /= descriptors.LATCH->size();
794 if (normalize_distances) dist /= 64.0f;
821 if (!f.open(filename, APPEND))
823 "[CFeature::saveToTextFile] ERROR: File could not be open for "
827 "%5u %2d %7.3f %7.3f %6.2f %2d %2d %6.3f ", (
unsigned int)keypoint.ID,
828 (
int)get_type(), keypoint.pt.x, keypoint.pt.y, orientation,
829 keypoint.octave, (
int)keypoint.track_status, keypoint.response);
831 f.printf(
"%2d ",
int(descriptors.hasDescriptorSIFT() ? 1 : 0));
832 if (descriptors.hasDescriptorSIFT())
834 f.printf(
"%4d ",
int(descriptors.SIFT->size()));
835 for (
unsigned char k : *descriptors.SIFT) f.printf(
"%4d ", k);
838 f.printf(
"%2d ",
int(descriptors.hasDescriptorSURF() ? 1 : 0));
839 if (descriptors.hasDescriptorSURF())
841 f.printf(
"%4d ",
int(descriptors.SURF->size()));
842 for (
float k : *descriptors.SURF) f.printf(
"%8.5f ", k);
845 f.printf(
"%2d ",
int(descriptors.hasDescriptorORB() ? 1 : 0));
846 if (descriptors.hasDescriptorORB())
847 for (
unsigned char k : *descriptors.ORB) f.printf(
"%d ", k);
850 f.printf(
"%2d ",
int(descriptors.hasDescriptorBLD() ? 1 : 0));
851 if (descriptors.hasDescriptorBLD())
853 f.printf(
"%4d ",
int(descriptors.BLD->size()));
854 for (
unsigned char k : *descriptors.BLD) f.printf(
"%4d ", k);
857 f.printf(
"%2d ",
int(descriptors.hasDescriptorLATCH() ? 1 : 0));
858 if (descriptors.hasDescriptorLATCH())
860 f.printf(
"%4d ",
int(descriptors.LATCH->size()));
861 for (
unsigned char k : *descriptors.LATCH) f.printf(
"%4d ", k);
887 if (!f.open(filename, APPEND))
889 "[CFeatureList::saveToTextFile] ERROR: File could not be open for "
893 "%% Dump of mrpt::vision::CFeatureList. Each line format is:\n"
894 "%% ID TYPE X Y ORIENTATION SCALE TRACK_STATUS RESPONSE HAS_SIFT "
895 "[SIFT] HAS_SURF [SURF]\n"
896 "%% \\---------------------- feature ------------------/ \\--------- "
897 "descriptors -------/\n"
899 "%% TYPE : The used detector: 0:KLT, 1: Harris, 2: BCD, 3: SIFT, 4: "
900 "SURF, 5: Beacon, 6: FAST\n"
901 "%% HAS_* : 1 if a descriptor of that type is associated to the "
903 "%% SIFT : Present if HAS_SIFT=1: N DESC_0 ... DESC_N-1 \n"
904 "%% SURF : Present if HAS_SURF=1: N DESC_0 ... DESC_N-1 \n"
905 "%%--------------------------------------------------------------------"
906 "-----------------------\n");
908 for (
auto& feat : *
this)
911 "%5u %2d %7.3f %7.3f %6.2f %2d %2d %6.3f ",
912 (
unsigned int)feat.keypoint.ID, (
int)feat.get_type(),
913 feat.keypoint.pt.x, feat.keypoint.pt.y, feat.orientation,
914 feat.keypoint.octave, (
int)feat.track_status, feat.response);
916 f.printf(
"%2d ",
int(feat.descriptors.hasDescriptorSIFT() ? 1 : 0));
917 if (feat.descriptors.hasDescriptorSIFT())
919 f.printf(
"%4d ",
int(feat.descriptors.SIFT->size()));
920 for (
unsigned int k = 0; k < feat.descriptors.SIFT->size(); k++)
921 f.printf(
"%4d ", (*feat.descriptors.SIFT)[k]);
924 f.printf(
"%2d ",
int(feat.descriptors.hasDescriptorSURF() ? 1 : 0));
925 if (feat.descriptors.hasDescriptorSURF())
927 f.printf(
"%4d ",
int(feat.descriptors.SURF->size()));
928 for (
unsigned int k = 0; k < feat.descriptors.SURF->size(); k++)
929 f.printf(
"%8.5f ", (*feat.descriptors.SURF)[k]);
932 f.printf(
"%2d ",
int(feat.descriptors.hasDescriptorBLD() ? 1 : 0));
933 if (feat.descriptors.hasDescriptorBLD())
935 f.printf(
"%4d ",
int(feat.descriptors.BLD->size()));
936 for (
unsigned int k = 0; k < feat.descriptors.BLD->size(); k++)
937 f.printf(
"%4d ", (*feat.descriptors.BLD)[k]);
940 f.printf(
"%2d ",
int(feat.descriptors.hasDescriptorLATCH() ? 1 : 0));
941 if (feat.descriptors.hasDescriptorLATCH())
943 f.printf(
"%4d ",
int(feat.descriptors.LATCH->size()));
944 for (
unsigned int k = 0; k < feat.descriptors.LATCH->size(); k++)
945 f.printf(
"%4d ", (*feat.descriptors.LATCH)[k]);
964 std::istringstream line;
966 while (parser.getNextLine(line))
973 if (!(line >> _ID))
throw std::string(
"ID");
977 if (!(line >> _type))
throw std::string(
"type");
981 throw std::string(
"x,y");
982 if (!(line >> feat.
orientation))
throw std::string(
"orientation");
986 if (!(line >> _track_st))
throw std::string(
"track_status");
989 if (!(line >> feat.
response))
throw std::string(
"response");
992 if (!(line >> hasSIFT))
throw std::string(
"hasSIFT");
996 if (!(line >> N))
throw std::string(
"SIFT-len");
998 for (
size_t i = 0; i < N; i++)
1007 if (!line)
throw std::string(
"SIFT-data");
1012 if (!(line >> hasBLD))
throw std::string(
"hasBLD");
1016 if (!(line >> N))
throw std::string(
"BLD-len");
1018 for (
size_t i = 0; i < N; i++)
1025 if (!line)
throw std::string(
"BLD-data");
1029 if (!(line >> hasLATCH))
throw std::string(
"hasLATCH");
1033 if (!(line >> N))
throw std::string(
"LATCH-len");
1035 for (
size_t i = 0; i < N; i++)
1042 if (!line)
throw std::string(
"LATCH-data");
1046 if (!(line >> hasSURF))
throw std::string(
"hasSURF");
1050 if (!(line >> N))
throw std::string(
"SURF-len");
1052 for (
size_t i = 0; i < N; i++)
1054 if (!line)
throw std::string(
"SURF-data");
1057 emplace_back(std::move(feat));
1059 catch (std::string& msg)
1062 "%s:%d: Error parsing features text file (%s).",
1063 filename.c_str(), (
int)parser.getCurrentLineNumber(),
1079 for (it1 = otherList.
begin(), it2 =
begin(); it1 != otherList.
end();
1088 for (
const auto& f : *
this)
1089 if (f.keypoint.ID == ID)
return &f;
1097 for (
auto it =
begin(); it !=
end(); ++it, ++k)
1098 if (it->keypoint.ID == ID)
1111 const float x,
const float y,
double& dist_prev)
const
1113 if (
empty())
return nullptr;
1115 float closest_x, closest_y;
1116 float closest_sqDist;
1119 const size_t closest_idx =
1120 kdTreeClosestPoint2D(x, y, closest_x, closest_y, closest_sqDist);
1121 float closest_dist = std::sqrt(closest_sqDist);
1123 if (closest_dist <= dist_prev)
1125 dist_prev = closest_dist;
1126 return &m_feats[closest_idx];
1140 for (
const auto& f : *
this)
mrpt::keep_max(maxID, f.keypoint.ID);
1153 FILE* f =
os::fopen(filename.c_str(),
"wt");
1156 for (
const auto& p : *
this)
1159 f,
"%d %.3f %.3f %d %.3f %.3f\n",
1160 (
unsigned int)(p.first.keypoint.ID), p.first.keypoint.pt.x,
1161 p.first.keypoint.pt.y, (
unsigned int)(p.second.keypoint.ID),
1162 p.second.keypoint.pt.x, p.second.keypoint.pt.y);
1174 CMatchedFeatureList::iterator it;
1175 for (it =
begin(); it !=
end(); ++it)
1177 const auto& feat = (idx ==
firstList) ? it->first : it->second;
1178 if (feat.keypoint.ID == ID)
return &feat;
1191 for (
auto itList =
begin(); itList !=
end(); itList++)
1212 if (m_leftMaxID == 0) updateMaxID(
firstList);
1214 if (m_rightMaxID == 0) updateMaxID(
secondList);
1215 firstListID = m_leftMaxID;
1216 secondListID = m_rightMaxID;
1230 for (
auto it =
begin(); it !=
end(); ++it, ++k)
1232 list1[k] = it->first;
1233 list2[k] = it->second;
1243 if (descriptors.hasDescriptorSIFT())
1245 desc.
setSize(1, descriptors.SIFT->size());
1246 for (
size_t i = 0; i < descriptors.SIFT->size(); i++)
1247 desc(0, i) = (*descriptors.SIFT)[i];
1250 else if (descriptors.hasDescriptorBLD())
1252 desc.
setSize(1, descriptors.BLD->size());
1253 for (
size_t i = 0; i < descriptors.BLD->size(); i++)
1254 desc(0, i) = (*descriptors.BLD)[i];
1257 else if (descriptors.hasDescriptorLATCH())
1259 desc.
setSize(1, descriptors.LATCH->size());
1260 for (
size_t i = 0; i < descriptors.LATCH->size(); i++)
1261 desc(0, i) = (*descriptors.LATCH)[i];
1264 else if (descriptors.hasDescriptorSURF())
1266 desc.
setSize(1, descriptors.SURF->size());
1267 for (
size_t i = 0; i < descriptors.SURF->size(); i++)
1268 desc(0, i) = (*descriptors.SURF)[i];
1271 else if (descriptors.hasDescriptorSpinImg())
1273 const size_t nR = descriptors.SpinImg_range_rows;
1275 descriptors.SpinImg->
size() / descriptors.SpinImg_range_rows;
1277 auto itD = descriptors.SpinImg->begin();
1278 for (
size_t r = 0; r < nR; r++)
1279 for (
size_t c = 0; c < nC; c++) desc.
coeffRef(r, c) = *itD++;
1282 else if (descriptors.hasDescriptorPolarImg())
1284 desc = *descriptors.PolarImg;
1287 else if (descriptors.hasDescriptorLogPolarImg())
1289 desc = *descriptors.LogPolarImg;