30 #include <mrpt/otherlibs/do_opencv_includes.h> 57 const CImage&
img,
const CImage& patch_img,
size_t& x_max,
size_t& y_max,
58 double& max_val,
int x_search_ini,
int y_search_ini,
int x_search_size,
65 CvPoint min_point, max_point;
68 (x_search_ini < 0 || y_search_ini < 0 || x_search_size < 0 ||
82 const_cast<IplImage*>(
img.getAs<IplImage>()));
84 const_cast<IplImage*>(patch_img.
getAs<IplImage>()));
89 const int patch_w = patch_im.
getWidth();
94 x_search_size = im_w - patch_w;
95 y_search_size = im_h - patch_h;
99 if ((x_search_ini + x_search_size + patch_w) > im_w)
100 x_search_size -= (x_search_ini + x_search_size + patch_w) - im_w;
102 if ((y_search_ini + y_search_size + patch_h) > im_h)
103 y_search_size -= (y_search_ini + y_search_size + patch_h) - im_h;
105 ASSERT_((x_search_ini + x_search_size + patch_w) <= im_w);
106 ASSERT_((y_search_ini + y_search_size + patch_h) <= im_h);
107 IplImage* result = cvCreateImage(
108 cvSize(x_search_size + 1, y_search_size + 1), IPL_DEPTH_32F, 1);
110 CImage img_region_to_search;
120 img_region_to_search,
123 patch_w + x_search_size,
124 patch_h + y_search_size);
129 img_region_to_search.
getAs<IplImage>(), patch_im.
getAs<IplImage>(),
130 result, CV_TM_CCORR_NORMED);
133 cvMinMaxLoc(result, &mini, &max_val, &min_point, &max_point,
nullptr);
134 x_max = max_point.x + x_search_ini + (
mrpt::round(patch_w - 1) >> 1);
135 y_max = max_point.y + y_search_ini + (
mrpt::round(patch_h - 1) >> 1);
138 cvReleaseImage(&result);
141 THROW_EXCEPTION(
"The MRPT has been compiled with MRPT_HAS_OPENCV=0 !");
155 cvFlip(
img.getAs<IplImage>());
157 img.setOriginTopLeft(
true);
159 THROW_EXCEPTION(
"The MRPT has been compiled with MRPT_HAS_OPENCV=0 !");
173 res.x = xy.
x - A.get_unsafe(0, 2);
174 res.y = xy.
y - A.get_unsafe(1, 2);
175 res.z = A.get_unsafe(0, 0);
178 const double u =
res.norm();
189 const double focalLengthX,
const double focalLengthY,
const double centerX,
190 const double centerY)
194 A(0, 0) = focalLengthX;
195 A(1, 1) = focalLengthY;
208 unsigned int camIndex,
unsigned int resX,
unsigned int resY)
210 float fx, fy, cx, cy;
233 "Unknown camera index!! for 'camIndex'=%u", camIndex);
238 resX * fx, resY * fy, resX * cx, resY * cy);
247 float lx = 0.0, ly = 0.0;
250 for (itList1 = feat_list.
begin(); itList1 != feat_list.
end(); itList1++)
254 for (itList2 = itList1; itList2 != feat_list.
end(); itList2++)
256 if ((lx == (*itList2)->x && ly == (*itList2)->y) &&
257 ((*itList2)->x > 0.0f && (*itList2)->y > 0.0f))
259 (*itList2)->x = -1.0f;
260 (*itList2)->y = -1.0f;
266 for (itList1 = feat_list.
begin(); itList1 != feat_list.
end();)
268 if ((*itList1)->x == -1.0f && (*itList1)->y == -1.0f)
269 itList1 = feat_list.
erase(itList1);
284 std::cout << std::endl
285 <<
"[ROW CHECKING]------------------------------------------" 289 for (itLeft = leftList.
begin(), itRight = rightList.
begin();
290 itLeft != leftList.
end();)
292 if ((*itLeft)->x < 0 || (*itLeft)->y < 0 || (*itRight)->x < 0 ||
293 (*itRight)->y < 0 || fabs((*itLeft)->y - (*itRight)->y) > threshold)
295 std::cout <<
"[Erased Feature] Row Dif: " 296 << fabs((*itLeft)->y - (*itRight)->y) << std::endl;
297 itLeft = leftList.
erase(itLeft);
298 itRight = rightList.
erase(itRight);
307 std::cout <<
"------------------------------------------" << std::endl;
309 std::cout <<
"Tracked features: " << leftList.
size() <<
" and " 310 << rightList.
size() << std::endl;
325 double varx = 0, vary = 0;
327 for (it = list.
begin(); it != list.
end(); it++)
335 for (it = list.
begin(); it != list.
end(); it++)
359 for (it = feat_list.begin(); it != feat_list.end(); it++)
361 err.
x = it->other_x - (it->this_x * mat.get_unsafe(0, 0) +
362 it->this_y * mat.get_unsafe(0, 1) +
363 it->this_z * mat.get_unsafe(0, 2) + Rt.
x());
364 err.
y = it->other_y - (it->this_x * mat.get_unsafe(1, 0) +
365 it->this_y * mat.get_unsafe(1, 1) +
366 it->this_z * mat.get_unsafe(1, 2) + Rt.
y());
367 err.
z = it->other_z - (it->this_x * mat.get_unsafe(2, 0) +
368 it->this_y * mat.get_unsafe(2, 1) +
369 it->this_z * mat.get_unsafe(2, 2) + Rt.z());
374 return (acum / feat_list.size());
391 if (itLand1->ID == itLand2->ID)
396 pair.
this_x = itLand1->pose_mean.x;
397 pair.
this_y = itLand1->pose_mean.y;
398 pair.
this_z = itLand1->pose_mean.z;
400 pair.
other_x = itLand2->pose_mean.x;
401 pair.
other_y = itLand2->pose_mean.y;
402 pair.
other_z = itLand2->pose_mean.z;
404 outList.push_back(pair);
415 float orientation = 0;
416 if ((
int(
x) - 1 >= 0) && (
int(
y) - 1 >= 0) && (
x + 1 <
image.getWidth()) &&
417 (
y + 1 <
image.getHeight()))
418 orientation = (float)atan2(
439 nim.resize(
image.getHeight(),
image.getWidth());
441 image.getAsMatrix(im);
444 im.meanAndStdAll(m,
s);
446 for (
int k1 = 0; k1 < (int)nim.cols(); ++k1)
447 for (
int k2 = 0; k2 < (int)nim.rows(); ++k2)
448 nim.set_unsafe(k2, k1, (im.get_unsafe(k2, k1) - m) /
s);
466 size_t sz1 = list1.
size(), sz2 = list2.
size();
468 ASSERT_((sz1 > 0) && (sz2 > 0));
485 double minSAD1, minSAD2;
487 vector<int> idxLeftList, idxRightList;
490 vector<double> distCorrs(sz1);
492 int minLeftIdx = 0, minRightIdx;
496 for (lFeat = 0, itList1 = list1.
begin(); itList1 != list1.
end();
514 for (rFeat = 0, itList2 = list2.
begin(); itList2 != list2.
end();
522 d = (*itList1)->y - (*itList2)->y;
529 TPoint2D oPoint((*itList2)->x, (*itList2)->y);
532 p(0, 0) = (*itList1)->x;
533 p(1, 0) = (*itList1)->y;
538 epiLine.
coefs[0] = l(0, 0);
539 epiLine.
coefs[1] = l(1, 0);
540 epiLine.
coefs[2] = l(2, 0);
550 ? ((*itList1)->x - (*itList2)->x) > 0
561 (*itList1)->descriptors.hasDescriptorSIFT() &&
562 (*itList2)->descriptors.hasDescriptorSIFT());
566 (*itList1)->descriptorSIFTDistanceTo(*(*itList2));
569 if (distDesc < minDist1)
576 else if (distDesc < minDist2)
589 (*itList1)->patchSize > 0 &&
590 (*itList2)->patchSize > 0);
592 (*itList1)->patch, (*itList2)->patch, u,
v,
res);
602 else if (
res > maxCC2)
612 (*itList1)->descriptors.hasDescriptorSURF() &&
613 (*itList2)->descriptors.hasDescriptorSURF());
617 (*itList1)->descriptorSURFDistanceTo(*(*itList2));
620 if (distDesc < minDist1)
627 else if (distDesc < minDist2)
637 (*itList1)->descriptors.hasDescriptorORB() &&
638 (*itList2)->descriptors.hasDescriptorORB());
640 (*itList1)->descriptorORBDistanceTo(*(*itList2));
643 if (distDesc < minDist1)
650 else if (distDesc < minDist2)
660 (*itList1)->patchSize > 0 &&
661 (*itList2)->patchSize == (*itList1)->patchSize);
664 "MRPT has been compiled without OpenCV");
666 IplImage *aux1, *aux2;
667 if ((*itList1)->patch.isColor() &&
668 (*itList2)->patch.isColor())
670 const IplImage* preAux1 =
671 (*itList1)->patch.getAs<IplImage>();
672 const IplImage* preAux2 =
673 (*itList2)->patch.getAs<IplImage>();
675 aux1 = cvCreateImage(
677 (*itList1)->patch.getHeight(),
678 (*itList1)->patch.getWidth()),
680 aux2 = cvCreateImage(
682 (*itList2)->patch.getHeight(),
683 (*itList2)->patch.getWidth()),
686 cvCvtColor(preAux1, aux1, CV_BGR2GRAY);
687 cvCvtColor(preAux2, aux2, CV_BGR2GRAY);
691 aux1 =
const_cast<IplImage*
>(
692 (*itList1)->patch.getAs<IplImage>());
693 aux2 =
const_cast<IplImage*
>(
694 (*itList2)->patch.getAs<IplImage>());
719 for (
unsigned int ii = 0;
720 ii < (
unsigned int)aux1->height; ++ii)
721 for (
unsigned int jj = 0;
722 jj < (
unsigned int)aux1->width; ++jj)
724 (
double)(aux1->imageData[ii * aux1->widthStep + jj]) -
725 ((
double)(aux2->imageData[ii * aux2->widthStep + jj])));
726 res =
res / (255.0f * aux1->width * aux1->height);
735 else if (
res < minSAD2)
744 bool cond1 =
false, cond2 =
false;
752 cond2 = (minDist1 / minDist2) <
759 cond2 = (maxCC2 / maxCC1) <
769 (minDist1 / minDist2) <
775 cond2 = (minSAD1 / minSAD2) < options.
SAD_RATIO;
790 int auxIdx = idxRightList[minRightIdx];
793 if (distCorrs[auxIdx] > minVal)
803 distCorrs[minLeftIdx] = minVal;
804 idxLeftList[minLeftIdx] = minRightIdx;
805 idxRightList[minRightIdx] = minLeftIdx;
807 distCorrs[auxIdx] = 1.0;
819 idxRightList[minRightIdx] = minLeftIdx;
820 idxLeftList[minLeftIdx] = minRightIdx;
821 distCorrs[minLeftIdx] = minVal;
832 for (
int vCnt = 0; vCnt < (int)idxLeftList.size(); ++vCnt)
836 std::pair<CFeature::Ptr, CFeature::Ptr> thisMatch;
839 double dp1 = -1.0, dp2 = -1.0;
844 list1[vCnt], list2[idxLeftList[vCnt]], p3D,
params);
854 dp1 = sqrt(p3D.
x * p3D.
x + p3D.
y * p3D.
y + p3D.
z * p3D.
z);
857 p3D.
y * p3D.
y + p3D.
z * p3D.
z);
867 thisMatch.first = list1[vCnt];
868 thisMatch.second = list2[idxLeftList[vCnt]];
873 idLeft = thisMatch.first->ID;
874 idRight = thisMatch.second->ID;
878 keep_max(idLeft, thisMatch.first->ID);
881 keep_max(idRight, thisMatch.second->ID);
888 thisMatch.first->initialDepth = dp1;
889 thisMatch.first->p3D = p3D;
891 thisMatch.second->initialDepth = dp2;
892 thisMatch.second->p3D =
897 matches.push_back(thisMatch);
901 return matches.size();
919 int hwsize = (int)(0.5 * wSize);
920 int mx = mask1.
cols(), my = mask1.
rows();
924 for (it = mList.begin(); it != mList.end(); ++it)
926 for (
int ii = -hwsize; ii < hwsize; ++ii)
927 for (
int jj = -hwsize; jj < hwsize; ++jj)
929 idx = (int)(it->first->x) + ii;
930 idy = (int)(it->first->y) + jj;
931 if (idx >= 0 && idy >= 0 && idx < mx && idy < my)
935 for (
int ii = -hwsize; ii < hwsize; ++ii)
936 for (
int jj = -hwsize; jj < hwsize; ++jj)
938 idx = (int)(it->second->x) + ii;
939 idy = (int)(it->second->y) + jj;
940 if (idx >= 0 && idy >= 0 && idx < mx && idy < my)
953 const IplImage* im1 = patch1.
getAs<IplImage>();
954 const IplImage* im2 = patch2.
getAs<IplImage>();
956 ASSERT_(im1->width == im2->width && im1->height == im2->height);
958 for (
unsigned int ii = 0; ii < (
unsigned int)im1->height; ++ii)
959 for (
unsigned int jj = 0; jj < (
unsigned int)im1->width; ++jj)
961 (
double)(im1->imageData[ii * im1->widthStep + jj]) -
962 ((
double)(im2->imageData[ii * im2->widthStep + jj])));
963 return res / (255.0f * im1->width * im1->height);
966 "MRPT compiled without OpenCV, can't compute SAD of images!")
981 (*it)->x - 5, (*it)->y - 5, (*it)->x + 5, (*it)->y + 5,
993 out_points.reserve(matches.size());
995 it != matches.end(); ++it)
997 const double disp = it->first->x - it->second->x;
998 if (disp < 1)
continue;
1001 out_points.push_back(
1015 vP3D.reserve(leftList.
size());
1017 for (it1 = leftList.
begin(), it2 = rightList.
begin(); it1 != leftList.
end();
1023 vP3D.push_back(p3D);
1046 const double f0 = 600;
1047 double nfx1 = leftFeat->x, nfy1 = leftFeat->y,
1048 nfx2 = rightFeat->x;
1050 const double x = leftFeat->x * f0;
1051 const double y = leftFeat->y * f0;
1052 const double xd = rightFeat->x * f0;
1053 const double yd = rightFeat->y * f0;
1055 const double f2 = f0 * f0;
1056 const double p9 = f2 *
params.F.get_unsafe(2, 2);
1058 f2 * (
params.F.get_unsafe(0, 2) *
params.F.get_unsafe(0, 2) +
1059 params.F.get_unsafe(1, 2) *
params.F.get_unsafe(1, 2) +
1060 params.F.get_unsafe(2, 0) *
params.F.get_unsafe(2, 0) +
1061 params.F.get_unsafe(2, 1) *
params.F.get_unsafe(2, 1));
1063 double Jh = (std::numeric_limits<double>::max)();
1076 (xh * xhd + xhd * xt + xh * xtd) *
params.F.get_unsafe(0, 0);
1078 (xh * yhd + yhd * xt + xh * ytd) *
params.F.get_unsafe(0, 1);
1079 const double p3 = (f0 * (xh + xt)) *
params.F.get_unsafe(0, 2);
1081 (yh * xhd + xhd * yt + yh * xtd) *
params.F.get_unsafe(1, 0);
1083 (yh * yhd + yhd * yt + yh * ytd) *
params.F.get_unsafe(1, 1);
1084 const double p6 = (f0 * (yh + yt)) *
params.F.get_unsafe(1, 2);
1085 const double p7 = (f0 * (xhd + xtd)) *
params.F.get_unsafe(2, 0);
1086 const double p8 = (f0 * (yhd + ytd)) *
params.F.get_unsafe(2, 1);
1088 const double udotxi = p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9;
1090 const double Q11 = (xh * xh + xhd * xhd) *
params.F.get_unsafe(0, 0) *
1091 params.F.get_unsafe(0, 0);
1092 const double Q22 = (xh * xh + yhd * yhd) *
params.F.get_unsafe(0, 1) *
1093 params.F.get_unsafe(0, 1);
1094 const double Q44 = (yh * yh + xhd * xhd) *
params.F.get_unsafe(1, 0) *
1095 params.F.get_unsafe(1, 0);
1096 const double Q55 = (yh * yh + yhd * yhd) *
params.F.get_unsafe(1, 1) *
1097 params.F.get_unsafe(1, 1);
1099 xhd * yhd *
params.F.get_unsafe(0, 0) *
params.F.get_unsafe(0, 1);
1101 f0 * xhd *
params.F.get_unsafe(0, 0) *
params.F.get_unsafe(0, 2);
1103 xh * yh *
params.F.get_unsafe(0, 0) *
params.F.get_unsafe(1, 0);
1105 f0 * xh *
params.F.get_unsafe(0, 0) *
params.F.get_unsafe(2, 0);
1107 f0 * yhd *
params.F.get_unsafe(0, 1) *
params.F.get_unsafe(0, 2);
1109 xh * yh *
params.F.get_unsafe(0, 1) *
params.F.get_unsafe(1, 1);
1111 f0 * xh *
params.F.get_unsafe(0, 1) *
params.F.get_unsafe(2, 1);
1113 xhd * yhd *
params.F.get_unsafe(1, 0) *
params.F.get_unsafe(1, 1);
1115 f0 * xhd *
params.F.get_unsafe(1, 0) *
params.F.get_unsafe(1, 2);
1117 f0 * yh *
params.F.get_unsafe(1, 0) *
params.F.get_unsafe(2, 0);
1119 f0 * yhd *
params.F.get_unsafe(1, 1) *
params.F.get_unsafe(1, 2);
1121 f0 * yh *
params.F.get_unsafe(1, 1) *
params.F.get_unsafe(2, 1);
1123 const double udotV0xiu = Q00 + Q11 + Q22 + Q44 + Q55 +
1124 2.0 * (Q12 + Q13 + Q14 + Q17 + Q23 + Q25 +
1125 Q28 + Q45 + Q46 + Q47 + Q56 + Q58);
1127 ASSERT_(fabs(udotV0xiu) > 1e-5);
1129 const double C = udotxi / udotV0xiu;
1132 (
params.F.get_unsafe(0, 0) * xhd +
1133 params.F.get_unsafe(0, 1) * yhd + f0 *
params.F.get_unsafe(0, 2));
1135 (
params.F.get_unsafe(1, 0) * xhd +
1136 params.F.get_unsafe(1, 1) * yhd + f0 *
params.F.get_unsafe(1, 2));
1138 (
params.F.get_unsafe(0, 0) * xh +
params.F.get_unsafe(1, 0) * yh +
1139 f0 *
params.F.get_unsafe(2, 0));
1141 (
params.F.get_unsafe(0, 1) * xh +
params.F.get_unsafe(1, 1) * yh +
1142 f0 *
params.F.get_unsafe(2, 1));
1144 const double Jt = xt * xt + yt * yt + xtd * xtd + ytd * ytd;
1146 if ((std::abs)(Jt - Jh) <= 1e-5)
1165 double disp = nfx1 - nfx2;
1166 double aux =
params.baseline / disp;
1167 p3D.
x = (nfx1 -
params.K(0, 2)) * aux;
1168 p3D.
y = (nfy1 -
params.K(1, 2)) * aux;
1188 for (itList = mfList.begin(); itList != mfList.end();)
1190 float disp = (itList->first->x - itList->second->x);
1192 itList = mfList.erase(
1199 (itList->first->x -
param.K(0, 2)) * ((
param.baseline)) / disp;
1201 (itList->first->y -
param.K(1, 2)) * ((
param.baseline)) / disp;
1202 float z3D = (
param.K(0, 0)) * ((
param.baseline)) / disp;
1205 if ((z3D <
param.minZ) || (z3D >
param.maxZ))
1206 itList = mfList.erase(itList);
1216 norm3D *= -1 / norm3D.
norm();
1220 lm.
ID = itList->first->ID;
1230 switch (
param.uncPropagation)
1235 float c0 =
param.K(0, 2);
1236 float r0 =
param.K(1, 2);
1239 square(itList->first->x - itList->second->x);
1243 square(itList->first->x - c0) /
1246 stdDisp2 * base2 * (itList->first->x - c0) *
1247 (itList->first->y - r0) /
square(disp2);
1249 (itList->first->x - c0) /
1253 square(itList->first->y - r0) /
1256 (itList->first->y - r0) /
1259 stdDisp2 * foc2 * base2 /
square(disp2);
1266 unsigned int Na = 3;
1269 float k =
param.factor_k;
1271 float w0 = k / (Na + k);
1272 float w1 = 1 / (2 * (Na + k));
1278 Pa(0, 0) = Pa(1, 1) = (Na + k) *
square(
param.stdPixel);
1288 B.resize(2 * Na + 1);
1299 meanA[0] = itList->first->x;
1300 meanA[1] = itList->first->y;
1311 for (i = 1; i <= 2 * Na; i++)
1318 myPoint[0] = meanA[0] + vAux[0];
1319 myPoint[1] = meanA[1] + vAux[1];
1320 myPoint[2] = meanA[2] + vAux[2];
1327 myPoint[0] = meanA[0] - vAux[0];
1328 myPoint[1] = meanA[1] - vAux[1];
1329 myPoint[2] = meanA[2] - vAux[2];
1333 x3D = (myPoint[0] -
param.K(0, 2)) *
1334 ((
param.baseline)) / myPoint[2];
1335 y3D = (myPoint[1] -
param.K(1, 2)) *
1336 ((
param.baseline)) / myPoint[2];
1341 meanB.
x = meanB.
x +
w1 * x3D;
1342 meanB.
y = meanB.
y +
w1 * y3D;
1343 meanB.
z = meanB.
z +
w1 * z3D;
1352 for (i = 0; i <= 2 * Na; i++)
1361 v(0, 0) = B[i].x - meanB.
x;
1362 v(1, 0) = B[i].y - meanB.
y;
1363 v(2, 0) = B[i].z - meanB.
z;
1365 Pb = Pb + weight * (
v *
v.transpose());
1381 unsigned int Na = 3;
1384 float a =
param.factor_a;
1385 float b =
param.factor_b;
1386 float k =
param.factor_k;
1388 float lambda =
square(
a) * (Na + k) - Na;
1390 float w0_m = lambda / (Na + lambda);
1391 float w0_c = w0_m + (1 -
square(
a) +
b);
1392 float w1 = 1 / (2 * (Na + lambda));
1398 Pa(0, 0) = Pa(1, 1) =
1409 B.resize(2 * Na + 1);
1420 meanA[0] = itList->first->x;
1421 meanA[1] = itList->first->y;
1425 meanB.
x = w0_m * x3D;
1426 meanB.
y = w0_m * y3D;
1427 meanB.
z = w0_m * z3D;
1432 for (i = 1; i <= 2 * Na; i++)
1439 myPoint = meanA + vAux;
1449 myPoint = meanA - vAux;
1456 x3D = (myPoint[0] -
param.K(0, 2)) *
1457 ((
param.baseline)) / myPoint[2];
1458 y3D = (myPoint[1] -
param.K(1, 2)) *
1459 ((
param.baseline)) / myPoint[2];
1464 meanB.
x = meanB.
x +
w1 * x3D;
1465 meanB.
y = meanB.
y +
w1 * y3D;
1466 meanB.
z = meanB.
z +
w1 * z3D;
1475 for (i = 0; i <= 2 * Na; i++)
1484 v(0, 0) = B[i].x - meanB.
x;
1485 v(1, 0) = B[i].y - meanB.
y;
1486 v(2, 0) = B[i].z - meanB.
z;
1488 Pb = Pb + weight * (
v *
v.transpose());
1529 for (itListL = leftList.
begin(), itListR = rightList.
begin();
1530 itListL != leftList.
end();)
1532 float disp = ((*itListL)->x - (*itListR)->x);
1535 itListL = leftList.
erase(itListL);
1537 itListR = rightList.
erase(itListR);
1544 ((*itListL)->x -
param.K(0, 2)) * ((
param.baseline)) / disp;
1546 ((*itListL)->y -
param.K(1, 2)) * ((
param.baseline)) / disp;
1547 float z3D = (
param.K(0, 0)) * ((
param.baseline)) / disp;
1550 if ((z3D <
param.minZ) || (z3D >
param.maxZ))
1553 leftList.
erase(itListL);
1556 rightList.
erase(itListR);
1567 norm3D *= -1 / norm3D.
norm();
1571 lm.
ID = (*itListL)->ID;
1582 switch (
param.uncPropagation)
1587 float c0 =
param.K(0, 2);
1588 float r0 =
param.K(1, 2);
1590 float disp2 =
square((*itListL)->x - (*itListR)->x);
1594 square((*itListL)->x - c0) /
1597 ((*itListL)->x - c0) *
1598 ((*itListL)->y - r0) /
square(disp2);
1600 ((*itListL)->x - c0) /
square(disp2);
1603 square((*itListL)->y - r0) /
1606 ((*itListL)->y - r0) /
square(disp2);
1608 stdDisp2 * foc2 * base2 /
square(disp2);
1615 unsigned int Na = 3;
1618 float k =
param.factor_k;
1620 float w0 = k / (Na + k);
1621 float w1 = 1 / (2 * (Na + k));
1627 Pa(0, 0) = Pa(1, 1) = (Na + k) *
square(
param.stdPixel);
1637 B.resize(2 * Na + 1);
1648 meanA[0] = (*itListL)->x;
1649 meanA[1] = (*itListL)->y;
1660 for (i = 1; i <= 2 * Na; i++)
1667 myPoint[0] = meanA[0] + vAux[0];
1668 myPoint[1] = meanA[1] + vAux[1];
1669 myPoint[2] = meanA[2] + vAux[2];
1676 myPoint[0] = meanA[0] - vAux[0];
1677 myPoint[1] = meanA[1] - vAux[1];
1678 myPoint[2] = meanA[2] - vAux[2];
1682 x3D = (myPoint[0] -
param.K(0, 2)) *
1683 ((
param.baseline)) / myPoint[2];
1684 y3D = (myPoint[1] -
param.K(1, 2)) *
1685 ((
param.baseline)) / myPoint[2];
1690 meanB.
x = meanB.
x +
w1 * x3D;
1691 meanB.
y = meanB.
y +
w1 * y3D;
1692 meanB.
z = meanB.
z +
w1 * z3D;
1701 for (i = 0; i <= 2 * Na; i++)
1710 v(0, 0) = B[i].x - meanB.
x;
1711 v(1, 0) = B[i].y - meanB.
y;
1712 v(2, 0) = B[i].z - meanB.
z;
1714 Pb = Pb + weight * (
v *
v.transpose());
1730 unsigned int Na = 3;
1733 float a =
param.factor_a;
1734 float b =
param.factor_b;
1735 float k =
param.factor_k;
1737 float lambda =
square(
a) * (Na + k) - Na;
1739 float w0_m = lambda / (Na + lambda);
1740 float w0_c = w0_m + (1 -
square(
a) +
b);
1741 float w1 = 1 / (2 * (Na + lambda));
1747 Pa(0, 0) = Pa(1, 1) =
1758 B.resize(2 * Na + 1);
1769 meanA[0] = (*itListL)->x;
1770 meanA[1] = (*itListL)->y;
1774 meanB.
x = w0_m * x3D;
1775 meanB.
y = w0_m * y3D;
1776 meanB.
z = w0_m * z3D;
1781 for (i = 1; i <= 2 * Na; i++)
1788 myPoint = meanA + vAux;
1798 myPoint = meanA - vAux;
1805 x3D = (myPoint[0] -
param.K(0, 2)) *
1806 ((
param.baseline)) / myPoint[2];
1807 y3D = (myPoint[1] -
param.K(1, 2)) *
1808 ((
param.baseline)) / myPoint[2];
1813 meanB.
x = meanB.
x +
w1 * x3D;
1814 meanB.
y = meanB.
y +
w1 * y3D;
1815 meanB.
z = meanB.
z +
w1 * z3D;
1824 for (i = 0; i <= 2 * Na; i++)
1833 v(0, 0) = B[i].x - meanB.
x;
1834 v(1, 0) = B[i].y - meanB.
y;
1835 v(2, 0) = B[i].z - meanB.
z;
1837 Pb = Pb + weight * (
v *
v.transpose());
1867 const CPose3D& sensorPose,
const vector<double>& sg,
1871 double f = intrinsicParams(0, 0);
1872 double x0 = intrinsicParams(0, 2);
1873 double y0 = intrinsicParams(1, 2);
1874 double b = baseline;
1875 double sg_c2 =
square(sg[0]);
1876 double sg_r2 =
square(sg[1]);
1877 double sg_d2 =
square(sg[2]);
1880 itMatchList != inMatches.end(); itMatchList++)
1882 double x = itMatchList->first->x;
1883 double y = itMatchList->first->y;
1885 double d = itMatchList->first->x - itMatchList->second->x;
1892 double X = (
x - x0) *
b / d;
1893 double Y = (
y - y0) *
b / d;
1894 double Z = f *
b / d;
1905 m.
yaw = atan2(Y, X);
1919 aux.get_unsafe(0, 0) = k * (sg_c2 + sg_d2 *
square(
x - x0) / d2);
1920 aux.get_unsafe(0, 1) = aux.get_unsafe(1, 0) =
1921 k * (sg_d2 * (
x - x0) * (
y - y0) / d2);
1922 aux.get_unsafe(0, 2) = aux.get_unsafe(2, 0) =
1923 k * (sg_d2 * (
x - x0) * f / d2);
1925 aux.get_unsafe(1, 1) = k * (sg_r2 + sg_d2 *
square(
y - y0) / d2);
1926 aux.get_unsafe(1, 2) = aux.get_unsafe(2, 1) =
1927 k * (sg_d2 * (
y - y0) * f / d2);
1929 aux.get_unsafe(2, 2) = k * (sg_d2 *
square(f) / d2);
1955 JG.set_unsafe(0, 0, X / m.
range);
1956 JG.set_unsafe(0, 1, Y / m.
range);
1957 JG.set_unsafe(0, 2, Z / m.
range);
1961 JG.set_unsafe(1, 2, 0);
2002 unsigned int id = 0;
2022 double sg_c2 =
square(sg[0]);
2023 double sg_r2 =
square(sg[1]);
2024 double sg_d2 =
square(sg[2]);
2027 itMatchList != matchList.end(); itMatchList++,
id++)
2029 double x = itMatchList->first->x;
2030 double y = itMatchList->first->y;
2032 double d = itMatchList->first->x - itMatchList->second->x;
2039 double X = (
x - x0) *
b / d;
2040 double Y = (
y - y0) *
b / d;
2041 double Z = f *
b / d;
2054 m.
yaw = atan2(X, Z);
2055 m.
pitch = atan2(Y, Z);
2067 aux.get_unsafe(0, 0) = k * (sg_c2 + sg_d2 *
square(
x - x0) / d2);
2068 aux.get_unsafe(0, 1) = aux.get_unsafe(1, 0) =
2069 k * (sg_d2 * (
x - x0) * (
y - y0) / d2);
2070 aux.get_unsafe(0, 2) = aux.get_unsafe(2, 0) =
2071 k * (sg_d2 * (
x - x0) * f / d2);
2073 aux.get_unsafe(1, 1) = k * (sg_r2 + sg_d2 *
square(
y - y0) / d2);
2074 aux.get_unsafe(1, 2) = aux.get_unsafe(2, 1) =
2075 k * (sg_d2 * (
y - y0) * f / d2);
2077 aux.get_unsafe(2, 2) = k * (sg_d2 *
square(f) / d2);
2103 JG.set_unsafe(0, 0, X / m.
range);
2104 JG.set_unsafe(0, 1, Y / m.
range);
2105 JG.set_unsafe(0, 2, Z / m.
range);
2109 JG.set_unsafe(1, 2, 0);
2158 square(itCloud->pose_mean.x) +
square(itCloud->pose_mean.y) +
2159 square(itCloud->pose_mean.z));
2165 m.
yaw = atan2(itCloud->pose_mean.y, itCloud->pose_mean.x);
2166 m.
pitch = -sin(itCloud->pose_mean.z / m.
range);
2178 const poses::CPose3D& rightCameraPose,
void* outMap1x,
void* outMap1y,
2179 void* outMap2x,
void* outMap2y)
2183 #if MRPT_HAS_OPENCV && MRPT_OPENCV_VERSION_NUM >= 0x211 2185 cv::Mat *mapx1, *mapy1, *mapx2, *mapy2;
2186 mapx1 =
static_cast<cv::Mat*
>(outMap1x);
2187 mapy1 =
static_cast<cv::Mat*
>(outMap1y);
2188 mapx2 =
static_cast<cv::Mat*
>(outMap2x);
2189 mapy2 =
static_cast<cv::Mat*
>(outMap2y);
2191 const int resX = cam1.
ncols;
2192 const int resY = cam1.
nrows;
2198 rcTrans[0] = hMatrix(0, 3);
2199 rcTrans[1] = hMatrix(1, 3);
2200 rcTrans[2] = hMatrix(2, 3);
2203 for (
unsigned int i = 0; i < 3; ++i)
2204 for (
unsigned int j = 0; j < 3; ++j) m1[i][j] = hMatrix(i, j);
2206 double ipl[3][3], ipr[3][3], dpl[5], dpr[5];
2207 for (
unsigned int i = 0; i < 3; ++i)
2208 for (
unsigned int j = 0; j < 3; ++j)
2214 for (
unsigned int i = 0; i < 5; ++i)
2216 dpl[i] = cam1.
dist[i];
2217 dpr[i] = cam2.
dist[i];
2220 cv::Mat
R(3, 3, CV_64F, &m1);
2221 cv::Mat T(3, 1, CV_64F, &rcTrans);
2223 cv::Mat K1(3, 3, CV_64F, ipl);
2224 cv::Mat K2(3, 3, CV_64F, ipr);
2225 cv::Mat D1(1, 5, CV_64F, dpl);
2226 cv::Mat D2(1, 5, CV_64F, dpr);
2228 double _R1[3][3], _R2[3][3], _P1[3][4], _P2[3][4], _Q[4][4];
2229 cv::Mat R1(3, 3, CV_64F, _R1);
2230 cv::Mat R2(3, 3, CV_64F, _R2);
2231 cv::Mat P1(3, 4, CV_64F, _P1);
2232 cv::Mat P2(3, 4, CV_64F, _P2);
2233 cv::Mat Q(4, 4, CV_64F, _Q);
2235 cv::Size nSize(resX, resY);
2239 #if MRPT_OPENCV_VERSION_NUM < 0x210 2242 K1, D1, K2, D2, nSize,
R, T, R1, R2, P1, P2, Q,
2243 cv::CALIB_ZERO_DISPARITY);
2244 #elif MRPT_OPENCV_VERSION_NUM < 0x230 2247 K1, D1, K2, D2, nSize,
R, T, R1, R2, P1, P2, Q,
alpha,
2250 cv::CALIB_ZERO_DISPARITY);
2254 K1, D1, K2, D2, nSize,
R, T, R1, R2, P1, P2, Q,
2255 cv::CALIB_ZERO_DISPARITY,
alpha);
2260 cv::initUndistortRectifyMap(
2261 K1, D1, R1, P1, cv::Size(resX, resY), CV_32FC1, *mapx1, *mapy1);
2262 cv::initUndistortRectifyMap(
2263 K2, D2, R2, P2, cv::Size(resX, resY), CV_32FC1, *mapx2, *mapy2);
2267 "The MRPT has been compiled with MRPT_HAS_OPENCV = 0 or OpenCV version " 2277 : xMin(x1), xMax(x2), yMin(y1), yMax(y2), zMin(z1), zMax(z2)
2286 : xMin(x1), xMax(x2), yMin(y1), yMax(y2)
2294 : uncPropagation(Prop_Linear),
2307 F.set_unsafe(1, 2, -1);
2308 F.set_unsafe(2, 1, 1);
2335 for (
unsigned int ii = 0; ii < 3; ++ii)
2336 for (
unsigned int jj = 0; jj < 3; ++jj)
K(ii, jj) = k_vec[ii * 3 + jj];
2341 for (
unsigned int ii = 0; ii < 3; ++ii)
2342 for (
unsigned int jj = 0; jj < 3; ++jj)
F(ii, jj) = f_vec[ii * 3 + jj];
2361 "\n----------- [vision::TStereoSystemParams] ------------ \n");
2376 out <<
mrpt::format(
"K\t\t\t= [%f\t%f\t%f]\n",
K(0, 0),
K(0, 1),
K(0, 2));
2377 out <<
mrpt::format(
" \t\t\t [%f\t%f\t%f]\n",
K(1, 0),
K(1, 1),
K(1, 2));
2378 out <<
mrpt::format(
" \t\t\t [%f\t%f\t%f]\n",
K(2, 0),
K(2, 1),
K(2, 2));
2380 out <<
mrpt::format(
"F\t\t\t= [%f\t%f\t%f]\n",
F(0, 0),
F(0, 1),
F(0, 2));
2381 out <<
mrpt::format(
" \t\t\t [%f\t%f\t%f]\n",
F(1, 0),
F(1, 1),
F(1, 2));
2382 out <<
mrpt::format(
" \t\t\t [%f\t%f\t%f]\n",
F(2, 0),
F(2, 1),
F(2, 2));
2395 "-------------------------------------------------------- \n");
2403 useEpipolarRestriction(true),
2406 hasFundamentalMatrix(
2408 parallelOpticalAxis(true),
2411 useXRestriction(true),
2415 useDisparityLimits(false),
2420 matching_method(mmCorrelation),
2442 estimateDepth(false),
2443 maxDepthThreshold(15.0)
2520 "\n----------- [vision::TMatchingOptions] ------------ \n");
2527 "· Min. CC. Threshold: %f\n",
minCC_TH);
2529 "· Min. Dif. CC Threshold: %f\n",
minDCC_TH);
2535 "· Max. EDD Threshold: %f\n",
maxEDD_TH);
2549 "· Max. Dif. SAD Threshold: %f\n",
maxSAD_TH);
2551 "· Ratio SAD Threshold: %f\n",
SAD_RATIO);
2556 "· Max. distance between desc: %f\n",
maxORB_dist);
2573 "· Min/max disp limits: %.2f/%.2f px\n",
min_disp,
2593 "-------------------------------------------------------- \n");
void clear()
Erase all the contents of the map.
float fieldOfView_yaw
Information about the.
float EDD_RATIO
Boundary Ratio between the two lowest EDD.
double x() const
Common members of all points & poses classes.
TMatchingOptions()
Intrinsic parameters of the stereo rig.
GLclampf GLclampf GLclampf alpha
float rCC_TH
Maximum Ratio Between the two highest CC values.
const T * getAs() const
Returns a pointer to a const T* containing the image - the idea is to call like "img.getAs<IplImage>()" so we can avoid here including OpenCV's headers.
mrpt::math::CMatrixDouble33 F
Stereo Fundamental matrix.
uint64_t TFeatureID
Definition of a feature ID.
void setSensorPose(const mrpt::poses::CPose3D &newSensorPose) override
A general method to change the sensor pose on the robot.
double maxORB_dist
Maximun distance between ORB descriptors.
Declares a matrix of booleans (non serializable).
std::vector< mrpt::vision::CFeature::Ptr > features
The set of features from which the landmark comes.
float range
The sensed landmark distance, in meters.
TInternalFeatList::iterator iterator
mrpt::img::CImage imageLeft
Image from the left camera (this image will be ALWAYS present)
bool estimateDepth
Whether or not estimate the 3D position of the real features for the matches (only with parallelOptic...
void resize(unsigned int width, unsigned int height, TImageChannels nChannels, bool originTopLeft)
Changes the size of the image, erasing previous contents (does NOT scale its current content...
#define THROW_EXCEPTION(msg)
double fx() const
Get the value of the focal length x-value (in pixels).
bool useXRestriction
Whether or not employ the x-coord restriction for finding correspondences (bumblebee camera...
void setFromMatrix(const Eigen::MatrixBase< Derived > &m, bool matrix_is_normalized=true)
Set the image from a matrix, interpreted as grayscale intensity values, in the range [0...
Linear propagation of the uncertainty.
void setRightMaxID(const TFeatureID &rightID)
double SAD_RATIO
Boundary Ratio between the two highest SAD.
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form, sending it to a std::ostream.
void StereoObs2BRObs(const mrpt::obs::CObservationStereoImages &inObs, const std::vector< double > &sg, mrpt::obs::CObservationBearingRange &outObs)
Converts a stereo images observation into a bearing and range observation.
Declares a class derived from "CObservation" that stores a Landmarks Map as seen from a stereo camera...
float min_disp
Disparity limits, see also 'useDisparityLimits'.
double norm() const
Point norm.
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction...
size_t getHeight() const override
Returns the height of the image in pixels.
GLenum GLsizei GLenum GLenum const GLvoid * image
A pair (x,y) of pixel coordinates (subpixel resolution).
float epipolar_TH
Epipolar constraint (rows of pixels)
float minZ
Maximum allowed distance.
float EDSD_RATIO
Boundary Ratio between the two lowest SURF EDSD.
bool useEpipolarRestriction
Whether or not take into account the epipolar restriction for finding correspondences.
Matching by Hamming distance between ORB descriptors.
void normalizeImage(const mrpt::img::CImage &image, mrpt::img::CImage &nimage)
Normalizes the brigthness and contrast of an image by setting its mean value to zero and its standard...
float factor_k
K factor for the UT.
bool useDisparityLimits
Whether or not use limits (min,max) for the disparity, see also 'min_disp, max_disp'.
float stdPixel
Standard deviation of the error in feature detection.
float yaw
The sensed landmark direction, in radians, measured as the yaw (azimuth) and pitch (negative elevatio...
T square(const T x)
Inline function for the square of a number.
mrpt::poses::CPose3DQuat cameraPose
The pose of the LEFT camera, relative to the robot.
mrpt::math::CMatrixDouble33 intrinsicParams
Matrix of intrinsic parameters (containing the focal length and principal point coordinates) ...
int32_t landmarkID
The ID of the sensed beacon, or INVALID_LANDMARK_ID (-1) if the sensor does not identify the landmark...
#define ASSERT_(f)
Defines an assertion mechanism.
Matching by Euclidean distance between SIFT descriptors.
bool parallelOpticalAxis
Whether or not the stereo rig has the optical axes parallel.
float minDCC_TH
Minimum Difference Between the Maximum Cross Correlation Values.
This class allows loading and storing values and vectors of different types from a configuration text...
This base provides a set of functions for maths stuff.
size_t getWidth() const override
Returns the width of the image in pixels.
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 cy() const
Get the value of the principal point y-coordinate (in pixels).
A class for storing a map of 3D probabilistic landmarks.
TUnc_Prop_Method uncPropagation
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string §ion) override
This method load the options from a ".ini"-like file or memory-stored string list.
void getMaxID(const TListIdx &idx, TFeatureID &firstListID, TFeatureID &secondListID)
Returns the maximum ID of the features in the list.
Parameters associated to a stereo system.
bool addMatches
Whether or not to add the matches found into the input matched list (if false the input list will be ...
void push_back(const CLandmark &lm)
The object is copied, thus the original copy passed as a parameter can be released.
Matching by Euclidean distance between SURF descriptors.
float maxY
Maximum allowed height.
double x
Translation in x,y,z.
size_t rows() const
Number of rows in the matrix.
void rectangle(int x0, int y0, int x1, int y1, const mrpt::img::TColor color, unsigned int width=1)
Draws a rectangle (an empty rectangle, without filling)
Observation class for either a pair of left+right or left+disparity images from a stereo camera...
float fieldOfView_pitch
Information about the sensor: The "field-of-view" of the sensor, in radians (for pitch )...
This namespace contains representation of robot actions and observations.
string iniFile(myDataDir+string("benchmark-options.ini"))
double coefs[3]
Line coefficients, stored as an array: .
Classes for computer vision, detectors, features, etc.
Structure to hold the parameters of a pinhole camera model.
double x
X,Y,Z coordinates.
Uncertainty propagation through the Unscented Transformation.
double maxDepthThreshold
The maximum allowed depth for the matching.
double computeMsd(const mrpt::tfest::TMatchingPairList &list, const poses::CPose3D &Rt)
Computes the mean squared distance between a set of 3D correspondences ...
iterator erase(const iterator &it)
void computeStereoRectificationMaps(const mrpt::img::TCamera &cam1, const mrpt::img::TCamera &cam2, const mrpt::poses::CPose3D &rightCameraPose, void *outMap1x, void *outMap1y, void *outMap2x, void *outMap2y)
Computes a pair of x-and-y maps for stereo rectification from a pair of cameras and the relative pose...
size_t cols() const
Number of columns in the matrix.
void set_unsafe(size_t row, size_t col, const T &v)
Fast but unsafe method to write a value in the matrix.
A list of visual features, to be used as output by detectors, as input/output by trackers, etc.
void rowChecking(CFeatureList &leftList, CFeatureList &rightList, float threshold=1.0)
Search for correspondences which are not in the same row and deletes them.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
A structure for holding correspondences between two sets of points or points-like entities in 2D or 3...
Each one of the measurements:
CImage grayscale() const
Returns a grayscale version of the image, or itself if it is already a grayscale image.
TStereoSystemParams()
Initilization of default parameters.
TInternalFeatList::const_iterator const_iterator
std::array< double, 5 > dist
[k1 k2 t1 t2 k3] -> k_i: parameters of radial distortion, t_i: parameters of tangential distortion (d...
Matching by sum of absolute differences of the image patches.
double maxSAD_TH
Minimum Euclidean Distance Between Sum of Absolute Differences.
double cx() const
Get the value of the principal point x-coordinate (in pixels).
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
The class for storing "landmarks" (visual or laser-scan-extracted features,...)
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form, sending it to a std::ostream.
bool isColor() const
Returns true if the image is RGB, false if it is grayscale.
float computeMainOrientation(const mrpt::img::CImage &image, unsigned int x, unsigned int y)
Computes the main orientation of a set of points with an image (for using in SIFT-based algorithms) ...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
mrpt::math::TPoint3D normal
The "normal" to the landmark, i.e.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
float maxZ
Maximum allowed distance.
mrpt::poses::CPose3DQuat rightCameraPose
The pose of the right camera, relative to the left one: Note that using the conventional reference co...
size_t matchFeatures(const CFeatureList &list1, const CFeatureList &list2, CMatchedFeatureList &matches, const TMatchingOptions &options=TMatchingOptions(), const TStereoSystemParams ¶ms=TStereoSystemParams())
Find the matches between two lists of features which must be of the same type.
This observation represents a number of range-bearing value pairs, each one for a detected landmark...
A structure containing options for the matching.
Matching by cross correlation of the image patches.
void setLeftMaxID(const TFeatureID &leftID)
Explicitly set the max IDs values to certain values.
void generateMask(const CMatchedFeatureList &mList, mrpt::math::CMatrixBool &mask1, mrpt::math::CMatrixBool &mask2, int wSize=10)
Calculates the Sum of Absolutes Differences (range [0,1]) between two patches.
TCamera leftCamera
Intrinsic and distortion parameters of the left and right cameras.
bool hasFundamentalMatrix
Whether or not there is a fundamental matrix.
mrpt::maps::CLandmarksMap landmarks
The landmarks, with coordinates origin in the camera reference system.
double computeSAD(const mrpt::img::CImage &patch1, const mrpt::img::CImage &patch2)
Calculates the Sum of Absolutes Differences (range [0,1]) between two patches.
A matrix of dynamic size.
void extract_patch(CImage &patch, const unsigned int col=0, const unsigned int row=0, const unsigned int width=1, const unsigned int height=1) const
Extract a patch from this image, saveing it into "patch" (its previous contents will be overwritten)...
mrpt::math::TPose3DQuat rightCameraPose
Pose of the right camera with respect to the coordinate origin of the left camera.
float maxEDSD_TH
Maximum Euclidean Distance Between SURF Descriptors.
float minCC_TH
Minimum Value of the Cross Correlation.
float factor_a
Alpha factor for SUT.
float factor_b
Beta factor for the SUT.
float maxEDD_TH
Maximum Euclidean Distance Between SIFT Descriptors.
internal::TSequenceLandmarks::const_iterator const_iterator
void flip(mrpt::img::CImage &img)
Invert an image using OpenCV function.
dynamic_vector< double > CVectorDouble
Column vector, like Eigen::MatrixXd, but automatically initialized to zeros since construction...
void deleteRepeatedFeats(CFeatureList &list)
Explore the feature list and removes features which are in the same coordinates.
bool validCovariances
True: The individual 3x3 covariance matrices must be taken into account, false (default): All the mea...
void getDispersion(const CFeatureList &list, mrpt::math::CVectorFloat &std, mrpt::math::CVectorFloat &mean)
Computes the dispersion of the features in the image.
TFeatureType get_type() const
The type of the first feature in the list.
mrpt::math::TPoint3D pose_mean
The mean of the landmark 3D position.
void cloudsToMatchedList(const mrpt::obs::CObservationVisualLandmarks &cloud1, const mrpt::obs::CObservationVisualLandmarks &cloud2, mrpt::tfest::TMatchingPairList &outList)
Transform two clouds of 3D points into a matched list of points ...
void openCV_cross_correlation(const mrpt::img::CImage &img, const mrpt::img::CImage &patch_img, size_t &x_max, size_t &y_max, double &max_val, int x_search_ini=-1, int y_search_ini=-1, int x_search_size=-1, int y_search_size=-1)
Computes the correlation between this image and another one, encapsulating the openCV function cvMatc...
double distance(const TPoint2D &point) const
Distance from a given point.
void projectMatchedFeatures(const CMatchedFeatureList &matches, const mrpt::img::TStereoCamera &stereo_camera, std::vector< mrpt::math::TPoint3D > &out_points)
This class is a "CSerializable" wrapper for "CMatrixFloat".
TMatchingMethod matching_method
Matching method.
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
void setFromImageReadOnly(const CImage &other_img)
Sets the internal IplImage pointer to that of another given image, WITHOUT making a copy...
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string §ion) override
This method load the options from a ".ini"-like file or memory-stored string list.
mrpt::img::TCamera leftCamera
Parameters for the left/right cameras: individual intrinsic and distortion parameters of the cameras...
GLubyte GLubyte GLubyte a
Functions for estimating the optimal transformation between two frames of references given measuremen...
GLenum const GLfloat * params
void projectMatchedFeature(const CFeature::Ptr &leftFeat, const CFeature::Ptr &rightFeat, mrpt::math::TPoint3D &p3D, const TStereoSystemParams ¶ms=TStereoSystemParams())
Computes the 3D position of a particular matched feature.
uint32_t ncols
Camera resolution.
const Scalar * const_iterator
mrpt::math::CMatrixDouble33 defaultIntrinsicParamsMatrix(unsigned int camIndex=0, unsigned int resolutionX=320, unsigned int resolutionY=240)
Returns the stored, default intrinsic params matrix for a given camera:
Structure to hold the parameters of a pinhole stereo camera model.
mrpt::math::TPoint3D pixelTo3D(const mrpt::img::TPixelCoordf &xy, const mrpt::math::CMatrixDouble33 &A)
Extract a UNITARY 3D vector in the direction of a 3D point, given from its (x,y) pixels coordinates...
struct mrpt::maps::CLandmarksMap::TCustomSequenceLandmarks landmarks
void getHomogeneousMatrix(mrpt::math::CMatrixDouble44 &out_HM) const
Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (t...
EIGEN_STRONG_INLINE double mean() const
Computes the mean of the entire matrix.
mrpt::img::CImage imageRight
Image from the right camera, only contains a valid image if hasImageRight == true.
void setFromIplImageReadOnly(void *iplImage)
Reads the image from a OpenCV IplImage object (WITHOUT making a copy) and from now on the image canno...
Uncertainty propagation through the Scaled Unscented Transformation.
A class for storing images as grayscale or RGB bitmaps.
float stdDisp
Standard deviation of the error in disparity computation.
TLandmarkID ID
An ID for the landmark (see details next...) This ID was introduced in the version 3 of this class (2...
TMeasurementList sensedData
The list of observed ranges:
mrpt::math::CMatrixDouble33 K
Intrinsic parameters.
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint GLdouble w1
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.
2D line without bounds, represented by its equation .
mrpt::math::CMatrixDouble33 buildIntrinsicParamsMatrix(const double focalLengthX, const double focalLengthY, const double centerX, const double centerY)
Builds the intrinsic parameters matrix A from parameters:
void addFeaturesToImage(const mrpt::img::CImage &inImg, const CFeatureList &theList, mrpt::img::CImage &outImg)
Draw rectangles around each of the features on a copy of the input image.
mrpt::math::CMatrixDouble33 covariance
The covariance matrix of the landmark, with variable indices [0,1,2] being [range,yaw,pitch].
int round(const T value)
Returns the closer integer (int) to x.