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