36 #include <visp3/core/vpCPUFeatures.h>
37 #include <visp3/mbt/vpMbtFaceDepthNormal.h>
38 #include <visp3/mbt/vpMbtTukeyEstimator.h>
40 #if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_PCL_SEGMENTATION) && defined(VISP_HAVE_PCL_FILTERS) && defined(VISP_HAVE_PCL_COMMON)
41 #include <pcl/common/centroid.h>
42 #include <pcl/filters/extract_indices.h>
43 #include <pcl/segmentation/sac_segmentation.h>
46 #if defined __SSE2__ || defined _M_X64 || (defined _M_IX86_FP && _M_IX86_FP >= 2)
47 #include <emmintrin.h>
48 #define VISP_HAVE_SSE2 1
51 #define USE_SSE_CODE 1
52 #if VISP_HAVE_SSE2 && USE_SSE_CODE
60 : m_cam(), m_clippingFlag(
vpPolygon3D::NO_CLIPPING), m_distFarClip(100), m_distNearClip(0.001), m_hiddenFace(nullptr),
61 m_planeObject(), m_polygon(nullptr), m_useScanLine(false), m_faceActivated(false),
62 m_faceCentroidMethod(GEOMETRIC_CENTROID), m_faceDesiredCentroid(), m_faceDesiredNormal(),
63 m_featureEstimationMethod(ROBUST_FEATURE_ESTIMATION), m_isTrackedDepthNormalFace(true), m_isVisible(false),
64 m_listOfFaceLines(), m_planeCamera(),
65 m_pclPlaneEstimationMethod(2),
66 m_pclPlaneEstimationRansacMaxIter(200), m_pclPlaneEstimationRansacThreshold(0.001), m_polygonLines()
91 vpUniRand &rand_gen,
int polygon, std::string name)
94 PolygonLine polygon_line;
97 polygon_line.m_poly.setNbPoint(2);
98 polygon_line.m_poly.addPoint(0, P1);
99 polygon_line.m_poly.addPoint(1, P2);
105 polygon_line.m_p1 = &polygon_line.m_poly.p[0];
106 polygon_line.m_p2 = &polygon_line.m_poly.p[1];
111 bool already_here =
false;
150 #if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_PCL_SEGMENTATION) && defined(VISP_HAVE_PCL_FILTERS) && defined(VISP_HAVE_PCL_COMMON)
153 const pcl::PointCloud<pcl::PointXYZ>::ConstPtr &point_cloud,
154 vpColVector &desired_features,
unsigned int stepX,
unsigned int stepY
155 #
if DEBUG_DISPLAY_DEPTH_NORMAL
158 std::vector<std::vector<vpImagePoint> > &roiPts_vec
165 if (width == 0 || height == 0)
168 std::vector<vpImagePoint> roiPts;
172 #
if DEBUG_DISPLAY_DEPTH_NORMAL
178 if (roiPts.size() <= 2) {
180 std::cerr <<
"Error: roiPts.size() <= 2 in computeDesiredFeatures" << std::endl;
188 unsigned int top = (
unsigned int)std::max<double>(0.0, bb.
getTop());
189 unsigned int bottom = (
unsigned int)std::min<double>((
double)height, std::max<double>(0.0, bb.
getBottom()));
190 unsigned int left = (
unsigned int)std::max<double>(0.0, bb.
getLeft());
191 unsigned int right = (
unsigned int)std::min<double>((
double)width, std::max<double>(0.0, bb.
getRight()));
199 pcl::PointCloud<pcl::PointXYZ>::Ptr point_cloud_face(
new pcl::PointCloud<pcl::PointXYZ>);
200 std::vector<double> point_cloud_face_vec, point_cloud_face_custom;
218 double prev_x, prev_y, prev_z;
221 double x = 0.0, y = 0.0;
222 for (
unsigned int i = top; i < bottom; i += stepY) {
223 for (
unsigned int j = left; j < right; j += stepX) {
224 if (
vpMeTracker::inRoiMask(mask, i, j) && pcl::isFinite((*point_cloud)(j, i)) && (*point_cloud)(j, i).z > 0 &&
225 (
m_useScanLine ? (i < m_hiddenFace->getMbScanLineRenderer().getPrimitiveIDs().getHeight() &&
226 j < m_hiddenFace->getMbScanLineRenderer().getPrimitiveIDs().getWidth() &&
231 point_cloud_face->push_back((*point_cloud)(j, i));
235 point_cloud_face_vec.push_back((*point_cloud)(j, i).x);
236 point_cloud_face_vec.push_back((*point_cloud)(j, i).y);
237 point_cloud_face_vec.push_back((*point_cloud)(j, i).z);
249 prev_z = (*point_cloud)(j, i).z;
253 point_cloud_face_custom.push_back(prev_x);
254 point_cloud_face_custom.push_back(x);
256 point_cloud_face_custom.push_back(prev_y);
257 point_cloud_face_custom.push_back(y);
259 point_cloud_face_custom.push_back(prev_z);
260 point_cloud_face_custom.push_back((*point_cloud)(j, i).z);
265 point_cloud_face_custom.push_back(x);
266 point_cloud_face_custom.push_back(y);
267 point_cloud_face_custom.push_back((*point_cloud)(j, i).z);
272 #if DEBUG_DISPLAY_DEPTH_NORMAL
273 debugImage[i][j] = 255;
280 if (checkSSE2 && push) {
281 point_cloud_face_custom.push_back(prev_x);
282 point_cloud_face_custom.push_back(prev_y);
283 point_cloud_face_custom.push_back(prev_z);
287 if (point_cloud_face->empty() && point_cloud_face_custom.empty() && point_cloud_face_vec.empty()) {
304 desired_normal, centroid_point);
319 unsigned int height,
const std::vector<vpColVector> &point_cloud,
320 vpColVector &desired_features,
unsigned int stepX,
unsigned int stepY
321 #
if DEBUG_DISPLAY_DEPTH_NORMAL
324 std::vector<std::vector<vpImagePoint> > &roiPts_vec
331 if (width == 0 || height == 0)
334 std::vector<vpImagePoint> roiPts;
338 #
if DEBUG_DISPLAY_DEPTH_NORMAL
344 if (roiPts.size() <= 2) {
346 std::cerr <<
"Error: roiPts.size() <= 2 in computeDesiredFeatures" << std::endl;
354 unsigned int top = (
unsigned int)std::max<double>(0.0, bb.
getTop());
355 unsigned int bottom = (
unsigned int)std::min<double>((
double)height, std::max<double>(0.0, bb.
getBottom()));
356 unsigned int left = (
unsigned int)std::max<double>(0.0, bb.
getLeft());
357 unsigned int right = (
unsigned int)std::min<double>((
double)width, std::max<double>(0.0, bb.
getRight()));
365 std::vector<double> point_cloud_face, point_cloud_face_custom;
377 double prev_x, prev_y, prev_z;
380 double x = 0.0, y = 0.0;
381 for (
unsigned int i = top; i < bottom; i += stepY) {
382 for (
unsigned int j = left; j < right; j += stepX) {
384 (
m_useScanLine ? (i < m_hiddenFace->getMbScanLineRenderer().getPrimitiveIDs().getHeight() &&
385 j < m_hiddenFace->getMbScanLineRenderer().getPrimitiveIDs().getWidth() &&
389 point_cloud_face.push_back(point_cloud[i * width + j][0]);
390 point_cloud_face.push_back(point_cloud[i * width + j][1]);
391 point_cloud_face.push_back(point_cloud[i * width + j][2]);
403 prev_z = point_cloud[i * width + j][2];
407 point_cloud_face_custom.push_back(prev_x);
408 point_cloud_face_custom.push_back(x);
410 point_cloud_face_custom.push_back(prev_y);
411 point_cloud_face_custom.push_back(y);
413 point_cloud_face_custom.push_back(prev_z);
414 point_cloud_face_custom.push_back(point_cloud[i * width + j][2]);
419 point_cloud_face_custom.push_back(x);
420 point_cloud_face_custom.push_back(y);
421 point_cloud_face_custom.push_back(point_cloud[i * width + j][2]);
425 #if DEBUG_DISPLAY_DEPTH_NORMAL
426 debugImage[i][j] = 255;
433 if (checkSSE2 && push) {
434 point_cloud_face_custom.push_back(prev_x);
435 point_cloud_face_custom.push_back(prev_y);
436 point_cloud_face_custom.push_back(prev_z);
440 if (point_cloud_face.empty() && point_cloud_face_custom.empty()) {
447 #if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_PCL_SEGMENTATION) && defined(VISP_HAVE_PCL_FILTERS) && defined(VISP_HAVE_PCL_COMMON)
449 pcl::PointCloud<pcl::PointXYZ>::Ptr point_cloud_face_pcl(
new pcl::PointCloud<pcl::PointXYZ>);
450 point_cloud_face_pcl->reserve(point_cloud_face.size() / 3);
452 for (
size_t i = 0; i < point_cloud_face.size() / 3; i++) {
453 point_cloud_face_pcl->push_back(
454 pcl::PointXYZ(point_cloud_face[3 * i], point_cloud_face[3 * i + 1], point_cloud_face[3 * i + 2]));
466 desired_normal, centroid_point);
480 unsigned int height,
const vpMatrix &point_cloud,
481 vpColVector &desired_features,
unsigned int stepX,
unsigned int stepY
482 #
if DEBUG_DISPLAY_DEPTH_NORMAL
485 std::vector<std::vector<vpImagePoint> > &roiPts_vec
492 if (width == 0 || height == 0)
495 std::vector<vpImagePoint> roiPts;
499 #
if DEBUG_DISPLAY_DEPTH_NORMAL
505 if (roiPts.size() <= 2) {
507 std::cerr <<
"Error: roiPts.size() <= 2 in computeDesiredFeatures" << std::endl;
515 unsigned int top = (
unsigned int)std::max<double>(0.0, bb.
getTop());
516 unsigned int bottom = (
unsigned int)std::min<double>((
double)height, std::max<double>(0.0, bb.
getBottom()));
517 unsigned int left = (
unsigned int)std::max<double>(0.0, bb.
getLeft());
518 unsigned int right = (
unsigned int)std::min<double>((
double)width, std::max<double>(0.0, bb.
getRight()));
526 std::vector<double> point_cloud_face, point_cloud_face_custom;
538 double prev_x, prev_y, prev_z;
541 double x = 0.0, y = 0.0;
542 for (
unsigned int i = top; i < bottom; i += stepY) {
543 for (
unsigned int j = left; j < right; j += stepX) {
545 (
m_useScanLine ? (i < m_hiddenFace->getMbScanLineRenderer().getPrimitiveIDs().getHeight() &&
546 j < m_hiddenFace->getMbScanLineRenderer().getPrimitiveIDs().getWidth() &&
550 point_cloud_face.push_back(point_cloud[i * width + j][0]);
551 point_cloud_face.push_back(point_cloud[i * width + j][1]);
552 point_cloud_face.push_back(point_cloud[i * width + j][2]);
564 prev_z = point_cloud[i * width + j][2];
568 point_cloud_face_custom.push_back(prev_x);
569 point_cloud_face_custom.push_back(x);
571 point_cloud_face_custom.push_back(prev_y);
572 point_cloud_face_custom.push_back(y);
574 point_cloud_face_custom.push_back(prev_z);
575 point_cloud_face_custom.push_back(point_cloud[i * width + j][2]);
580 point_cloud_face_custom.push_back(x);
581 point_cloud_face_custom.push_back(y);
582 point_cloud_face_custom.push_back(point_cloud[i * width + j][2]);
586 #if DEBUG_DISPLAY_DEPTH_NORMAL
587 debugImage[i][j] = 255;
594 if (checkSSE2 && push) {
595 point_cloud_face_custom.push_back(prev_x);
596 point_cloud_face_custom.push_back(prev_y);
597 point_cloud_face_custom.push_back(prev_z);
601 if (point_cloud_face.empty() && point_cloud_face_custom.empty()) {
608 #if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_PCL_SEGMENTATION) && defined(VISP_HAVE_PCL_FILTERS) && defined(VISP_HAVE_PCL_COMMON)
610 pcl::PointCloud<pcl::PointXYZ>::Ptr point_cloud_face_pcl(
new pcl::PointCloud<pcl::PointXYZ>);
611 point_cloud_face_pcl->reserve(point_cloud_face.size() / 3);
613 for (
size_t i = 0; i < point_cloud_face.size() / 3; i++) {
614 point_cloud_face_pcl->push_back(
615 pcl::PointXYZ(point_cloud_face[3 * i], point_cloud_face[3 * i + 1], point_cloud_face[3 * i + 2]));
627 desired_normal, centroid_point);
639 #if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_PCL_SEGMENTATION) && defined(VISP_HAVE_PCL_FILTERS) && defined(VISP_HAVE_PCL_COMMON)
646 pcl::ModelCoefficients::Ptr coefficients(
new pcl::ModelCoefficients);
647 pcl::PointIndices::Ptr inliers(
new pcl::PointIndices);
649 pcl::SACSegmentation<pcl::PointXYZ> seg;
651 seg.setOptimizeCoefficients(
true);
653 seg.setModelType(pcl::SACMODEL_PLANE);
658 seg.setInputCloud(point_cloud_face);
659 seg.segment(*inliers, *coefficients);
661 pcl::PointCloud<pcl::PointXYZ>::Ptr point_cloud_face_extracted(
new pcl::PointCloud<pcl::PointXYZ>);
663 pcl::ExtractIndices<pcl::PointXYZ> extract;
666 extract.setInputCloud(point_cloud_face);
667 extract.setIndices(inliers);
668 extract.setNegative(
false);
669 extract.filter(*point_cloud_face_extracted);
671 #if PCL_VERSION_COMPARE(>=, 1, 7, 2)
672 pcl::PointXYZ centroid_point_pcl;
673 if (pcl::computeCentroid(*point_cloud_face_extracted, centroid_point_pcl)) {
674 pcl::PointXYZ face_normal;
676 centroid_point_pcl, face_normal);
678 desired_features.
resize(3,
false);
679 desired_features[0] = -coefficients->values[0] / coefficients->values[3];
680 desired_features[1] = -coefficients->values[1] / coefficients->values[3];
681 desired_features[2] = -coefficients->values[2] / coefficients->values[3];
683 desired_normal[0] = face_normal.x;
684 desired_normal[1] = face_normal.y;
685 desired_normal[2] = face_normal.z;
687 centroid_point[0] = centroid_point_pcl.x;
688 centroid_point[1] = centroid_point_pcl.y;
689 centroid_point[2] = centroid_point_pcl.z;
692 std::cerr <<
"Cannot compute centroid!" << std::endl;
696 std::cerr <<
"Cannot compute centroid using PCL " << PCL_VERSION_PRETTY <<
"!" << std::endl;
700 catch (
const pcl::PCLException &e) {
701 std::cerr <<
"Catch a PCL exception: " << e.what() << std::endl;
710 const std::vector<double> &point_cloud_face,
716 std::vector<double> weights;
721 for (
size_t i = 0; i < point_cloud_face.size() / 3; i++) {
722 centroid_point[0] += weights[i] * point_cloud_face[3 * i];
723 centroid_point[1] += weights[i] * point_cloud_face[3 * i + 1];
724 centroid_point[2] += weights[i] * point_cloud_face[3 * i + 2];
729 centroid_point[0] /= den;
730 centroid_point[1] /= den;
731 centroid_point[2] /= den;
744 desired_features.
resize(3,
false);
745 desired_features[0] = -plane_equation_SVD[0] / plane_equation_SVD[3];
746 desired_features[1] = -plane_equation_SVD[1] / plane_equation_SVD[3];
747 desired_features[2] = -plane_equation_SVD[2] / plane_equation_SVD[3];
759 centroid_cam[0] = centroid_point[0];
760 centroid_cam[1] = centroid_point[1];
761 centroid_cam[2] = centroid_point[2];
769 face_normal_cam[0] = desired_normal[0];
770 face_normal_cam[1] = desired_normal[1];
771 face_normal_cam[2] = desired_normal[2];
772 face_normal_cam[3] = 1;
780 if (points_.empty()) {
784 if (points_.size() < 2) {
785 centroid = points_[0];
789 std::vector<vpPoint> points = points_;
790 points.push_back(points_.front());
792 double A1 = 0.0, A2 = 0.0, c_x1 = 0.0, c_x2 = 0.0, c_y = 0.0, c_z = 0.0;
794 for (
size_t i = 0; i < points.size() - 1; i++) {
796 c_x1 += (points[i].get_X() + points[i + 1].get_X()) *
797 (points[i].get_X() * points[i + 1].get_Y() - points[i + 1].get_X() * points[i].get_Y());
798 c_y += (points[i].get_Y() + points[i + 1].get_Y()) *
799 (points[i].get_X() * points[i + 1].get_Y() - points[i + 1].get_X() * points[i].get_Y());
800 A1 += points[i].
get_X() * points[i + 1].get_Y() - points[i + 1].get_X() * points[i].get_Y();
803 c_x2 += (points[i].get_X() + points[i + 1].get_X()) *
804 (points[i].get_X() * points[i + 1].get_Z() - points[i + 1].get_X() * points[i].get_Z());
805 c_z += (points[i].get_Z() + points[i + 1].get_Z()) *
806 (points[i].get_X() * points[i + 1].get_Z() - points[i + 1].get_X() * points[i].get_Z());
807 A2 += points[i].get_X() * points[i + 1].get_Z() - points[i + 1].get_X() * points[i].get_Z();
816 centroid.
set_X(c_x1);
819 centroid.
set_X(c_x2);
829 std::vector<vpImagePoint> &roiPts
830 #
if DEBUG_DISPLAY_DEPTH_NORMAL
832 std::vector<std::vector<vpImagePoint> > &roiPts_vec
841 it->m_p1->changeFrame(cMo);
842 it->m_p2->changeFrame(cMo);
846 it->m_poly.changeFrame(cMo);
847 it->m_poly.computePolygonClipped(
m_cam);
849 if (it->m_poly.polyClipped.size() == 2 &&
857 std::vector<std::pair<vpPoint, vpPoint> > linesLst;
861 for (
unsigned int i = 0; i < linesLst.size(); i++) {
862 linesLst[i].first.project();
863 linesLst[i].second.project();
871 roiPts.push_back(ip1);
872 roiPts.push_back(ip2);
874 #if DEBUG_DISPLAY_DEPTH_NORMAL
875 std::vector<vpImagePoint> roiPts_;
876 roiPts_.push_back(ip1);
877 roiPts_.push_back(ip2);
878 roiPts_vec.push_back(roiPts_);
888 #if DEBUG_DISPLAY_DEPTH_NORMAL
889 roiPts_vec.push_back(roiPts);
903 bool isvisible =
false;
907 int index = *itindex;
942 std::vector<vpImagePoint> roiPts;
945 std::vector<vpPoint> polyPts;
953 e4[0] = -centroid.
get_X();
954 e4[1] = -centroid.
get_Y();
955 e4[2] = -centroid.
get_Z();
959 double centroid_x = 0.0;
960 double centroid_y = 0.0;
961 double centroid_z = 0.0;
963 for (
size_t i = 0; i < polyPts.size(); i++) {
964 centroid_x += polyPts[i].get_X();
965 centroid_y += polyPts[i].get_Y();
966 centroid_z += polyPts[i].get_Z();
969 centroid_x /= polyPts.
size();
970 centroid_y /= polyPts.size();
971 centroid_z /= polyPts.size();
978 centroid.
set_X(centroid_x);
979 centroid.
set_Y(centroid_y);
980 centroid.
set_Z(centroid_z);
983 correct_normal.
resize(3,
false);
985 if (angle < M_PI_2) {
986 correct_normal = faceNormal;
989 correct_normal[0] = -faceNormal[0];
990 correct_normal[1] = -faceNormal[1];
991 correct_normal[2] = -faceNormal[2];
995 #if defined(VISP_HAVE_PCL) && defined(VISP_HAVE_PCL_SEGMENTATION) && defined(VISP_HAVE_PCL_FILTERS) && defined(VISP_HAVE_PCL_COMMON)
997 pcl::PointXYZ &face_normal)
1006 e4[0] = -centroid_point.x;
1007 e4[1] = -centroid_point.y;
1008 e4[2] = -centroid_point.z;
1012 if (angle < M_PI_2) {
1013 face_normal = pcl::PointXYZ(faceNormal[0], faceNormal[1], faceNormal[2]);
1016 face_normal = pcl::PointXYZ(-faceNormal[0], -faceNormal[1], -faceNormal[2]);
1024 face_normal.
resize(3,
false);
1025 face_normal[0] = nx;
1026 face_normal[1] = ny;
1027 face_normal[2] = nz;
1034 if (angle >= M_PI_2) {
1035 face_normal[0] = -face_normal[0];
1036 face_normal[1] = -face_normal[1];
1037 face_normal[2] = -face_normal[2];
1043 L.resize(3, 6,
false,
false);
1056 features.
resize(3,
false);
1057 features[0] = -ux / D;
1058 features[1] = -uy / D;
1059 features[2] = -uz / D;
1062 L[0][0] = ux * ux / D2;
1063 L[0][1] = ux * uy / D2;
1064 L[0][2] = ux * uz / D2;
1070 L[1][0] = ux * uy / D2;
1071 L[1][1] = uy * uy / D2;
1072 L[1][2] = uy * uz / D2;
1078 L[2][0] = ux * uz / D2;
1079 L[2][1] = uy * uz / D2;
1080 L[2][2] = uz * uz / D2;
1088 bool displayFullModel)
1090 std::vector<std::vector<double> > models =
1093 for (
size_t i = 0; i < models.size(); i++) {
1102 bool displayFullModel)
1104 std::vector<std::vector<double> > models =
1107 for (
size_t i = 0; i < models.size(); i++) {
1158 pt_extremity.
set_X(pt_centroid.
get_X() + correct_normal[0] * scale);
1159 pt_extremity.
set_Y(pt_centroid.
get_Y() + correct_normal[1] * scale);
1160 pt_extremity.
set_Z(pt_centroid.
get_Z() + correct_normal[2] * scale);
1213 pt_extremity.
set_X(pt_centroid.
get_X() + correct_normal[0] * scale);
1214 pt_extremity.
set_Y(pt_centroid.
get_Y() + correct_normal[1] * scale);
1215 pt_extremity.
set_Z(pt_centroid.
get_Z() + correct_normal[2] * scale);
1227 vpMbtTukeyEstimator<double> tukey_robust;
1228 std::vector<double> residues(point_cloud_face.size() / 3);
1230 w.resize(point_cloud_face.size() / 3, 1.0);
1232 unsigned int max_iter = 30, iter = 0;
1233 double error = 0.0, prev_error = -1.0;
1234 double A = 0.0, B = 0.0, C = 0.0;
1236 Mat33<double> ATA_3x3;
1245 while (std::fabs(error - prev_error) > 1e-6 && (iter < max_iter)) {
1262 if (point_cloud_face.size() / 3 >= 2) {
1263 const double *ptr_point_cloud = &point_cloud_face[0];
1264 const __m128d vA = _mm_set1_pd(A);
1265 const __m128d vB = _mm_set1_pd(B);
1266 const __m128d vC = _mm_set1_pd(C);
1267 const __m128d vones = _mm_set1_pd(1.0);
1269 double *ptr_residues = &residues[0];
1271 for (; cpt <= point_cloud_face.size() - 6; cpt += 6, ptr_point_cloud += 6, ptr_residues += 2) {
1272 const __m128d vxi = _mm_loadu_pd(ptr_point_cloud);
1273 const __m128d vyi = _mm_loadu_pd(ptr_point_cloud + 2);
1274 const __m128d vZi = _mm_loadu_pd(ptr_point_cloud + 4);
1275 const __m128d vinvZi = _mm_div_pd(vones, vZi);
1278 _mm_add_pd(_mm_add_pd(_mm_mul_pd(vA, vxi), _mm_mul_pd(vB, vyi)), _mm_sub_pd(vC, vinvZi));
1279 _mm_storeu_pd(ptr_residues, tmp);
1283 for (; cpt < point_cloud_face.size(); cpt += 3) {
1284 double xi = point_cloud_face[cpt];
1285 double yi = point_cloud_face[cpt + 1];
1286 double Zi = point_cloud_face[cpt + 2];
1288 residues[cpt / 3] = (A * xi + B * yi + C - 1 / Zi);
1292 tukey_robust.MEstimator(residues, w, 1e-2);
1294 __m128d vsum_wi2_xi2 = _mm_setzero_pd();
1295 __m128d vsum_wi2_yi2 = _mm_setzero_pd();
1296 __m128d vsum_wi2 = _mm_setzero_pd();
1297 __m128d vsum_wi2_xi_yi = _mm_setzero_pd();
1298 __m128d vsum_wi2_xi = _mm_setzero_pd();
1299 __m128d vsum_wi2_yi = _mm_setzero_pd();
1301 __m128d vsum_wi2_xi_Zi = _mm_setzero_pd();
1302 __m128d vsum_wi2_yi_Zi = _mm_setzero_pd();
1303 __m128d vsum_wi2_Zi = _mm_setzero_pd();
1307 if (point_cloud_face.size() / 3 >= 2) {
1308 const double *ptr_point_cloud = &point_cloud_face[0];
1309 double *ptr_w = &w[0];
1311 const __m128d vones = _mm_set1_pd(1.0);
1313 for (; cpt <= point_cloud_face.size() - 6; cpt += 6, ptr_point_cloud += 6, ptr_w += 2) {
1314 const __m128d vwi2 = _mm_mul_pd(_mm_loadu_pd(ptr_w), _mm_loadu_pd(ptr_w));
1316 const __m128d vxi = _mm_loadu_pd(ptr_point_cloud);
1317 const __m128d vyi = _mm_loadu_pd(ptr_point_cloud + 2);
1318 const __m128d vZi = _mm_loadu_pd(ptr_point_cloud + 4);
1319 const __m128d vinvZi = _mm_div_pd(vones, vZi);
1321 vsum_wi2_xi2 = _mm_add_pd(vsum_wi2_xi2, _mm_mul_pd(vwi2, _mm_mul_pd(vxi, vxi)));
1322 vsum_wi2_yi2 = _mm_add_pd(vsum_wi2_yi2, _mm_mul_pd(vwi2, _mm_mul_pd(vyi, vyi)));
1323 vsum_wi2 = _mm_add_pd(vsum_wi2, vwi2);
1324 vsum_wi2_xi_yi = _mm_add_pd(vsum_wi2_xi_yi, _mm_mul_pd(vwi2, _mm_mul_pd(vxi, vyi)));
1325 vsum_wi2_xi = _mm_add_pd(vsum_wi2_xi, _mm_mul_pd(vwi2, vxi));
1326 vsum_wi2_yi = _mm_add_pd(vsum_wi2_yi, _mm_mul_pd(vwi2, vyi));
1328 const __m128d vwi2_invZi = _mm_mul_pd(vwi2, vinvZi);
1329 vsum_wi2_xi_Zi = _mm_add_pd(vsum_wi2_xi_Zi, _mm_mul_pd(vxi, vwi2_invZi));
1330 vsum_wi2_yi_Zi = _mm_add_pd(vsum_wi2_yi_Zi, _mm_mul_pd(vyi, vwi2_invZi));
1331 vsum_wi2_Zi = _mm_add_pd(vsum_wi2_Zi, vwi2_invZi);
1336 _mm_storeu_pd(vtmp, vsum_wi2_xi2);
1337 double sum_wi2_xi2 = vtmp[0] + vtmp[1];
1339 _mm_storeu_pd(vtmp, vsum_wi2_yi2);
1340 double sum_wi2_yi2 = vtmp[0] + vtmp[1];
1342 _mm_storeu_pd(vtmp, vsum_wi2);
1343 double sum_wi2 = vtmp[0] + vtmp[1];
1345 _mm_storeu_pd(vtmp, vsum_wi2_xi_yi);
1346 double sum_wi2_xi_yi = vtmp[0] + vtmp[1];
1348 _mm_storeu_pd(vtmp, vsum_wi2_xi);
1349 double sum_wi2_xi = vtmp[0] + vtmp[1];
1351 _mm_storeu_pd(vtmp, vsum_wi2_yi);
1352 double sum_wi2_yi = vtmp[0] + vtmp[1];
1354 _mm_storeu_pd(vtmp, vsum_wi2_xi_Zi);
1355 double sum_wi2_xi_Zi = vtmp[0] + vtmp[1];
1357 _mm_storeu_pd(vtmp, vsum_wi2_yi_Zi);
1358 double sum_wi2_yi_Zi = vtmp[0] + vtmp[1];
1360 _mm_storeu_pd(vtmp, vsum_wi2_Zi);
1361 double sum_wi2_Zi = vtmp[0] + vtmp[1];
1363 for (; cpt < point_cloud_face.size(); cpt += 3) {
1364 double wi2 = w[cpt / 3] * w[cpt / 3];
1366 double xi = point_cloud_face[cpt];
1367 double yi = point_cloud_face[cpt + 1];
1368 double Zi = point_cloud_face[cpt + 2];
1369 double invZi = 1.0 / Zi;
1371 sum_wi2_xi2 += wi2 * xi * xi;
1372 sum_wi2_yi2 += wi2 * yi * yi;
1374 sum_wi2_xi_yi += wi2 * xi * yi;
1375 sum_wi2_xi += wi2 * xi;
1376 sum_wi2_yi += wi2 * yi;
1378 sum_wi2_xi_Zi += wi2 * xi * invZi;
1379 sum_wi2_yi_Zi += wi2 * yi * invZi;
1380 sum_wi2_Zi += wi2 * invZi;
1383 ATA_3x3[0] = sum_wi2_xi2;
1384 ATA_3x3[1] = sum_wi2_xi_yi;
1385 ATA_3x3[2] = sum_wi2_xi;
1386 ATA_3x3[3] = sum_wi2_xi_yi;
1387 ATA_3x3[4] = sum_wi2_yi2;
1388 ATA_3x3[5] = sum_wi2_yi;
1389 ATA_3x3[6] = sum_wi2_xi;
1390 ATA_3x3[7] = sum_wi2_yi;
1391 ATA_3x3[8] = sum_wi2;
1393 Mat33<double> minv = ATA_3x3.inverse();
1395 A = minv[0] * sum_wi2_xi_Zi + minv[1] * sum_wi2_yi_Zi + minv[2] * sum_wi2_Zi;
1396 B = minv[3] * sum_wi2_xi_Zi + minv[4] * sum_wi2_yi_Zi + minv[5] * sum_wi2_Zi;
1397 C = minv[6] * sum_wi2_xi_Zi + minv[7] * sum_wi2_yi_Zi + minv[8] * sum_wi2_Zi;
1405 __m128d verror = _mm_set1_pd(0.0);
1406 if (point_cloud_face.size() / 3 >= 2) {
1407 const double *ptr_point_cloud = &point_cloud_face[0];
1408 const __m128d vA = _mm_set1_pd(A);
1409 const __m128d vB = _mm_set1_pd(B);
1410 const __m128d vC = _mm_set1_pd(C);
1411 const __m128d vones = _mm_set1_pd(1.0);
1413 double *ptr_residues = &residues[0];
1415 for (; cpt <= point_cloud_face.size() - 6; cpt += 6, ptr_point_cloud += 6, ptr_residues += 2) {
1416 const __m128d vxi = _mm_loadu_pd(ptr_point_cloud);
1417 const __m128d vyi = _mm_loadu_pd(ptr_point_cloud + 2);
1418 const __m128d vZi = _mm_loadu_pd(ptr_point_cloud + 4);
1419 const __m128d vinvZi = _mm_div_pd(vones, vZi);
1421 const __m128d tmp = _mm_add_pd(_mm_add_pd(_mm_mul_pd(vA, vxi), _mm_mul_pd(vB, vyi)), _mm_sub_pd(vC, vinvZi));
1422 verror = _mm_add_pd(verror, _mm_mul_pd(tmp, tmp));
1424 _mm_storeu_pd(ptr_residues, tmp);
1428 _mm_storeu_pd(vtmp, verror);
1429 error = vtmp[0] + vtmp[1];
1431 for (
size_t idx = cpt; idx < point_cloud_face.size(); idx += 3) {
1432 double xi = point_cloud_face[idx];
1433 double yi = point_cloud_face[idx + 1];
1434 double Zi = point_cloud_face[idx + 2];
1436 error +=
vpMath::sqr(A * xi + B * yi + C - 1 / Zi);
1437 residues[idx / 3] = (A * xi + B * yi + C - 1 / Zi);
1440 error /= point_cloud_face.size() / 3;
1447 while (std::fabs(error - prev_error) > 1e-6 && (iter < max_iter)) {
1463 for (
size_t i = 0; i < point_cloud_face.size() / 3; i++) {
1464 double xi = point_cloud_face[3 * i];
1465 double yi = point_cloud_face[3 * i + 1];
1466 double Zi = point_cloud_face[3 * i + 2];
1468 residues[i] = (A * xi + B * yi + C - 1 / Zi);
1472 tukey_robust.MEstimator(residues, w, 1e-2);
1475 double sum_wi2_xi2 = 0.0, sum_wi2_yi2 = 0.0, sum_wi2 = 0.0;
1476 double sum_wi2_xi_yi = 0.0, sum_wi2_xi = 0.0, sum_wi2_yi = 0.0;
1478 double sum_wi2_xi_Zi = 0.0, sum_wi2_yi_Zi = 0.0, sum_wi2_Zi = 0.0;
1480 for (
size_t i = 0; i < point_cloud_face.size() / 3; i++) {
1481 double wi2 = w[i] * w[i];
1483 double xi = point_cloud_face[3 * i];
1484 double yi = point_cloud_face[3 * i + 1];
1485 double Zi = point_cloud_face[3 * i + 2];
1486 double invZi = 1 / Zi;
1488 sum_wi2_xi2 += wi2 * xi * xi;
1489 sum_wi2_yi2 += wi2 * yi * yi;
1491 sum_wi2_xi_yi += wi2 * xi * yi;
1492 sum_wi2_xi += wi2 * xi;
1493 sum_wi2_yi += wi2 * yi;
1495 sum_wi2_xi_Zi += wi2 * xi * invZi;
1496 sum_wi2_yi_Zi += wi2 * yi * invZi;
1497 sum_wi2_Zi += wi2 * invZi;
1500 ATA_3x3[0] = sum_wi2_xi2;
1501 ATA_3x3[1] = sum_wi2_xi_yi;
1502 ATA_3x3[2] = sum_wi2_xi;
1503 ATA_3x3[3] = sum_wi2_xi_yi;
1504 ATA_3x3[4] = sum_wi2_yi2;
1505 ATA_3x3[5] = sum_wi2_yi;
1506 ATA_3x3[6] = sum_wi2_xi;
1507 ATA_3x3[7] = sum_wi2_yi;
1508 ATA_3x3[8] = sum_wi2;
1510 Mat33<double> minv = ATA_3x3.inverse();
1512 A = minv[0] * sum_wi2_xi_Zi + minv[1] * sum_wi2_yi_Zi + minv[2] * sum_wi2_Zi;
1513 B = minv[3] * sum_wi2_xi_Zi + minv[4] * sum_wi2_yi_Zi + minv[5] * sum_wi2_Zi;
1514 C = minv[6] * sum_wi2_xi_Zi + minv[7] * sum_wi2_yi_Zi + minv[8] * sum_wi2_Zi;
1520 for (
size_t i = 0; i < point_cloud_face.size() / 3; i++) {
1521 double xi = point_cloud_face[3 * i];
1522 double yi = point_cloud_face[3 * i + 1];
1523 double Zi = point_cloud_face[3 * i + 2];
1525 error +=
vpMath::sqr(A * xi + B * yi + C - 1 / Zi);
1526 residues[i] = (A * xi + B * yi + C - 1 / Zi);
1529 error /= point_cloud_face.size() / 3;
1535 x_estimated.
resize(3,
false);
1545 unsigned int max_iter = 10;
1546 double prev_error = 1e3;
1547 double error = 1e3 - 1;
1549 std::vector<double> weights(point_cloud_face.size() / 3, 1.0);
1550 std::vector<double> residues(point_cloud_face.size() / 3);
1551 vpMatrix M((
unsigned int)(point_cloud_face.size() / 3), 3);
1552 vpMbtTukeyEstimator<double> tukey;
1555 for (
unsigned int iter = 0; iter < max_iter && std::fabs(error - prev_error) > 1e-6; iter++) {
1557 tukey.MEstimator(residues, weights, 1e-4);
1570 for (
size_t i = 0; i < point_cloud_face.size() / 3; i++) {
1571 residues[i] = std::fabs(A * point_cloud_face[3 * i] + B * point_cloud_face[3 * i + 1] +
1572 C * point_cloud_face[3 * i + 2] + D) /
1573 sqrt(A * A + B * B + C * C);
1576 tukey.MEstimator(residues, weights, 1e-4);
1577 plane_equation_estimated.
resize(4,
false);
1581 double centroid_x = 0.0, centroid_y = 0.0, centroid_z = 0.0;
1582 double total_w = 0.0;
1584 for (
size_t i = 0; i < point_cloud_face.size() / 3; i++) {
1585 centroid_x += weights[i] * point_cloud_face[3 * i];
1586 centroid_y += weights[i] * point_cloud_face[3 * i + 1];
1587 centroid_z += weights[i] * point_cloud_face[3 * i + 2];
1588 total_w += weights[i];
1591 centroid_x /= total_w;
1592 centroid_y /= total_w;
1593 centroid_z /= total_w;
1596 for (
size_t i = 0; i < point_cloud_face.size() / 3; i++) {
1597 M[(
unsigned int)i][0] = weights[i] * (point_cloud_face[3 * i] - centroid_x);
1598 M[(
unsigned int)i][1] = weights[i] * (point_cloud_face[3 * i + 1] - centroid_y);
1599 M[(
unsigned int)i][2] = weights[i] * (point_cloud_face[3 * i + 2] - centroid_z);
1608 double smallestSv = W[0];
1609 unsigned int indexSmallestSv = 0;
1610 for (
unsigned int i = 1; i < W.
size(); i++) {
1611 if (W[i] < smallestSv) {
1613 indexSmallestSv = i;
1617 normal = V.
getCol(indexSmallestSv);
1620 double A = normal[0], B = normal[1], C = normal[2];
1621 double D = -(A * centroid_x + B * centroid_y + C * centroid_z);
1624 plane_equation_estimated[0] = A;
1625 plane_equation_estimated[1] = B;
1626 plane_equation_estimated[2] = C;
1627 plane_equation_estimated[3] = D;
1632 for (
size_t i = 0; i < point_cloud_face.size() / 3; i++) {
1633 residues[i] = std::fabs(A * point_cloud_face[3 * i] + B * point_cloud_face[3 * i + 1] +
1634 C * point_cloud_face[3 * i + 2] + D) /
1635 sqrt(A * A + B * B + C * C);
1636 error += weights[i] * residues[i];
1642 tukey.MEstimator(residues, weights, 1e-4);
1645 centroid.
resize(3,
false);
1646 double total_w = 0.0;
1648 for (
size_t i = 0; i < point_cloud_face.size() / 3; i++) {
1649 centroid[0] += weights[i] * point_cloud_face[3 * i];
1650 centroid[1] += weights[i] * point_cloud_face[3 * i + 1];
1651 centroid[2] += weights[i] * point_cloud_face[3 * i + 2];
1652 total_w += weights[i];
1655 centroid[0] /= total_w;
1656 centroid[1] /= total_w;
1657 centroid[2] /= total_w;
1660 double A = normal[0], B = normal[1], C = normal[2];
1661 double D = -(A * centroid[0] + B * centroid[1] + C * centroid[2]);
1664 plane_equation_estimated[0] = A;
1665 plane_equation_estimated[1] = B;
1666 plane_equation_estimated[2] = C;
1667 plane_equation_estimated[3] = D;
1675 std::vector<std::vector<double> >
1678 std::vector<std::vector<double> > features;
1703 #if (VISP_CXX_STANDARD > VISP_CXX_STANDARD_98)
1704 std::vector<double> params = { 2,
1705 im_centroid.
get_i(),
1706 im_centroid.
get_j(),
1707 im_extremity.
get_i(),
1708 im_extremity.
get_j() };
1710 std::vector<double> params;
1711 params.push_back(2);
1712 params.push_back(im_centroid.
get_i());
1713 params.push_back(im_centroid.
get_j());
1714 params.push_back(im_extremity.
get_i());
1715 params.push_back(im_extremity.
get_j());
1717 features.push_back(params);
1735 pt_extremity.
set_X(pt_centroid.
get_X() + correct_normal[0] * scale);
1736 pt_extremity.
set_Y(pt_centroid.
get_Y() + correct_normal[1] * scale);
1737 pt_extremity.
set_Z(pt_centroid.
get_Z() + correct_normal[2] * scale);
1743 #if (VISP_CXX_STANDARD > VISP_CXX_STANDARD_98)
1744 std::vector<double> params = { 3,
1745 im_centroid.
get_i(),
1746 im_centroid.
get_j(),
1747 im_extremity.
get_i(),
1748 im_extremity.
get_j() };
1750 std::vector<double> params;
1751 params.push_back(3);
1752 params.push_back(im_centroid.
get_i());
1753 params.push_back(im_centroid.
get_j());
1754 params.push_back(im_extremity.
get_i());
1755 params.push_back(im_extremity.
get_j());
1757 features.push_back(params);
1778 bool displayFullModel)
1780 std::vector<std::vector<double> > models;
1788 std::vector<std::vector<double> > lineModels =
1790 models.insert(models.end(), lineModels.begin(), lineModels.end());
1812 if (dx <= std::numeric_limits<double>::epsilon() && dy <= std::numeric_limits<double>::epsilon() &&
1813 dz <= std::numeric_limits<double>::epsilon())
1825 (*it)->setCameraParameters(camera);
1835 (*it)->useScanLine = v;
unsigned int size() const
Return the number of elements of the 2D array.
Generic class defining intrinsic camera parameters.
void computeFov(const unsigned int &w, const unsigned int &h)
Implementation of column vector and the associated operations.
static double dotProd(const vpColVector &a, const vpColVector &b)
vpColVector & normalize()
void resize(unsigned int i, bool flagNullify=true)
Class to define RGB colors available for display functionalities.
static const vpColor blue
static void displayLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1, bool segment=true)
static void displayArrow(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color=vpColor::white, unsigned int w=4, unsigned int h=2, unsigned int thickness=1)
error that can be emitted by ViSP classes.
@ badValue
Used to indicate that a value is not in the allowed range.
Implementation of an homogeneous matrix and operations on such kind of matrices.
vpHomogeneousMatrix inverse() const
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
unsigned int getWidth() const
unsigned int getHeight() const
static double sqr(double x)
Implementation of a matrix and operations on matrices.
void svd(vpColVector &w, vpMatrix &V)
vpColVector getCol(unsigned int j) const
vpMbScanLine & getMbScanLineRenderer()
bool isVisible(unsigned int i)
void computeScanLineQuery(const vpPoint &a, const vpPoint &b, std::vector< std::pair< vpPoint, vpPoint > > &lines, const bool &displayResults=false)
Manage the line of a polygon used in the model-based tracker.
void setIndex(unsigned int i)
vpPoint * p2
The second extremity.
std::list< int > Lindex_polygon
Index of the faces which contain the line.
void buildFrom(vpPoint &_p1, vpPoint &_p2, vpUniRand &rand_gen)
vpMbHiddenFaces< vpMbtPolygon > * hiddenface
Pointer to the list of faces.
std::vector< std::vector< double > > getModelForDisplay(unsigned int width, unsigned int height, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, bool displayFullModel=false)
bool useScanLine
Use scanline rendering.
vpPoint * p1
The first extremity.
void setCameraParameters(const vpCameraParameters &camera)
void setName(const std::string &line_name)
void setVisible(bool _isvisible)
void addPolygon(const int &index)
vpMbtPolygon & getPolygon()
double m_pclPlaneEstimationRansacThreshold
PCL plane estimation RANSAC threshold.
int m_pclPlaneEstimationMethod
PCL plane estimation method.
double m_distNearClip
Distance for near clipping.
void computeInteractionMatrix(const vpHomogeneousMatrix &cMo, vpMatrix &L, vpColVector &features)
std::vector< std::vector< double > > getModelForDisplay(unsigned int width, unsigned int height, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, bool displayFullModel=false)
void addLine(vpPoint &p1, vpPoint &p2, vpMbHiddenFaces< vpMbtPolygon > *const faces, vpUniRand &rand_gen, int polygon=-1, std::string name="")
void setCameraParameters(const vpCameraParameters &camera)
void computeDesiredFeaturesSVD(const std::vector< double > &point_cloud_face, const vpHomogeneousMatrix &cMo, vpColVector &desired_features, vpColVector &desired_normal, vpColVector ¢roid_point)
double m_distFarClip
Distance for near clipping.
bool samePoint(const vpPoint &P1, const vpPoint &P2) const
void displayFeature(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double scale=0.05, unsigned int thickness=1)
vpMbHiddenFaces< vpMbtPolygon > * m_hiddenFace
Pointer to the list of faces.
std::vector< std::vector< double > > getFeaturesForDisplay(const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double scale=0.05)
bool computePolygonCentroid(const std::vector< vpPoint > &points, vpPoint ¢roid)
void computeROI(const vpHomogeneousMatrix &cMo, unsigned int width, unsigned int height, std::vector< vpImagePoint > &roiPts)
void setScanLineVisibilityTest(bool v)
void estimatePlaneEquationSVD(const std::vector< double > &point_cloud_face, const vpHomogeneousMatrix &cMo, vpColVector &plane_equation_estimated, vpColVector ¢roid)
std::vector< vpMbtDistanceLine * > m_listOfFaceLines
void computeDesiredNormalAndCentroid(const vpHomogeneousMatrix &cMo, const vpColVector &desired_normal, const vpColVector ¢roid_point)
bool m_isTrackedDepthNormalFace
vpFeatureEstimationType m_featureEstimationMethod
Method to estimate the desired features.
vpMbtPolygon * m_polygon
Polygon defining the face.
vpPoint m_faceDesiredCentroid
Desired centroid (computed from the sensor)
void display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, unsigned int thickness=1, bool displayFullModel=false)
vpCameraParameters m_cam
Camera intrinsic parameters.
@ ROBUST_FEATURE_ESTIMATION
Robust scheme to estimate the normal of the plane.
@ ROBUST_SVD_PLANE_ESTIMATION
Use SVD and robust scheme to estimate the normal of the plane.
@ PCL_PLANE_ESTIMATION
Use PCL to estimate the normal of the plane.
vpPlane m_planeObject
Plane equation described in the object frame.
void computeVisibilityDisplay()
bool m_faceActivated
True if the face should be considered by the tracker.
@ GEOMETRIC_CENTROID
Compute the geometric centroid.
vpFaceCentroidType m_faceCentroidMethod
Method to compute the face centroid for the current features.
int m_pclPlaneEstimationRansacMaxIter
PCL pane estimation max number of iterations.
unsigned int m_clippingFlag
Flags specifying which clipping to used.
void computeDesiredFeaturesRobustFeatures(const std::vector< double > &point_cloud_face_custom, const std::vector< double > &point_cloud_face, const vpHomogeneousMatrix &cMo, vpColVector &desired_features, vpColVector &desired_normal, vpColVector ¢roid_point)
vpPoint m_faceDesiredNormal
Face (normalized) normal (computed from the sensor)
void estimateFeatures(const std::vector< double > &point_cloud_face, const vpHomogeneousMatrix &cMo, vpColVector &x_estimated, std::vector< double > &weights)
virtual ~vpMbtFaceDepthNormal()
std::vector< PolygonLine > m_polygonLines
bool computeDesiredFeaturesPCL(const pcl::PointCloud< pcl::PointXYZ >::ConstPtr &point_cloud_face, vpColVector &desired_features, vpColVector &desired_normal, vpColVector ¢roid_point)
void computeNormalVisibility(double nx, double ny, double nz, const vpColVector ¢roid_point, vpColVector &face_normal)
bool m_useScanLine
Scan line visibility.
bool computeDesiredFeatures(const vpHomogeneousMatrix &cMo, unsigned int width, unsigned int height, const pcl::PointCloud< pcl::PointXYZ >::ConstPtr &point_cloud, vpColVector &desired_features, unsigned int stepX, unsigned int stepY, const vpImage< bool > *mask=nullptr)
virtual bool isVisible(const vpHomogeneousMatrix &cMo, double alpha, const bool &modulo=false, const vpCameraParameters &cam=vpCameraParameters(), unsigned int width=0, unsigned int height=0)
static bool inRoiMask(const vpImage< bool > *mask, unsigned int i, unsigned int j)
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
static void convertPoint(const vpCameraParameters &cam, const double &u, const double &v, double &x, double &y)
void changeFrame(const vpHomogeneousMatrix &cMo)
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
double get_oX() const
Get the point oX coordinate in the object frame.
double get_y() const
Get the point y coordinate in the image plane.
double get_Y() const
Get the point cY coordinate in the camera frame.
double get_oZ() const
Get the point oZ coordinate in the object frame.
void set_X(double cX)
Set the point cX coordinate in the camera frame.
double get_x() const
Get the point x coordinate in the image plane.
void set_Y(double cY)
Set the point cY coordinate in the camera frame.
double get_Z() const
Get the point cZ coordinate in the camera frame.
void set_Z(double cZ)
Set the point cZ coordinate in the camera frame.
double get_oY() const
Get the point oY coordinate in the object frame.
void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP) const VP_OVERRIDE
double get_X() const
Get the point cX coordinate in the camera frame.
void setWorldCoordinates(double oX, double oY, double oZ)
Implements a 3D polygon with render functionalities like clipping.
void setFarClippingDistance(const double &dist)
void setNearClippingDistance(const double &dist)
void setClipping(const unsigned int &flags)
void getRoiClipped(const vpCameraParameters &cam, std::vector< vpImagePoint > &roi)
void getPolygonClipped(std::vector< std::pair< vpPoint, unsigned int > > &poly)
Defines a generic 2D polygon.
vpRect getBoundingBox() const
bool isInside(const vpImagePoint &iP, const PointInPolygonMethod &method=PnPolyRayCasting) const
Defines a rectangle in the plane.
void setRight(double pos)
void setBottom(double pos)
Class for generating random numbers with uniform probability density.
VISP_EXPORT bool checkSSE2()