Visual Servoing Platform  version 3.1.0
vpMbtDistanceKltPoints.cpp
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2017 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 http://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 polygon, containing points of interest.
33  *
34  * Authors:
35  * Romain Tallonneau
36  * Aurelien Yol
37  *
38  *****************************************************************************/
39 
40 #include <visp3/core/vpPolygon.h>
41 #include <visp3/mbt/vpMbtDistanceKltPoints.h>
42 
43 #if defined(VISP_HAVE_MODULE_KLT) && (defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100))
44 
45 #if defined(VISP_HAVE_CLIPPER)
46 #include <clipper.hpp> // clipper private library
47 #endif
48 
49 #if defined(__APPLE__) && defined(__MACH__) // Apple OSX and iOS (Darwin)
50 #include <TargetConditionals.h> // To detect OSX or IOS using TARGET_OS_IPHONE or TARGET_OS_IOS macro
51 #endif
52 
58  : H(), N(), N_cur(), invd0(1.), cRc0_0n(), initPoints(std::map<int, vpImagePoint>()),
59  curPoints(std::map<int, vpImagePoint>()), curPointsInd(std::map<int, int>()), nbPointsCur(0), nbPointsInit(0),
60  minNbPoint(4), enoughPoints(false), dt(1.), d0(1.), cam(), isTrackedKltPoints(true), polygon(NULL),
61  hiddenface(NULL), useScanLine(false)
62 {
63 }
64 
70 
79 {
80  // extract ids of the points in the face
81  nbPointsInit = 0;
82  nbPointsCur = 0;
83  initPoints = std::map<int, vpImagePoint>();
84  curPoints = std::map<int, vpImagePoint>();
85  curPointsInd = std::map<int, int>();
86  std::vector<vpImagePoint> roi;
87  polygon->getRoiClipped(cam, roi);
88 
89  for (unsigned int i = 0; i < static_cast<unsigned int>(_tracker.getNbFeatures()); i++) {
90  long id;
91  float x_tmp, y_tmp;
92  _tracker.getFeature((int)i, id, x_tmp, y_tmp);
93 
94  bool add = false;
95 
96  if (useScanLine) {
97  if ((unsigned int)y_tmp < hiddenface->getMbScanLineRenderer().getPrimitiveIDs().getHeight() &&
98  (unsigned int)x_tmp < hiddenface->getMbScanLineRenderer().getPrimitiveIDs().getWidth() &&
99  hiddenface->getMbScanLineRenderer().getPrimitiveIDs()[(unsigned int)y_tmp][(unsigned int)x_tmp] ==
100  polygon->getIndex())
101  add = true;
102  } else if (vpPolygon::isInside(roi, y_tmp, x_tmp)) {
103  add = true;
104  }
105 
106  if (add) {
107 #if TARGET_OS_IPHONE
108  initPoints[(int)id] = vpImagePoint(y_tmp, x_tmp);
109  curPoints[(int)id] = vpImagePoint(y_tmp, x_tmp);
110  curPointsInd[(int)id] = (int)i;
111 #else
112  initPoints[id] = vpImagePoint(y_tmp, x_tmp);
113  curPoints[id] = vpImagePoint(y_tmp, x_tmp);
114  curPointsInd[id] = (int)i;
115 #endif
116  }
117  }
118 
119  nbPointsInit = (unsigned int)initPoints.size();
120  nbPointsCur = (unsigned int)curPoints.size();
121 
122  if (nbPointsCur >= minNbPoint)
123  enoughPoints = true;
124  else
125  enoughPoints = false;
126 
127  // initialisation of the value for the computation in SE3
129 
130  d0 = plan.getD();
131  N = plan.getNormal();
132 
133  N.normalize();
134  N_cur = N;
135  invd0 = 1.0 / d0;
136 }
137 
147 {
148  long id;
149  float x, y;
150  nbPointsCur = 0;
151  curPoints = std::map<int, vpImagePoint>();
152  curPointsInd = std::map<int, int>();
153 
154  for (unsigned int i = 0; i < static_cast<unsigned int>(_tracker.getNbFeatures()); i++) {
155  _tracker.getFeature((int)i, id, x, y);
156  if (isTrackedFeature((int)id)) {
157 #if TARGET_OS_IPHONE
158  curPoints[(int)id] = vpImagePoint(static_cast<double>(y), static_cast<double>(x));
159  curPointsInd[(int)id] = (int)i;
160 #else
161  curPoints[id] = vpImagePoint(static_cast<double>(y), static_cast<double>(x));
162  curPointsInd[id] = (int)i;
163 #endif
164  }
165  }
166 
167  nbPointsCur = (unsigned int)curPoints.size();
168 
169  if (nbPointsCur >= minNbPoint)
170  enoughPoints = true;
171  else
172  enoughPoints = false;
173 
174  return nbPointsCur;
175 }
176 
188 {
189  unsigned int index_ = 0;
190 
191  std::map<int, vpImagePoint>::const_iterator iter = curPoints.begin();
192  for (; iter != curPoints.end(); ++iter) {
193  int id(iter->first);
194  double i_cur(iter->second.get_i()), j_cur(iter->second.get_j());
195 
196  double x_cur(0), y_cur(0);
197  vpPixelMeterConversion::convertPoint(cam, j_cur, i_cur, x_cur, y_cur);
198 
199  vpImagePoint iP0 = initPoints[id];
200  double x0(0), y0(0);
201  vpPixelMeterConversion::convertPoint(cam, iP0, x0, y0);
202 
203  double x0_transform,
204  y0_transform; // equivalent x and y in the first image (reference)
205  computeP_mu_t(x0, y0, x0_transform, y0_transform, H);
206 
207  double invZ = compute_1_over_Z(x_cur, y_cur);
208 
209  _J[2 * index_][0] = -invZ;
210  _J[2 * index_][1] = 0;
211  _J[2 * index_][2] = x_cur * invZ;
212  _J[2 * index_][3] = x_cur * y_cur;
213  _J[2 * index_][4] = -(1 + x_cur * x_cur);
214  _J[2 * index_][5] = y_cur;
215 
216  _J[2 * index_ + 1][0] = 0;
217  _J[2 * index_ + 1][1] = -invZ;
218  _J[2 * index_ + 1][2] = y_cur * invZ;
219  _J[2 * index_ + 1][3] = (1 + y_cur * y_cur);
220  _J[2 * index_ + 1][4] = -y_cur * x_cur;
221  _J[2 * index_ + 1][5] = -x_cur;
222 
223  _R[2 * index_] = (x0_transform - x_cur);
224  _R[2 * index_ + 1] = (y0_transform - y_cur);
225  index_++;
226  }
227 }
228 
229 double vpMbtDistanceKltPoints::compute_1_over_Z(const double x, const double y)
230 {
231  double num = cRc0_0n[0] * x + cRc0_0n[1] * y + cRc0_0n[2];
232  double den = -(d0 - dt);
233  return num / den;
234 }
235 
248 inline void vpMbtDistanceKltPoints::computeP_mu_t(const double x_in, const double y_in, double &x_out, double &y_out,
249  const vpMatrix &_cHc0)
250 {
251  double p_mu_t_2 = x_in * _cHc0[2][0] + y_in * _cHc0[2][1] + _cHc0[2][2];
252 
253  if (fabs(p_mu_t_2) < std::numeric_limits<double>::epsilon()) {
254  x_out = 0.0;
255  y_out = 0.0;
256  throw vpException(vpException::divideByZeroError, "the depth of the point is calculated to zero");
257  }
258 
259  x_out = (x_in * _cHc0[0][0] + y_in * _cHc0[0][1] + _cHc0[0][2]) / p_mu_t_2;
260  y_out = (x_in * _cHc0[1][0] + y_in * _cHc0[1][1] + _cHc0[1][2]) / p_mu_t_2;
261 }
262 
277 {
278  vpRotationMatrix cRc0;
279  vpTranslationVector ctransc0;
280 
281  _cTc0.extract(cRc0);
282  _cTc0.extract(ctransc0);
283  vpMatrix cHc0 = _cHc0.convert();
284 
285  // vpGEMM(cRc0, 1.0, invd0, cRc0, -1.0, _cHc0, VP_GEMM_A_T);
286  vpGEMM(ctransc0, N, -invd0, cRc0, 1.0, cHc0, VP_GEMM_B_T);
287  cHc0 /= cHc0[2][2];
288 
289  H = cHc0;
290 
291  // vpQuaternionVector NQuat(N[0], N[1], N[2], 0.0);
292  // vpQuaternionVector RotQuat(cRc0);
293  // vpQuaternionVector RotQuatConj(-RotQuat.x(), -RotQuat.y(),
294  // -RotQuat.z(), RotQuat.w()); vpQuaternionVector partial = RotQuat *
295  // NQuat; vpQuaternionVector resQuat = (partial * RotQuatConj);
296  //
297  // cRc0_0n = vpColVector(3);
298  // cRc0_0n[0] = resQuat.x();
299  // cRc0_0n[1] = resQuat.y();
300  // cRc0_0n[2] = resQuat.z();
301 
302  cRc0_0n = cRc0 * N;
303 
304  // vpPlane p(corners[0], corners[1], corners[2]);
305  // vpColVector Ncur = p.getNormal();
306  // Ncur.normalize();
307  N_cur = cRc0_0n;
308  dt = 0.0;
309  for (unsigned int i = 0; i < 3; i += 1) {
310  dt += ctransc0[i] * (N_cur[i]);
311  }
312 }
313 
321 bool vpMbtDistanceKltPoints::isTrackedFeature(const int _id)
322 {
323  // std::map<int, vpImagePoint>::const_iterator iter = initPoints.begin();
324  // while(iter != initPoints.end()){
325  // if(iter->first == _id){
326  // return true;
327  // }
328  // iter++;
329  // }
330 
331  std::map<int, vpImagePoint>::iterator iter = initPoints.find(_id);
332  if (iter != initPoints.end())
333  return true;
334 
335  return false;
336 }
337 
348 #if (VISP_HAVE_OPENCV_VERSION >= 0x020408)
349  cv::Mat &mask,
350 #else
351  IplImage *mask,
352 #endif
353  unsigned char nb, unsigned int shiftBorder)
354 {
355 #if (VISP_HAVE_OPENCV_VERSION >= 0x020408)
356  int width = mask.cols;
357  int height = mask.rows;
358 #else
359  int width = mask->width;
360  int height = mask->height;
361 #endif
362 
363  int i_min, i_max, j_min, j_max;
364  std::vector<vpImagePoint> roi;
365  polygon->getRoiClipped(cam, roi);
366 
367  double shiftBorder_d = (double)shiftBorder;
368 
369 #if defined(VISP_HAVE_CLIPPER)
370  std::vector<vpImagePoint> roi_offset;
371 
372  ClipperLib::Path path;
373  for (std::vector<vpImagePoint>::const_iterator it = roi.begin(); it != roi.end(); ++it) {
374  path.push_back(ClipperLib::IntPoint((ClipperLib::cInt)it->get_u(), (ClipperLib::cInt)it->get_v()));
375  }
376 
377  ClipperLib::Paths solution;
378  ClipperLib::ClipperOffset co;
379  co.AddPath(path, ClipperLib::jtRound, ClipperLib::etClosedPolygon);
380  co.Execute(solution, -shiftBorder_d);
381 
382  // Keep biggest polygon by area
383  if (!solution.empty()) {
384  size_t index_max = 0;
385 
386  if (solution.size() > 1) {
387  double max_area = 0;
388  vpPolygon polygon_area;
389 
390  for (size_t i = 0; i < solution.size(); i++) {
391  std::vector<vpImagePoint> corners;
392 
393  for (size_t j = 0; j < solution[i].size(); j++) {
394  corners.push_back(vpImagePoint((double)(solution[i][j].Y), (double)(solution[i][j].X)));
395  }
396 
397  polygon_area.buildFrom(corners);
398  if (polygon_area.getArea() > max_area) {
399  max_area = polygon_area.getArea();
400  index_max = i;
401  }
402  }
403  }
404 
405  for (size_t i = 0; i < solution[index_max].size(); i++) {
406  roi_offset.push_back(vpImagePoint((double)(solution[index_max][i].Y), (double)(solution[index_max][i].X)));
407  }
408  } else {
409  roi_offset = roi;
410  }
411 
412  vpPolygon polygon_test(roi_offset);
413  vpImagePoint imPt;
414 #endif
415 
416 #if defined(VISP_HAVE_CLIPPER)
417  vpPolygon3D::getMinMaxRoi(roi_offset, i_min, i_max, j_min, j_max);
418 #else
419  vpPolygon3D::getMinMaxRoi(roi, i_min, i_max, j_min, j_max);
420 #endif
421 
422  /* check image boundaries */
423  if (i_min > height) { // underflow
424  i_min = 0;
425  }
426  if (i_max > height) {
427  i_max = height;
428  }
429  if (j_min > width) { // underflow
430  j_min = 0;
431  }
432  if (j_max > width) {
433  j_max = width;
434  }
435 
436 #if (VISP_HAVE_OPENCV_VERSION >= 0x020408)
437  for (int i = i_min; i < i_max; i++) {
438  double i_d = (double)i;
439 
440  for (int j = j_min; j < j_max; j++) {
441  double j_d = (double)j;
442 
443 #if defined(VISP_HAVE_CLIPPER)
444  imPt.set_ij(i_d, j_d);
445  if (polygon_test.isInside(imPt)) {
446  mask.ptr<uchar>(i)[j] = nb;
447  }
448 #else
449  if (shiftBorder != 0) {
450  if (vpPolygon::isInside(roi, i_d, j_d) && vpPolygon::isInside(roi, i_d + shiftBorder_d, j_d + shiftBorder_d) &&
451  vpPolygon::isInside(roi, i_d - shiftBorder_d, j_d + shiftBorder_d) &&
452  vpPolygon::isInside(roi, i_d + shiftBorder_d, j_d - shiftBorder_d) &&
453  vpPolygon::isInside(roi, i_d - shiftBorder_d, j_d - shiftBorder_d)) {
454  mask.at<unsigned char>(i, j) = nb;
455  }
456  } else {
457  if (vpPolygon::isInside(roi, i, j)) {
458  mask.at<unsigned char>(i, j) = nb;
459  }
460  }
461 #endif
462  }
463  }
464 #else
465  unsigned char *ptrData = (unsigned char *)mask->imageData + i_min * mask->widthStep + j_min;
466  for (int i = i_min; i < i_max; i++) {
467  double i_d = (double)i;
468  for (int j = j_min; j < j_max; j++) {
469  double j_d = (double)j;
470  if (shiftBorder != 0) {
471  if (vpPolygon::isInside(roi, i_d, j_d) && 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  *(ptrData++) = nb;
476  } else {
477  ptrData++;
478  }
479  } else {
480  if (vpPolygon::isInside(roi, i, j)) {
481  *(ptrData++) = nb;
482  } else {
483  ptrData++;
484  }
485  }
486  }
487  ptrData += mask->widthStep - j_max + j_min;
488  }
489 #endif
490 }
491 
500 void vpMbtDistanceKltPoints::removeOutliers(const vpColVector &_w, const double &threshold_outlier)
501 {
502  std::map<int, vpImagePoint> tmp;
503  std::map<int, int> tmp2;
504  unsigned int nbSupp = 0;
505  unsigned int k = 0;
506 
507  nbPointsCur = 0;
508  std::map<int, vpImagePoint>::const_iterator iter = curPoints.begin();
509  for (; iter != curPoints.end(); ++iter) {
510  if (_w[k] > threshold_outlier && _w[k + 1] > threshold_outlier) {
511  // if(_w[k] > threshold_outlier || _w[k+1] > threshold_outlier){
512  tmp[iter->first] = vpImagePoint(iter->second.get_i(), iter->second.get_j());
513  tmp2[iter->first] = curPointsInd[iter->first];
514  nbPointsCur++;
515  } else {
516  nbSupp++;
517  initPoints.erase(iter->first);
518  }
519 
520  k += 2;
521  }
522 
523  if (nbSupp != 0) {
524  curPoints = tmp;
525  curPointsInd = tmp2;
526  if (nbPointsCur >= minNbPoint)
527  enoughPoints = true;
528  else
529  enoughPoints = false;
530  }
531 }
532 
539 {
540  std::map<int, vpImagePoint>::const_iterator iter = curPoints.begin();
541  for (; iter != curPoints.end(); ++iter) {
542  int id(iter->first);
543  vpImagePoint iP;
544  iP.set_i(static_cast<double>(iter->second.get_i()));
545  iP.set_j(static_cast<double>(iter->second.get_j()));
546 
548 
549  iP.set_i(vpMath::round(iP.get_i() + 7));
550  iP.set_j(vpMath::round(iP.get_j() + 7));
551  std::stringstream ss;
552  ss << id;
553  vpDisplay::displayText(_I, iP, ss.str(), vpColor::red);
554  }
555 }
556 
563 {
564  std::map<int, vpImagePoint>::const_iterator iter = curPoints.begin();
565  for (; iter != curPoints.end(); ++iter) {
566  int id(iter->first);
567  vpImagePoint iP;
568  iP.set_i(static_cast<double>(iter->second.get_i()));
569  iP.set_j(static_cast<double>(iter->second.get_j()));
570 
572 
573  iP.set_i(vpMath::round(iP.get_i() + 7));
574  iP.set_j(vpMath::round(iP.get_j() + 7));
575  std::stringstream ss;
576  ss << id;
577  vpDisplay::displayText(_I, iP, ss.str(), vpColor::red);
578  }
579 }
580 
582  const vpCameraParameters &camera, const vpColor &col, const unsigned int thickness,
583  const bool displayFullModel)
584 {
585  if ((polygon->isVisible() && isTrackedKltPoints) || displayFullModel) {
586  std::vector<std::pair<vpPoint, unsigned int> > roi;
588 
589  for (unsigned int j = 0; j < roi.size(); j += 1) {
590  if (((roi[(j + 1) % roi.size()].second & roi[j].second & vpPolygon3D::NEAR_CLIPPING) == 0) &&
591  ((roi[(j + 1) % roi.size()].second & roi[j].second & vpPolygon3D::FAR_CLIPPING) == 0) &&
592  ((roi[(j + 1) % roi.size()].second & roi[j].second & vpPolygon3D::DOWN_CLIPPING) == 0) &&
593  ((roi[(j + 1) % roi.size()].second & roi[j].second & vpPolygon3D::UP_CLIPPING) == 0) &&
594  ((roi[(j + 1) % roi.size()].second & roi[j].second & vpPolygon3D::LEFT_CLIPPING) == 0) &&
595  ((roi[(j + 1) % roi.size()].second & roi[j].second & vpPolygon3D::RIGHT_CLIPPING) == 0)) {
596 
597  vpImagePoint ip1, ip2;
598  std::vector<std::pair<vpPoint, vpPoint> > linesLst;
599 
600  if (useScanLine && !displayFullModel)
601  hiddenface->computeScanLineQuery(roi[j].first, roi[(j + 1) % roi.size()].first, linesLst, true);
602  else
603  linesLst.push_back(std::make_pair(roi[j].first, roi[(j + 1) % roi.size()].first));
604 
605  for (unsigned int i = 0; i < linesLst.size(); i++) {
606  linesLst[i].first.project();
607  linesLst[i].second.project();
608  vpMeterPixelConversion::convertPoint(camera, linesLst[i].first.get_x(), linesLst[i].first.get_y(), ip1);
609  vpMeterPixelConversion::convertPoint(camera, linesLst[i].second.get_x(), linesLst[i].second.get_y(), ip2);
610 
611  vpDisplay::displayLine(I, ip1, ip2, col, thickness);
612  }
613  }
614  }
615  }
616 }
617 
619  const vpCameraParameters &camera, const vpColor &col, const unsigned int thickness,
620  const bool displayFullModel)
621 {
622  if ((polygon->isVisible() && isTrackedKltPoints) || displayFullModel) {
623  std::vector<std::pair<vpPoint, unsigned int> > roi;
625 
626  for (unsigned int j = 0; j < roi.size(); j += 1) {
627  if (((roi[(j + 1) % roi.size()].second & roi[j].second & vpPolygon3D::NEAR_CLIPPING) == 0) &&
628  ((roi[(j + 1) % roi.size()].second & roi[j].second & vpPolygon3D::FAR_CLIPPING) == 0) &&
629  ((roi[(j + 1) % roi.size()].second & roi[j].second & vpPolygon3D::DOWN_CLIPPING) == 0) &&
630  ((roi[(j + 1) % roi.size()].second & roi[j].second & vpPolygon3D::UP_CLIPPING) == 0) &&
631  ((roi[(j + 1) % roi.size()].second & roi[j].second & vpPolygon3D::LEFT_CLIPPING) == 0) &&
632  ((roi[(j + 1) % roi.size()].second & roi[j].second & vpPolygon3D::RIGHT_CLIPPING) == 0)) {
633 
634  vpImagePoint ip1, ip2;
635  std::vector<std::pair<vpPoint, vpPoint> > linesLst;
636 
637  if (useScanLine && !displayFullModel)
638  hiddenface->computeScanLineQuery(roi[j].first, roi[(j + 1) % roi.size()].first, linesLst, true);
639  else
640  linesLst.push_back(std::make_pair(roi[j].first, roi[(j + 1) % roi.size()].first));
641 
642  for (unsigned int i = 0; i < linesLst.size(); i++) {
643  linesLst[i].first.project();
644  linesLst[i].second.project();
645  vpMeterPixelConversion::convertPoint(camera, linesLst[i].first.get_x(), linesLst[i].first.get_y(), ip1);
646  vpMeterPixelConversion::convertPoint(camera, linesLst[i].second.get_x(), linesLst[i].second.get_y(), ip2);
647 
648  vpDisplay::displayLine(I, ip1, ip2, col, thickness);
649  }
650  }
651  }
652  }
653 }
654 
655 #elif !defined(VISP_BUILD_SHARED_LIBS)
656 // Work arround to avoid warning: libvisp_mbt.a(vpMbtDistanceKltPoints.cpp.o)
657 // has no symbols
658 void dummy_vpMbtDistanceKltPoints(){};
659 #endif
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:104
double get_i() const
Definition: vpImagePoint.h:204
void getRoiClipped(const vpCameraParameters &cam, std::vector< vpImagePoint > &roi)
void init(const vpKltOpencv &_tracker)
int getIndex() const
Definition: vpMbtPolygon.h:101
void removeOutliers(const vpColVector &weight, const double &threshold_outlier)
Implementation of an homogeneous matrix and operations on such kind of matrices.
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
Point coordinates conversion from normalized coordinates in meter to pixel coordinates ...
Class to define colors available for display functionnalities.
Definition: vpColor.h:120
vpMbHiddenFaces< vpMbtPolygon > * hiddenface
Pointer to the list of faces.
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
double getArea() const
Definition: vpPolygon.h:161
error that can be emited by ViSP classes.
Definition: vpException.h:71
int getNbFeatures() const
Get the number of current features.
Definition: vpKltOpencv.h:120
vpMbScanLine & getMbScanLineRenderer()
static void convertPoint(const vpCameraParameters &cam, const double &u, const double &v, double &x, double &y)
Point coordinates conversion from pixel coordinates to normalized coordinates in meter...
void extract(vpRotationMatrix &R) const
static int round(const double x)
Definition: vpMath.h:235
static void getMinMaxRoi(const std::vector< vpImagePoint > &roi, int &i_min, int &i_max, int &j_min, int &j_max)
static const vpColor red
Definition: vpColor.h:180
Implementation of a rotation matrix and operations on such kind of matrices.
unsigned int computeNbDetectedCurrent(const vpKltOpencv &_tracker)
Implementation of an homography and operations on homographies.
Definition: vpHomography.h:174
Defines a generic 2D polygon.
Definition: vpPolygon.h:103
void set_i(const double ii)
Definition: vpImagePoint.h:167
vpColVector & normalize()
vpPoint & getPoint(const unsigned int _index)
void displayPrimitive(const vpImage< unsigned char > &_I)
bool isInside(const vpImagePoint &iP, const PointInPolygonMethod &method=PnPolyRayCasting) const
Definition: vpPolygon.cpp:317
double get_j() const
Definition: vpImagePoint.h:215
void getPolygonClipped(std::vector< std::pair< vpPoint, unsigned int > > &poly)
Generic class defining intrinsic camera parameters.
vpMatrix convert() const
virtual bool isVisible(const vpHomogeneousMatrix &cMo, const double alpha, const bool &modulo=false, const vpCameraParameters &cam=vpCameraParameters(), const vpImage< unsigned char > &I=vpImage< unsigned char >())
void computeHomography(const vpHomogeneousMatrix &_cTc0, vpHomography &cHc0)
void set_j(const double jj)
Definition: vpImagePoint.h:178
static void displayCross(const vpImage< unsigned char > &I, const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)
void getFeature(const int &index, long &id, float &x, float &y) const
void computeScanLineQuery(const vpPoint &a, const vpPoint &b, std::vector< std::pair< vpPoint, vpPoint > > &lines, const bool &displayResults=false)
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
Wrapper for the KLT (Kanade-Lucas-Tomasi) feature tracker implemented in OpenCV. Thus to enable this ...
Definition: vpKltOpencv.h:78
vpMbtPolygon * polygon
Pointer to the polygon that define a face.
void display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, const unsigned int thickness=1, const bool displayFullModel=false)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:88
static void displayLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)
This class defines the container for a plane geometrical structure.
Definition: vpPlane.h:58
Class that consider the case of a translation vector.
void computeInteractionMatrixAndResidu(vpColVector &_R, vpMatrix &_J)
void buildFrom(const std::vector< vpImagePoint > &corners)
Definition: vpPolygon.cpp:139
void set_ij(const double ii, const double jj)
Definition: vpImagePoint.h:189
bool useScanLine
Use scanline rendering.
void updateMask(cv::Mat &mask, unsigned char _nb=255, unsigned int _shiftBorder=0)