Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vpMbtDistanceKltCylinder.cpp
1/****************************************************************************
2 *
3 * ViSP, open source Visual Servoing Platform software.
4 * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
5 *
6 * This software is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 * See the file LICENSE.txt at the root directory of this source
11 * distribution for additional information about the GNU GPL.
12 *
13 * For using ViSP with software that can not be combined with the GNU
14 * GPL, please contact Inria about acquiring a ViSP Professional
15 * Edition License.
16 *
17 * See https://visp.inria.fr for more information.
18 *
19 * This software was developed at:
20 * Inria Rennes - Bretagne Atlantique
21 * Campus Universitaire de Beaulieu
22 * 35042 Rennes Cedex
23 * France
24 *
25 * If you have questions regarding the use of this file, please contact
26 * Inria at visp@inria.fr
27 *
28 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30 *
31 * Description:
32 * Klt cylinder, containing points of interest.
33 *
34*****************************************************************************/
35
36#include <visp3/core/vpPolygon.h>
37#include <visp3/mbt/vpMbtDistanceKltCylinder.h>
38#include <visp3/mbt/vpMbtDistanceKltPoints.h>
39
40#if defined(VISP_HAVE_MODULE_KLT) && defined(VISP_HAVE_OPENCV) && defined(HAVE_OPENCV_IMGPROC) && defined(HAVE_OPENCV_VIDEO)
41
42#if defined(VISP_HAVE_CLIPPER)
43#include <clipper.hpp> // clipper private library
44#endif
45
46#if defined(__APPLE__) && defined(__MACH__) // Apple OSX and iOS (Darwin)
47#include <TargetConditionals.h> // To detect OSX or IOS using TARGET_OS_IPHONE or TARGET_OS_IOS macro
48#endif
49
55 : c0Mo(), p1Ext(), p2Ext(), cylinder(), circle1(), circle2(), initPoints(), initPoints3D(), curPoints(),
56 curPointsInd(), nbPointsCur(0), nbPointsInit(0), minNbPoint(4), enoughPoints(false), cam(),
57 isTrackedKltCylinder(true), listIndicesCylinderBBox(), hiddenface(NULL), useScanLine(false)
58{
59}
60
66
67void vpMbtDistanceKltCylinder::buildFrom(const vpPoint &p1, const vpPoint &p2, const double &r)
68{
69 p1Ext = p1;
70 p2Ext = p2;
71
72 vpColVector ABC(3);
73 vpColVector V1(3);
74 vpColVector V2(3);
75
76 V1[0] = p1.get_oX();
77 V1[1] = p1.get_oY();
78 V1[2] = p1.get_oZ();
79 V2[0] = p2.get_oX();
80 V2[1] = p2.get_oY();
81 V2[2] = p2.get_oZ();
82
83 // Get the axis of the cylinder
84 ABC = V1 - V2;
85
86 // Build our extremity circles
87 circle1.setWorldCoordinates(ABC[0], ABC[1], ABC[2], p1.get_oX(), p1.get_oY(), p1.get_oZ(), r);
88 circle2.setWorldCoordinates(ABC[0], ABC[1], ABC[2], p2.get_oX(), p2.get_oY(), p2.get_oZ(), r);
89
90 // Build our cylinder
91 cylinder.setWorldCoordinates(ABC[0], ABC[1], ABC[2], (p1.get_oX() + p2.get_oX()) / 2.0,
92 (p1.get_oY() + p2.get_oY()) / 2.0, (p1.get_oZ() + p2.get_oZ()) / 2.0, r);
93}
94
104{
105 c0Mo = cMo;
106 cylinder.changeFrame(cMo);
107
108 // extract ids of the points in the face
109 nbPointsInit = 0;
110 nbPointsCur = 0;
111 initPoints = std::map<int, vpImagePoint>();
112 initPoints3D = std::map<int, vpPoint>();
113 curPoints = std::map<int, vpImagePoint>();
114 curPointsInd = std::map<int, int>();
115
116 for (unsigned int i = 0; i < static_cast<unsigned int>(_tracker.getNbFeatures()); i++) {
117 long id;
118 float x_tmp, y_tmp;
119 _tracker.getFeature((int)i, id, x_tmp, y_tmp);
120
121 bool add = false;
122
123 if (useScanLine) {
124 if ((unsigned int)y_tmp < hiddenface->getMbScanLineRenderer().getPrimitiveIDs().getHeight() &&
125 (unsigned int)x_tmp < hiddenface->getMbScanLineRenderer().getPrimitiveIDs().getWidth()) {
126 for (unsigned int kc = 0; kc < listIndicesCylinderBBox.size(); kc++)
127 if (hiddenface->getMbScanLineRenderer().getPrimitiveIDs()[(unsigned int)y_tmp][(unsigned int)x_tmp] ==
129 add = true;
130 break;
131 }
132 }
133 } else {
134 std::vector<vpImagePoint> roi;
135 for (unsigned int kc = 0; kc < listIndicesCylinderBBox.size(); kc++) {
136 hiddenface->getPolygon()[(size_t)listIndicesCylinderBBox[kc]]->getRoiClipped(cam, roi);
137 if (vpPolygon::isInside(roi, y_tmp, x_tmp)) {
138 add = true;
139 break;
140 }
141 roi.clear();
142 }
143 }
144
145 if (add) {
146
147 double xm = 0, ym = 0;
148 vpPixelMeterConversion::convertPoint(cam, x_tmp, y_tmp, xm, ym);
149 double Z = computeZ(xm, ym);
150 if (!vpMath::isNaN(Z)) {
151#ifdef TARGET_OS_IPHONE
152 initPoints[(int)id] = vpImagePoint(y_tmp, x_tmp);
153 curPoints[(int)id] = vpImagePoint(y_tmp, x_tmp);
154 curPointsInd[(int)id] = (int)i;
155#else
156 initPoints[id] = vpImagePoint(y_tmp, x_tmp);
157 curPoints[id] = vpImagePoint(y_tmp, x_tmp);
158 curPointsInd[id] = (int)i;
159#endif
160 nbPointsInit++;
161 nbPointsCur++;
162
163 vpPoint p;
164 p.setWorldCoordinates(xm * Z, ym * Z, Z);
165#ifdef TARGET_OS_IPHONE
166 initPoints3D[(int)id] = p;
167#else
168 initPoints3D[id] = p;
169#endif
170 // std::cout << "Computed Z for : " << xm << "," << ym << " : " <<
171 // computeZ(xm,ym) << std::endl;
172 }
173 }
174 }
175
176 if (nbPointsCur >= minNbPoint)
177 enoughPoints = true;
178 else
179 enoughPoints = false;
180
181 // std::cout << "Nb detected points in cylinder : " << nbPointsCur <<
182 // std::endl;
183}
184
194{
195 long id;
196 float x, y;
197 nbPointsCur = 0;
198 curPoints = std::map<int, vpImagePoint>();
199 curPointsInd = std::map<int, int>();
200
201 for (unsigned int i = 0; i < static_cast<unsigned int>(_tracker.getNbFeatures()); i++) {
202 _tracker.getFeature((int)i, id, x, y);
203 if (isTrackedFeature((int)id)) {
204#ifdef TARGET_OS_IPHONE
205 curPoints[(int)id] = vpImagePoint(static_cast<double>(y), static_cast<double>(x));
206 curPointsInd[(int)id] = (int)i;
207#else
208 curPoints[id] = vpImagePoint(static_cast<double>(y), static_cast<double>(x));
209 curPointsInd[id] = (int)i;
210#endif
211 nbPointsCur++;
212 }
213 }
214
215 if (nbPointsCur >= minNbPoint)
216 enoughPoints = true;
217 else
218 enoughPoints = false;
219
220 return nbPointsCur;
221}
222
231void vpMbtDistanceKltCylinder::removeOutliers(const vpColVector &_w, const double &threshold_outlier)
232{
233 std::map<int, vpImagePoint> tmp;
234 std::map<int, int> tmp2;
235 unsigned int nbSupp = 0;
236 unsigned int k = 0;
237
238 nbPointsCur = 0;
239 std::map<int, vpImagePoint>::const_iterator iter = curPoints.begin();
240 for (; iter != curPoints.end(); ++iter) {
241 if (_w[k] > threshold_outlier && _w[k + 1] > threshold_outlier) {
242 // if(_w[k] > threshold_outlier || _w[k+1] > threshold_outlier){
243 tmp[iter->first] = vpImagePoint(iter->second.get_i(), iter->second.get_j());
244 tmp2[iter->first] = curPointsInd[iter->first];
245 nbPointsCur++;
246 } else {
247 nbSupp++;
248 initPoints.erase(iter->first);
249 }
250
251 k += 2;
252 }
253
254 if (nbSupp != 0) {
255 curPoints = std::map<int, vpImagePoint>();
256 curPointsInd = std::map<int, int>();
257
258 curPoints = tmp;
259 curPointsInd = tmp2;
260 if (nbPointsCur >= minNbPoint)
261 enoughPoints = true;
262 else
263 enoughPoints = false;
264 }
265}
266
279 vpMatrix &_J)
280{
281 unsigned int index_ = 0;
282
283 cylinder.changeFrame(_cMc0 * c0Mo);
284
285 std::map<int, vpImagePoint>::const_iterator iter = curPoints.begin();
286 for (; iter != curPoints.end(); ++iter) {
287 int id(iter->first);
288 double i_cur(iter->second.get_i()), j_cur(iter->second.get_j());
289
290 double x_cur(0), y_cur(0);
291 vpPixelMeterConversion::convertPoint(cam, j_cur, i_cur, x_cur, y_cur);
292
293 vpPoint p0 = initPoints3D[id];
294 p0.changeFrame(_cMc0);
295 p0.project();
296
297 double x0_transform(p0.get_x()), y0_transform(p0.get_y());
298
299 double Z = computeZ(x_cur, y_cur);
300
301 if (vpMath::isNaN(Z) || Z < std::numeric_limits<double>::epsilon()) {
302 // std::cout << "Z is Nan : " << A << " , " << B << " , " << C << "
303 // | " << Z << " | " << x_cur << " , " << y_cur << std::endl;
304 // std::cout << std::sqrt(B*B - A*C) << " , " << B*B - A*C <<
305 // std::endl;
306
307 _J[2 * index_][0] = 0;
308 _J[2 * index_][1] = 0;
309 _J[2 * index_][2] = 0;
310 _J[2 * index_][3] = 0;
311 _J[2 * index_][4] = 0;
312 _J[2 * index_][5] = 0;
313
314 _J[2 * index_ + 1][0] = 0;
315 _J[2 * index_ + 1][1] = 0;
316 _J[2 * index_ + 1][2] = 0;
317 _J[2 * index_ + 1][3] = 0;
318 _J[2 * index_ + 1][4] = 0;
319 _J[2 * index_ + 1][5] = 0;
320
321 _R[2 * index_] = (x0_transform - x_cur);
322 _R[2 * index_ + 1] = (y0_transform - y_cur);
323 index_++;
324 } else {
325 double invZ = 1.0 / Z;
326
327 _J[2 * index_][0] = -invZ;
328 _J[2 * index_][1] = 0;
329 _J[2 * index_][2] = x_cur * invZ;
330 _J[2 * index_][3] = x_cur * y_cur;
331 _J[2 * index_][4] = -(1 + x_cur * x_cur);
332 _J[2 * index_][5] = y_cur;
333
334 _J[2 * index_ + 1][0] = 0;
335 _J[2 * index_ + 1][1] = -invZ;
336 _J[2 * index_ + 1][2] = y_cur * invZ;
337 _J[2 * index_ + 1][3] = (1 + y_cur * y_cur);
338 _J[2 * index_ + 1][4] = -y_cur * x_cur;
339 _J[2 * index_ + 1][5] = -x_cur;
340
341 _R[2 * index_] = (x0_transform - x_cur);
342 _R[2 * index_ + 1] = (y0_transform - y_cur);
343 index_++;
344 }
345 }
346}
347
355bool vpMbtDistanceKltCylinder::isTrackedFeature(int _id)
356{
357 std::map<int, vpImagePoint>::iterator iter = initPoints.find(_id);
358 if (iter != initPoints.end())
359 return true;
360
361 return false;
362}
363
374 cv::Mat &mask,
375 unsigned char nb, unsigned int shiftBorder)
376{
377 int width = mask.cols;
378 int height = mask.rows;
379
380 for (unsigned int kc = 0; kc < listIndicesCylinderBBox.size(); kc++) {
381 if ((*hiddenface)[(unsigned int)listIndicesCylinderBBox[kc]]->isVisible() &&
382 (*hiddenface)[(unsigned int)listIndicesCylinderBBox[kc]]->getNbPoint() > 2) {
383 int i_min, i_max, j_min, j_max;
384 std::vector<vpImagePoint> roi;
385 (*hiddenface)[(unsigned int)listIndicesCylinderBBox[kc]]->getRoiClipped(cam, roi);
386
387 double shiftBorder_d = (double)shiftBorder;
388#if defined(VISP_HAVE_CLIPPER)
389 std::vector<vpImagePoint> roi_offset;
390
391 ClipperLib::Path path;
392 for (std::vector<vpImagePoint>::const_iterator it = roi.begin(); it != roi.end(); ++it) {
393 path.push_back(ClipperLib::IntPoint((ClipperLib::cInt)it->get_u(), (ClipperLib::cInt)it->get_v()));
394 }
395
396 ClipperLib::Paths solution;
397 ClipperLib::ClipperOffset co;
398 co.AddPath(path, ClipperLib::jtRound, ClipperLib::etClosedPolygon);
399 co.Execute(solution, -shiftBorder_d);
400
401 // Keep biggest polygon by area
402 if (!solution.empty()) {
403 size_t index_max = 0;
404
405 if (solution.size() > 1) {
406 double max_area = 0;
407 vpPolygon polygon_area;
408
409 for (size_t i = 0; i < solution.size(); i++) {
410 std::vector<vpImagePoint> corners;
411
412 for (size_t j = 0; j < solution[i].size(); j++) {
413 corners.push_back(vpImagePoint((double)(solution[i][j].Y), (double)(solution[i][j].X)));
414 }
415
416 polygon_area.buildFrom(corners);
417 if (polygon_area.getArea() > max_area) {
418 max_area = polygon_area.getArea();
419 index_max = i;
420 }
421 }
422 }
423
424 for (size_t i = 0; i < solution[index_max].size(); i++) {
425 roi_offset.push_back(vpImagePoint((double)(solution[index_max][i].Y), (double)(solution[index_max][i].X)));
426 }
427 } else {
428 roi_offset = roi;
429 }
430
431 vpPolygon polygon_test(roi_offset);
432 vpImagePoint imPt;
433#endif
434
435#if defined(VISP_HAVE_CLIPPER)
436 vpPolygon3D::getMinMaxRoi(roi_offset, i_min, i_max, j_min, j_max);
437#else
438 vpPolygon3D::getMinMaxRoi(roi, i_min, i_max, j_min, j_max);
439#endif
440
441 /* check image boundaries */
442 if (i_min > height) { // underflow
443 i_min = 0;
444 }
445 if (i_max > height) {
446 i_max = height;
447 }
448 if (j_min > width) { // underflow
449 j_min = 0;
450 }
451 if (j_max > width) {
452 j_max = width;
453 }
454
455 for (int i = i_min; i < i_max; i++) {
456 double i_d = (double)i;
457
458 for (int j = j_min; j < j_max; j++) {
459 double j_d = (double)j;
460
461#if defined(VISP_HAVE_CLIPPER)
462 imPt.set_ij(i_d, j_d);
463 if (polygon_test.isInside(imPt)) {
464 mask.ptr<uchar>(i)[j] = nb;
465 }
466#else
467 if (shiftBorder != 0) {
468 if (vpPolygon::isInside(roi, i_d, j_d) &&
469 vpPolygon::isInside(roi, i_d + shiftBorder_d, j_d + shiftBorder_d) &&
470 vpPolygon::isInside(roi, i_d - shiftBorder_d, j_d + shiftBorder_d) &&
471 vpPolygon::isInside(roi, i_d + shiftBorder_d, j_d - shiftBorder_d) &&
472 vpPolygon::isInside(roi, i_d - shiftBorder_d, j_d - shiftBorder_d)) {
473 mask.at<unsigned char>(i, j) = nb;
474 }
475 } else {
476 if (vpPolygon::isInside(roi, i, j)) {
477 mask.at<unsigned char>(i, j) = nb;
478 }
479 }
480#endif
481 }
482 }
483 }
484 }
485}
486
493{
494 std::map<int, vpImagePoint>::const_iterator iter = curPoints.begin();
495 for (; iter != curPoints.end(); ++iter) {
496 int id(iter->first);
497 vpImagePoint iP;
498 iP.set_i(static_cast<double>(iter->second.get_i()));
499 iP.set_j(static_cast<double>(iter->second.get_j()));
500
502
503 iP.set_i(vpMath::round(iP.get_i() + 7));
504 iP.set_j(vpMath::round(iP.get_j() + 7));
505 std::stringstream ss;
506 ss << id;
507 vpDisplay::displayText(_I, iP, ss.str(), vpColor::red);
508 }
509}
510
517{
518 std::map<int, vpImagePoint>::const_iterator iter = curPoints.begin();
519 for (; iter != curPoints.end(); ++iter) {
520 int id(iter->first);
521 vpImagePoint iP;
522 iP.set_i(static_cast<double>(iter->second.get_i()));
523 iP.set_j(static_cast<double>(iter->second.get_j()));
524
526
527 iP.set_i(vpMath::round(iP.get_i() + 7));
528 iP.set_j(vpMath::round(iP.get_j() + 7));
529 std::stringstream ss;
530 ss << id;
531 vpDisplay::displayText(_I, iP, ss.str(), vpColor::red);
532 }
533}
534
536 const vpCameraParameters &camera, const vpColor &col, unsigned int thickness,
537 const bool /*displayFullModel*/)
538{
539 std::vector<std::vector<double> > models = getModelForDisplay(cMo, camera);
540
541 for (size_t i = 0; i < models.size(); i++) {
542 vpImagePoint ip1(models[i][1], models[i][2]);
543 vpImagePoint ip2(models[i][3], models[i][4]);
544 vpDisplay::displayLine(I, ip1, ip2, col, thickness);
545 }
546}
547
549 const vpCameraParameters &camera, const vpColor &col, unsigned int thickness,
550 const bool /*displayFullModel*/)
551{
552 std::vector<std::vector<double> > models = getModelForDisplay(cMo, camera);
553
554 for (size_t i = 0; i < models.size(); i++) {
555 vpImagePoint ip1(models[i][1], models[i][2]);
556 vpImagePoint ip2(models[i][3], models[i][4]);
557
558 vpDisplay::displayLine(I, ip1, ip2, col, thickness);
559 }
560}
561
567std::vector<std::vector<double> > vpMbtDistanceKltCylinder::getFeaturesForDisplay()
568{
569 std::vector<std::vector<double> > features;
570
571 std::map<int, vpImagePoint>::const_iterator iter = curPoints.begin();
572 for (; iter != curPoints.end(); ++iter) {
573 int id(iter->first);
574 vpImagePoint iP;
575 iP.set_i(static_cast<double>(iter->second.get_i()));
576 iP.set_j(static_cast<double>(iter->second.get_j()));
577
578 vpImagePoint iP2;
579 iP2.set_i(vpMath::round(iP.get_i() + 7));
580 iP2.set_j(vpMath::round(iP.get_j() + 7));
581
582#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
583 std::vector<double> params = {1, // KLT
584 iP.get_i(), iP.get_j(), iP2.get_i(), iP2.get_j(), static_cast<double>(id)};
585#else
586 std::vector<double> params;
587 params.push_back(1); // KLT
588 params.push_back(iP.get_i());
589 params.push_back(iP.get_j());
590 params.push_back(iP2.get_i());
591 params.push_back(iP2.get_j());
592 params.push_back(static_cast<double>(id));
593#endif
594 features.push_back(params);
595 }
596
597 return features;
598}
599
608std::vector<std::vector<double> > vpMbtDistanceKltCylinder::getModelForDisplay(const vpHomogeneousMatrix &cMo,
609 const vpCameraParameters &camera)
610{
611 std::vector<std::vector<double> > models;
612
613 // if(isvisible || displayFullModel)
614 {
615 // Perspective projection
616 circle1.changeFrame(cMo);
617 circle2.changeFrame(cMo);
618 cylinder.changeFrame(cMo);
619
620 try {
621 circle1.projection();
622 } catch (...) {
623 std::cout << "Problem projection circle 1";
624 }
625 try {
626 circle2.projection();
627 } catch (...) {
628 std::cout << "Problem projection circle 2";
629 }
630
631 cylinder.projection();
632
633 double rho1, theta1;
634 double rho2, theta2;
635
636 // Meters to pixels conversion
637 vpMeterPixelConversion::convertLine(camera, cylinder.getRho1(), cylinder.getTheta1(), rho1, theta1);
638 vpMeterPixelConversion::convertLine(camera, cylinder.getRho2(), cylinder.getTheta2(), rho2, theta2);
639
640 // Determine intersections between circles and limbos
641 double i11, i12, i21, i22, j11, j12, j21, j22;
642
643 vpCircle::computeIntersectionPoint(circle1, camera, rho1, theta1, i11, j11);
644 vpCircle::computeIntersectionPoint(circle2, camera, rho1, theta1, i12, j12);
645
646 vpCircle::computeIntersectionPoint(circle1, camera, rho2, theta2, i21, j21);
647 vpCircle::computeIntersectionPoint(circle2, camera, rho2, theta2, i22, j22);
648
649 // Create the image points
650 vpImagePoint ip11, ip12, ip21, ip22;
651 ip11.set_ij(i11, j11);
652 ip12.set_ij(i12, j12);
653 ip21.set_ij(i21, j21);
654 ip22.set_ij(i22, j22);
655
656#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
657 std::vector<double> params1 = {0, // line parameters
658 ip11.get_i(), ip11.get_j(), ip12.get_i(), ip12.get_j()};
659 models.push_back(params1);
660
661 std::vector<double> params2 = {0, // line parameters
662 ip21.get_i(), ip21.get_j(), ip22.get_i(), ip22.get_j()};
663#else
664 std::vector<double> params1, params2;
665 params1.push_back(0); // line parameters
666 params1.push_back(ip11.get_i());
667 params1.push_back(ip11.get_j());
668 params1.push_back(ip12.get_i());
669 params1.push_back(ip12.get_j());
670
671 params2.push_back(0); // line parameters
672 params2.push_back(ip21.get_i());
673 params2.push_back(ip21.get_j());
674 params2.push_back(ip22.get_i());
675 params2.push_back(ip22.get_j());
676#endif
677 models.push_back(params1);
678 models.push_back(params2);
679 }
680
681 return models;
682}
683
684// ######################
685// Private Functions
686// ######################
687
688double vpMbtDistanceKltCylinder::computeZ(const double &x, const double &y)
689{
690 // double A = x*x + y*y + 1 -
691 // ((cylinder.getA()*x+cylinder.getB()*y+cylinder.getC()) *
692 // (cylinder.getA()*x+cylinder.getB()*y+cylinder.getC())); double B = (x *
693 // cylinder.getX() + y * cylinder.getY() + cylinder.getZ()); double C =
694 // cylinder.getX() * cylinder.getX() + cylinder.getY() * cylinder.getY() +
695 // cylinder.getZ() * cylinder.getZ() - cylinder.getR() * cylinder.getR();
696 //
697 // return (B - std::sqrt(B*B - A*C))/A;
698
699 return cylinder.computeZ(x, y);
700}
701#elif !defined(VISP_BUILD_SHARED_LIBS)
702// Work around to avoid warning:
703// libvisp_mbt.a(vpMbtDistanceKltCylinder.cpp.o) has no symbols
704void dummy_vpMbtDistanceKltCylinder(){};
705#endif
Generic class defining intrinsic camera parameters.
void changeFrame(const vpHomogeneousMatrix &noMo, vpColVector &noP) const
Definition vpCircle.cpp:246
void setWorldCoordinates(const vpColVector &oP)
Definition vpCircle.cpp:57
void projection()
Definition vpCircle.cpp:137
static void computeIntersectionPoint(const vpCircle &circle, const vpCameraParameters &cam, const double &rho, const double &theta, double &i, double &j)
Definition vpCircle.cpp:396
Implementation of column vector and the associated operations.
Class to define RGB colors available for display functionalities.
Definition vpColor.h:152
static const vpColor red
Definition vpColor.h:211
double getRho1() const
Definition vpCylinder.h:131
void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP) const
void projection()
double getTheta1() const
Definition vpCylinder.h:137
double computeZ(double x, double y) const
double getTheta2() const
Definition vpCylinder.h:150
double getRho2() const
Definition vpCylinder.h:144
void setWorldCoordinates(const vpColVector &oP)
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 displayCross(const vpImage< unsigned char > &I, const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
Implementation of an homogeneous matrix and operations on such kind of matrices.
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
void set_j(double jj)
double get_j() const
void set_ij(double ii, double jj)
void set_i(double ii)
double get_i() const
Definition of the vpImage class member functions.
Definition vpImage.h:135
Wrapper for the KLT (Kanade-Lucas-Tomasi) feature tracker implemented in OpenCV. Thus to enable this ...
Definition vpKltOpencv.h:73
int getNbFeatures() const
Get the number of current features.
void getFeature(const int &index, long &id, float &x, float &y) const
static bool isNaN(double value)
Definition vpMath.cpp:93
static int round(double x)
Definition vpMath.h:323
Implementation of a matrix and operations on matrices.
Definition vpMatrix.h:152
std::vector< PolygonType * > & getPolygon()
vpMbScanLine & getMbScanLineRenderer()
void buildFrom(const vpPoint &p1, const vpPoint &p2, const double &r)
void removeOutliers(const vpColVector &weight, const double &threshold_outlier)
unsigned int computeNbDetectedCurrent(const vpKltOpencv &_tracker)
std::vector< std::vector< double > > getFeaturesForDisplay()
void computeInteractionMatrixAndResidu(const vpHomogeneousMatrix &cMc0, vpColVector &_R, vpMatrix &_J)
bool useScanLine
Use scanline rendering.
void updateMask(cv::Mat &mask, unsigned char _nb=255, unsigned int _shiftBorder=0)
void init(const vpKltOpencv &_tracker, const vpHomogeneousMatrix &cMo)
std::vector< std::vector< double > > getModelForDisplay(const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam)
void displayPrimitive(const vpImage< unsigned char > &_I)
std::vector< int > listIndicesCylinderBBox
Pointer to the polygon that define a face.
void display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, unsigned int thickness=1, bool displayFullModel=false)
vpMbHiddenFaces< vpMbtPolygon > * hiddenface
Pointer to the list of faces.
static void convertLine(const vpCameraParameters &cam, const double &rho_m, const double &theta_m, double &rho_p, double &theta_p)
static void convertPoint(const vpCameraParameters &cam, const double &u, const double &v, double &x, double &y)
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Definition vpPoint.h:77
double get_oX() const
Get the point oX coordinate in the object frame.
Definition vpPoint.cpp:458
double get_y() const
Get the point y coordinate in the image plane.
Definition vpPoint.cpp:469
double get_oZ() const
Get the point oZ coordinate in the object frame.
Definition vpPoint.cpp:462
double get_x() const
Get the point x coordinate in the image plane.
Definition vpPoint.cpp:467
double get_oY() const
Get the point oY coordinate in the object frame.
Definition vpPoint.cpp:460
void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP) const
Definition vpPoint.cpp:236
void setWorldCoordinates(double oX, double oY, double oZ)
Definition vpPoint.cpp:110
static void getMinMaxRoi(const std::vector< vpImagePoint > &roi, int &i_min, int &i_max, int &j_min, int &j_max)
Defines a generic 2D polygon.
Definition vpPolygon.h:97
double getArea() const
Definition vpPolygon.h:155
void buildFrom(const std::vector< vpImagePoint > &corners, const bool create_convex_hull=false)
bool isInside(const vpImagePoint &iP, const PointInPolygonMethod &method=PnPolyRayCasting) const