Visual Servoing Platform  version 3.1.0
vpMbtDistanceCylinder.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  * Make the complete tracking of an object by using its CAD model. Cylinder
33  * tracking.
34  *
35  * Authors:
36  * Nicolas Melchior
37  * Romain Tallonneau
38  * Eric Marchand
39  * Bertrand Delabarre
40  *
41  *****************************************************************************/
42 
43 #include <visp3/core/vpConfig.h>
44 
50 #include <algorithm>
51 #include <stdlib.h>
52 #include <visp3/core/vpMeterPixelConversion.h>
53 #include <visp3/core/vpPixelMeterConversion.h>
54 #include <visp3/core/vpPlane.h>
55 #include <visp3/mbt/vpMbtDistanceCylinder.h>
56 #include <visp3/visual_features/vpFeatureBuilder.h>
57 #include <visp3/visual_features/vpFeatureEllipse.h>
58 
59 #include <visp3/vision/vpPose.h>
60 
65  : name(), index(0), cam(), me(NULL), wmean1(1), wmean2(1), featureline1(), featureline2(), isTrackedCylinder(true),
66  meline1(NULL), meline2(NULL), cercle1(NULL), cercle2(NULL), radius(0), p1(NULL), p2(NULL), L(), error(),
67  nbFeature(0), nbFeaturel1(0), nbFeaturel2(0), Reinit(false), c(NULL), hiddenface(NULL), index_polygon(-1),
68  isvisible(false)
69 {
70 }
71 
76 {
77  // cout << "Deleting cylinder " << index << endl;
78 
79  if (p1 != NULL)
80  delete p1;
81  if (p2 != NULL)
82  delete p2;
83  if (c != NULL)
84  delete c;
85  if (meline1 != NULL)
86  delete meline1;
87  if (meline2 != NULL)
88  delete meline2;
89  if (cercle1 != NULL)
90  delete cercle1;
91  if (cercle2 != NULL)
92  delete cercle2;
93 }
94 
102 void vpMbtDistanceCylinder::project(const vpHomogeneousMatrix &cMo)
103 {
104  c->project(cMo);
105  p1->project(cMo);
106  p2->project(cMo);
107  cercle1->project(cMo);
108  cercle2->project(cMo);
109 }
110 
119 void vpMbtDistanceCylinder::buildFrom(const vpPoint &_p1, const vpPoint &_p2, const double r)
120 {
121  c = new vpCylinder;
122  p1 = new vpPoint;
123  p2 = new vpPoint;
124  cercle1 = new vpCircle;
125  cercle2 = new vpCircle;
126 
127  // Get the points
128  *p1 = _p1;
129  *p2 = _p2;
130 
131  // Get the radius
132  radius = r;
133 
134  vpColVector ABC(3);
135  vpColVector V1(3);
136  vpColVector V2(3);
137 
138  V1[0] = _p1.get_oX();
139  V1[1] = _p1.get_oY();
140  V1[2] = _p1.get_oZ();
141  V2[0] = _p2.get_oX();
142  V2[1] = _p2.get_oY();
143  V2[2] = _p2.get_oZ();
144 
145  // Get the axis of the cylinder
146  ABC = V1 - V2;
147 
148  // Build our extremity circles
149  cercle1->setWorldCoordinates(ABC[0], ABC[1], ABC[2], _p1.get_oX(), _p1.get_oY(), _p1.get_oZ(), r);
150  cercle2->setWorldCoordinates(ABC[0], ABC[1], ABC[2], _p2.get_oX(), _p2.get_oY(), _p2.get_oZ(), r);
151 
152  // Build our cylinder
153  c->setWorldCoordinates(ABC[0], ABC[1], ABC[2], (_p1.get_oX() + _p2.get_oX()) / 2.0,
154  (_p1.get_oY() + _p2.get_oY()) / 2.0, (_p1.get_oZ() + _p2.get_oZ()) / 2.0, r);
155 }
156 
163 {
164  me = _me;
165  if (meline1 != NULL) {
166  meline1->setMe(me);
167  }
168  if (meline2 != NULL) {
169  meline2->setMe(me);
170  }
171 }
172 
183 {
184  if (isvisible) {
185  // Perspective projection
186  p1->changeFrame(cMo);
187  p2->changeFrame(cMo);
188  cercle1->changeFrame(cMo);
189  cercle2->changeFrame(cMo);
190  c->changeFrame(cMo);
191 
192  p1->projection();
193  p2->projection();
194  try {
195  cercle1->projection();
196  } catch (...) {
197  // std::cout<<"Problem when projecting circle 1\n";
198  return false;
199  }
200  try {
201  cercle2->projection();
202  } catch (...) {
203  // std::cout<<"Problem when projecting circle 2\n";
204  return false;
205  }
206  c->projection();
207 
208  double rho1, theta1;
209  double rho2, theta2;
210 
211  // Create the moving edges containers
212  meline1 = new vpMbtMeLine;
213  meline1->setMe(me);
214  meline2 = new vpMbtMeLine;
215  meline2->setMe(me);
216 
217  // meline->setDisplay(vpMeSite::RANGE_RESULT);
218  meline1->setInitRange(0);
219  meline2->setInitRange(0);
220 
221  // Conversion meter to pixels
222  vpMeterPixelConversion::convertLine(cam, c->getRho1(), c->getTheta1(), rho1, theta1);
223  vpMeterPixelConversion::convertLine(cam, c->getRho2(), c->getTheta2(), rho2, theta2);
224 
225  // Determine intersections between circles and limbos
226  double i11, i12, i21, i22, j11, j12, j21, j22;
227  vpCircle::computeIntersectionPoint(*cercle1, cam, rho1, theta1, i11, j11);
228  vpCircle::computeIntersectionPoint(*cercle2, cam, rho1, theta1, i12, j12);
229  vpCircle::computeIntersectionPoint(*cercle1, cam, rho2, theta2, i21, j21);
230  vpCircle::computeIntersectionPoint(*cercle2, cam, rho2, theta2, i22, j22);
231 
232  // Create the image points
233  vpImagePoint ip11, ip12, ip21, ip22;
234  ip11.set_ij(i11, j11);
235  ip12.set_ij(i12, j12);
236  ip21.set_ij(i21, j21);
237  ip22.set_ij(i22, j22);
238 
239  // update limits of the melines.
240  int marge = /*10*/ 5; // ou 5 normalement
241  if (ip11.get_j() < ip12.get_j()) {
242  meline1->jmin = (int)ip11.get_j() - marge;
243  meline1->jmax = (int)ip12.get_j() + marge;
244  } else {
245  meline1->jmin = (int)ip12.get_j() - marge;
246  meline1->jmax = (int)ip11.get_j() + marge;
247  }
248  if (ip11.get_i() < ip12.get_i()) {
249  meline1->imin = (int)ip11.get_i() - marge;
250  meline1->imax = (int)ip12.get_i() + marge;
251  } else {
252  meline1->imin = (int)ip12.get_i() - marge;
253  meline1->imax = (int)ip11.get_i() + marge;
254  }
255 
256  if (ip21.get_j() < ip22.get_j()) {
257  meline2->jmin = (int)ip21.get_j() - marge;
258  meline2->jmax = (int)ip22.get_j() + marge;
259  } else {
260  meline2->jmin = (int)ip22.get_j() - marge;
261  meline2->jmax = (int)ip21.get_j() + marge;
262  }
263  if (ip21.get_i() < ip22.get_i()) {
264  meline2->imin = (int)ip21.get_i() - marge;
265  meline2->imax = (int)ip22.get_i() + marge;
266  } else {
267  meline2->imin = (int)ip22.get_i() - marge;
268  meline2->imax = (int)ip21.get_i() + marge;
269  }
270 
271  // Initialize the tracking
272  while (theta1 > M_PI) {
273  theta1 -= M_PI;
274  }
275  while (theta1 < -M_PI) {
276  theta1 += M_PI;
277  }
278 
279  if (theta1 < -M_PI / 2.0)
280  theta1 = -theta1 - 3 * M_PI / 2.0;
281  else
282  theta1 = M_PI / 2.0 - theta1;
283 
284  while (theta2 > M_PI) {
285  theta2 -= M_PI;
286  }
287  while (theta2 < -M_PI) {
288  theta2 += M_PI;
289  }
290 
291  if (theta2 < -M_PI / 2.0)
292  theta2 = -theta2 - 3 * M_PI / 2.0;
293  else
294  theta2 = M_PI / 2.0 - theta2;
295 
296  try {
297  meline1->initTracking(I, ip11, ip12, rho1, theta1);
298  } catch (...) {
299  // vpTRACE("the line can't be initialized");
300  return false;
301  }
302  try {
303  meline2->initTracking(I, ip21, ip22, rho2, theta2);
304  } catch (...) {
305  // vpTRACE("the line can't be initialized");
306  return false;
307  }
308  }
309  return true;
310 }
311 
319 {
320  if (isvisible) {
321  try {
322  meline1->track(I);
323  } catch (...) {
324  // std::cout << "Track meline1 failed" << std::endl;
325  meline1->reset();
326  Reinit = true;
327  }
328  try {
329  meline2->track(I);
330  } catch (...) {
331  // std::cout << "Track meline2 failed" << std::endl;
332  meline2->reset();
333  Reinit = true;
334  }
335 
336  // Update the number of features
337  nbFeaturel1 = (unsigned int)meline1->getMeList().size();
338  nbFeaturel2 = (unsigned int)meline2->getMeList().size();
340  }
341 }
342 
350 {
351  if (isvisible) {
352  // Perspective projection
353  p1->changeFrame(cMo);
354  p2->changeFrame(cMo);
355  cercle1->changeFrame(cMo);
356  cercle2->changeFrame(cMo);
357  c->changeFrame(cMo);
358 
359  p1->projection();
360  p2->projection();
361  try {
362  cercle1->projection();
363  } catch (...) {
364  std::cout << "Probleme projection cercle 1\n";
365  }
366  try {
367  cercle2->projection();
368  } catch (...) {
369  std::cout << "Probleme projection cercle 2\n";
370  }
371  c->projection();
372 
373  // Get the limbos
374  double rho1, theta1;
375  double rho2, theta2;
376 
377  // Conversion meter to pixels
378  vpMeterPixelConversion::convertLine(cam, c->getRho1(), c->getTheta1(), rho1, theta1);
379  vpMeterPixelConversion::convertLine(cam, c->getRho2(), c->getTheta2(), rho2, theta2);
380 
381  // Determine intersections between circles and limbos
382  double i11, i12, i21, i22, j11, j12, j21, j22;
383 
384  vpCircle::computeIntersectionPoint(*cercle1, cam, rho1, theta1, i11, j11);
385  vpCircle::computeIntersectionPoint(*cercle2, cam, rho1, theta1, i12, j12);
386 
387  vpCircle::computeIntersectionPoint(*cercle1, cam, rho2, theta2, i21, j21);
388  vpCircle::computeIntersectionPoint(*cercle2, cam, rho2, theta2, i22, j22);
389 
390  // Create the image points
391  vpImagePoint ip11, ip12, ip21, ip22;
392  ip11.set_ij(i11, j11);
393  ip12.set_ij(i12, j12);
394  ip21.set_ij(i21, j21);
395  ip22.set_ij(i22, j22);
396 
397  // update limits of the meline.
398  int marge = /*10*/ 5; // ou 5 normalement
399  if (ip11.get_j() < ip12.get_j()) {
400  meline1->jmin = (int)ip11.get_j() - marge;
401  meline1->jmax = (int)ip12.get_j() + marge;
402  } else {
403  meline1->jmin = (int)ip12.get_j() - marge;
404  meline1->jmax = (int)ip11.get_j() + marge;
405  }
406  if (ip11.get_i() < ip12.get_i()) {
407  meline1->imin = (int)ip11.get_i() - marge;
408  meline1->imax = (int)ip12.get_i() + marge;
409  } else {
410  meline1->imin = (int)ip12.get_i() - marge;
411  meline1->imax = (int)ip11.get_i() + marge;
412  }
413 
414  if (ip21.get_j() < ip22.get_j()) {
415  meline2->jmin = (int)ip21.get_j() - marge;
416  meline2->jmax = (int)ip22.get_j() + marge;
417  } else {
418  meline2->jmin = (int)ip22.get_j() - marge;
419  meline2->jmax = (int)ip21.get_j() + marge;
420  }
421  if (ip21.get_i() < ip22.get_i()) {
422  meline2->imin = (int)ip21.get_i() - marge;
423  meline2->imax = (int)ip22.get_i() + marge;
424  } else {
425  meline2->imin = (int)ip22.get_i() - marge;
426  meline2->imax = (int)ip21.get_i() + marge;
427  }
428 
429  // Initialize the tracking
430  while (theta1 > M_PI) {
431  theta1 -= M_PI;
432  }
433  while (theta1 < -M_PI) {
434  theta1 += M_PI;
435  }
436 
437  if (theta1 < -M_PI / 2.0)
438  theta1 = -theta1 - 3 * M_PI / 2.0;
439  else
440  theta1 = M_PI / 2.0 - theta1;
441 
442  while (theta2 > M_PI) {
443  theta2 -= M_PI;
444  }
445  while (theta2 < -M_PI) {
446  theta2 += M_PI;
447  }
448 
449  if (theta2 < -M_PI / 2.0)
450  theta2 = -theta2 - 3 * M_PI / 2.0;
451  else
452  theta2 = M_PI / 2.0 - theta2;
453 
454  try {
455  // meline1->updateParameters(I,rho1,theta1);
456  meline1->updateParameters(I, ip11, ip12, rho1, theta1);
457  } catch (...) {
458  Reinit = true;
459  }
460  try {
461  // meline2->updateParameters(I,rho2,theta2);
462  meline2->updateParameters(I, ip21, ip22, rho2, theta2);
463  } catch (...) {
464  Reinit = true;
465  }
466 
467  // Update the numbers of features
468  nbFeaturel1 = (unsigned int)meline1->getMeList().size();
469  nbFeaturel2 = (unsigned int)meline2->getMeList().size();
471  }
472 }
473 
484 {
485  if (meline1 != NULL)
486  delete meline1;
487  if (meline2 != NULL)
488  delete meline2;
489 
490  meline1 = NULL;
491  meline2 = NULL;
492 
493  if (initMovingEdge(I, cMo) == false)
494  Reinit = true;
495 
496  Reinit = false;
497 }
498 
510  const vpCameraParameters &camera, const vpColor &col, const unsigned int thickness,
511  const bool displayFullModel)
512 {
513  if ((isvisible && isTrackedCylinder) || displayFullModel) {
514  // Perspective projection
515  p1->changeFrame(cMo);
516  p2->changeFrame(cMo);
517  cercle1->changeFrame(cMo);
518  cercle2->changeFrame(cMo);
519  c->changeFrame(cMo);
520 
521  p1->projection();
522  p2->projection();
523  try {
524  cercle1->projection();
525  } catch (...) {
526  std::cout << "Problem projection circle 1";
527  }
528  try {
529  cercle2->projection();
530  } catch (...) {
531  std::cout << "Problem projection circle 2";
532  }
533  c->projection();
534 
535  double rho1, theta1;
536  double rho2, theta2;
537 
538  // Meters to pixels conversion
539  vpMeterPixelConversion::convertLine(camera, c->getRho1(), c->getTheta1(), rho1, theta1);
540  vpMeterPixelConversion::convertLine(camera, c->getRho2(), c->getTheta2(), rho2, theta2);
541 
542  // Determine intersections between circles and limbos
543  double i11, i12, i21, i22, j11, j12, j21, j22;
544 
545  vpCircle::computeIntersectionPoint(*cercle1, cam, rho1, theta1, i11, j11);
546  vpCircle::computeIntersectionPoint(*cercle2, cam, rho1, theta1, i12, j12);
547 
548  vpCircle::computeIntersectionPoint(*cercle1, cam, rho2, theta2, i21, j21);
549  vpCircle::computeIntersectionPoint(*cercle2, cam, rho2, theta2, i22, j22);
550 
551  // Create the image points
552  vpImagePoint ip11, ip12, ip21, ip22;
553  ip11.set_ij(i11, j11);
554  ip12.set_ij(i12, j12);
555  ip21.set_ij(i21, j21);
556  ip22.set_ij(i22, j22);
557 
558  // Display
559  vpDisplay::displayLine(I, ip11, ip12, col, thickness);
560  vpDisplay::displayLine(I, ip21, ip22, col, thickness);
561  }
562 }
563 
575  const vpCameraParameters &camera, const vpColor &col, const unsigned int thickness,
576  const bool displayFullModel)
577 {
578  if ((isvisible && isTrackedCylinder) || displayFullModel) {
579  // Perspective projection
580  p1->changeFrame(cMo);
581  p2->changeFrame(cMo);
582  cercle1->changeFrame(cMo);
583  cercle2->changeFrame(cMo);
584  c->changeFrame(cMo);
585 
586  p1->projection();
587  p2->projection();
588  try {
589  cercle1->projection();
590  } catch (...) {
591  std::cout << "Problem projection circle 1";
592  }
593  try {
594  cercle2->projection();
595  } catch (...) {
596  std::cout << "Problem projection circle 2";
597  }
598  c->projection();
599 
600  double rho1, theta1;
601  double rho2, theta2;
602 
603  // Meters to pixels conversion
604  vpMeterPixelConversion::convertLine(camera, c->getRho1(), c->getTheta1(), rho1, theta1);
605  vpMeterPixelConversion::convertLine(camera, c->getRho2(), c->getTheta2(), rho2, theta2);
606 
607  // Determine intersections between circles and limbos
608  double i11, i12, i21, i22, j11, j12, j21, j22;
609 
610  vpCircle::computeIntersectionPoint(*cercle1, cam, rho1, theta1, i11, j11);
611  vpCircle::computeIntersectionPoint(*cercle2, cam, rho1, theta1, i12, j12);
612 
613  vpCircle::computeIntersectionPoint(*cercle1, cam, rho2, theta2, i21, j21);
614  vpCircle::computeIntersectionPoint(*cercle2, cam, rho2, theta2, i22, j22);
615 
616  // Create the image points
617  vpImagePoint ip11, ip12, ip21, ip22;
618  ip11.set_ij(i11, j11);
619  ip12.set_ij(i12, j12);
620  ip21.set_ij(i21, j21);
621  ip22.set_ij(i22, j22);
622 
623  // Display
624  vpDisplay::displayLine(I, ip11, ip12, col, thickness);
625  vpDisplay::displayLine(I, ip21, ip22, col, thickness);
626  }
627 }
628 
644 {
645  if (meline1 != NULL) {
646  meline1->display(I);
647  }
648  if (meline2 != NULL) {
649  meline2->display(I);
650  }
651 }
652 
657 {
658  if (isvisible) {
659  nbFeaturel1 = (unsigned int)meline1->getMeList().size();
660  nbFeaturel2 = (unsigned int)meline2->getMeList().size();
662  L.resize(nbFeature, 6);
664  } else {
665  nbFeature = 0;
666  nbFeaturel1 = 0;
667  nbFeaturel2 = 0;
668  }
669 }
670 
676  const vpImage<unsigned char> &I)
677 {
678  if (isvisible) {
679  // Perspective projection
680  c->changeFrame(cMo);
681  c->projection();
682  cercle1->changeFrame(cMo);
683  cercle1->changeFrame(cMo);
684  try {
685  cercle1->projection();
686  } catch (...) {
687  std::cout << "Problem projection circle 1\n";
688  }
689  try {
690  cercle2->projection();
691  } catch (...) {
692  std::cout << "Problem projection circle 2\n";
693  }
694 
695  bool disp = false;
696  bool disp2 = false;
697  if (disp || disp2)
698  vpDisplay::flush(I);
699 
700  // Build the lines
703 
704  double rho1 = featureline1.getRho();
705  double theta1 = featureline1.getTheta();
706  double rho2 = featureline2.getRho();
707  double theta2 = featureline2.getTheta();
708 
709  double co1 = cos(theta1);
710  double si1 = sin(theta1);
711  double co2 = cos(theta2);
712  double si2 = sin(theta2);
713 
714  double mx = 1.0 / cam.get_px();
715  double my = 1.0 / cam.get_py();
716  double xc = cam.get_u0();
717  double yc = cam.get_v0();
718 
719  vpMatrix H1;
720  H1 = featureline1.interaction();
721  vpMatrix H2;
722  H2 = featureline2.interaction();
723 
724  vpMeSite p;
725  unsigned int j = 0;
726  for (std::list<vpMeSite>::const_iterator it = meline1->getMeList().begin(); it != meline1->getMeList().end();
727  ++it) {
728  double x = (double)it->j;
729  double y = (double)it->i;
730 
731  x = (x - xc) * mx;
732  y = (y - yc) * my;
733 
734  double alpha1 = x * si1 - y * co1;
735 
736  double *Lrho = H1[0];
737  double *Ltheta = H1[1];
738  // Calculate interaction matrix for a distance
739  for (unsigned int k = 0; k < 6; k++) {
740  L[j][k] = (Lrho[k] + alpha1 * Ltheta[k]);
741  }
742  error[j] = rho1 - (x * co1 + y * si1);
743 
744  if (disp)
745  vpDisplay::displayCross(I, it->i, it->j, (unsigned int)(error[j] * 100), vpColor::orange, 1);
746 
747  j++;
748  }
749 
750  for (std::list<vpMeSite>::const_iterator it = meline2->getMeList().begin(); it != meline2->getMeList().end();
751  ++it) {
752  double x = (double)it->j;
753  double y = (double)it->i;
754 
755  x = (x - xc) * mx;
756  y = (y - yc) * my;
757 
758  double alpha2 = x * si2 - y * co2;
759 
760  double *Lrho = H2[0];
761  double *Ltheta = H2[1];
762  // Calculate interaction matrix for a distance
763  for (unsigned int k = 0; k < 6; k++) {
764  L[j][k] = (Lrho[k] + alpha2 * Ltheta[k]);
765  }
766  error[j] = rho2 - (x * co2 + y * si2);
767 
768  if (disp)
769  vpDisplay::displayCross(I, it->i, it->j, (unsigned int)(error[j] * 100), vpColor::red, 1);
770 
771  j++;
772  }
773  }
774 }
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:104
void displayMovingEdges(const vpImage< unsigned char > &I)
void updateMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
double get_i() const
Definition: vpImagePoint.h:204
vpCylinder * c
The cylinder.
void projection(const vpColVector &_cP, vpColVector &_p)
Definition: vpPoint.cpp:216
double get_oY() const
Get the point Y coordinate in the object frame.
Definition: vpPoint.cpp:422
void trackMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP)
perspective projection of the circle
Definition: vpCircle.cpp:239
bool isvisible
Indicates if the cylinder is visible or not.
Implementation of an homogeneous matrix and operations on such kind of matrices.
Performs search in a given direction(normal) for a given distance(pixels) for a given &#39;site&#39;...
Definition: vpMeSite.h:71
void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true, const bool recopy_=true)
Definition: vpArray2D.h:171
Class to define colors available for display functionnalities.
Definition: vpColor.h:120
double getRho() const
Definition: vpMe.h:60
unsigned int nbFeature
The number of moving edges.
vpPoint * p1
The first extremity on the axe.
static void flush(const vpImage< unsigned char > &I)
double get_oX() const
Get the point X coordinate in the object frame.
Definition: vpPoint.cpp:420
void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP)
Definition: vpCylinder.cpp:272
static const vpColor red
Definition: vpColor.h:180
Class that defines what is a point.
Definition: vpPoint.h:58
vpMatrix L
The interaction matrix.
static const vpColor orange
Definition: vpColor.h:190
unsigned int nbFeaturel1
The number of moving edges on line 1.
double getTheta2() const
Definition: vpCylinder.h:146
void projection()
Definition: vpCircle.cpp:138
vpCircle * cercle2
The lower circle limiting the cylinder.
void reinitMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
static void computeIntersectionPoint(const vpCircle &circle, const vpCameraParameters &cam, const double &rho, const double &theta, double &i, double &j)
Definition: vpCircle.cpp:332
double get_j() const
Definition: vpImagePoint.h:215
Generic class defining intrinsic camera parameters.
double getTheta() const
double get_oZ() const
Get the point Z coordinate in the object frame.
Definition: vpPoint.cpp:424
bool initMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
vpMbtMeLine * meline1
The moving edge containers (first line of the cylinder)
vpMatrix interaction(const unsigned int select=FEATURE_ALL)
void projection()
Definition: vpCylinder.cpp:167
static void convertLine(const vpCameraParameters &cam, const double &rho_m, const double &theta_m, double &rho_p, double &theta_p)
Line coordinates conversion (rho,theta).
vpPoint * p2
The second extremity on the axe.
static void displayCross(const vpImage< unsigned char > &I, const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)
Class that defines what is a cylinder.
Definition: vpCylinder.h:96
int j
Definition: vpMeSite.h:86
void buildFrom(const vpPoint &_p1, const vpPoint &_p2, const double r)
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
double getRho1() const
Definition: vpCylinder.h:127
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)
vpColVector error
The error vector.
vpCircle * cercle1
The upper circle limiting the cylinder.
bool Reinit
Indicates if the line has to be reinitialized.
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:88
double radius
The radius of the cylinder.
static void displayLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)
void setWorldCoordinates(const vpColVector &oP)
Definition: vpCylinder.cpp:71
static void create(vpFeaturePoint &s, const vpCameraParameters &cam, const vpDot &d)
unsigned int nbFeaturel2
The number of moving edges on line 2.
void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &_cP)
Definition: vpPoint.cpp:233
Class that defines what is a circle.
Definition: vpCircle.h:58
double getTheta1() const
Definition: vpCylinder.h:133
vpMbtMeLine * meline2
The moving edge containers (second line of the cylinder)
void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo, const vpImage< unsigned char > &I)
double getRho2() const
Definition: vpCylinder.h:140
void set_ij(const double ii, const double jj)
Definition: vpImagePoint.h:189
void setWorldCoordinates(const vpColVector &oP)
Definition: vpCircle.cpp:61
void resize(const unsigned int i, const bool flagNullify=true)
Definition: vpColVector.h:241