ViSP  2.9.0
vpMbtDistanceCylinder.cpp
1 /****************************************************************************
2  *
3  * $Id: vpMbtDistanceCylinder.cpp 4649 2014-02-07 14:57:11Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2014 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  * Description:
34  * Make the complete tracking of an object by using its CAD model. Cylinder
35  * tracking.
36  *
37  * Authors:
38  * Nicolas Melchior
39  * Romain Tallonneau
40  * Eric Marchand
41  * Bertrand Delabarre
42  *
43  *****************************************************************************/
44 
45 #include <visp/vpConfig.h>
46 
52 #include <visp/vpMbtDistanceCylinder.h>
53 #include <visp/vpPlane.h>
54 #include <visp/vpMeterPixelConversion.h>
55 #include <visp/vpPixelMeterConversion.h>
56 #include <visp/vpFeatureBuilder.h>
57 #include <visp/vpFeatureEllipse.h>
58 #include <stdlib.h>
59 #include <algorithm>
60 
61 #include <visp/vpPose.h>
62 
67  : name(), index(0), cam(), me(NULL), alpha(0), wmean1(1), wmean2(1),
68  featureline1(), featureline2(), meline1(NULL), meline2(NULL),
69  cercle1(NULL), cercle2(NULL), radius(0), p1(NULL), p2(NULL), L(),
70  error(), nbFeature(0), nbFeaturel1(0), nbFeaturel2(0), Reinit(false),
71  c(NULL)
72 {
73 }
74 
79 {
80 // cout << "Deleting cylinder " << index << endl ;
81 
82  if (p1 != NULL) delete p1 ;
83  if (p2 != NULL) delete p2 ;
84  if (c != NULL) delete c ;
85  if (meline1 != NULL) delete meline1 ;
86  if (meline2 != NULL) delete meline2 ;
87  if (cercle1 != NULL) delete cercle1 ;
88  if (cercle2 != NULL) delete cercle2 ;
89 }
90 
96 void
97 vpMbtDistanceCylinder::project(const vpHomogeneousMatrix &cMo)
98 {
99  c->project(cMo) ;
100  p1->project(cMo) ;
101  p2->project(cMo) ;
102  cercle1->project(cMo) ;
103  cercle2->project(cMo) ;
104 }
105 
106 
114 void
115 vpMbtDistanceCylinder::buildFrom(const vpPoint &_p1, const vpPoint &_p2, const double r)
116 {
117  c = new vpCylinder ;
118  p1 = new vpPoint ;
119  p2 = new vpPoint ;
120  cercle1 = new vpCircle;
121  cercle2 = new vpCircle;
122 
123  // Get the points
124  *p1 = _p1;
125  *p2 = _p2;
126 
127  // Get the radius
128  radius = r;
129 
130  vpColVector ABC(3);
131  vpColVector V1(3);
132  vpColVector V2(3);
133 
134  V1[0] = _p1.get_oX();
135  V1[1] = _p1.get_oY();
136  V1[2] = _p1.get_oZ();
137  V2[0] = _p2.get_oX();
138  V2[1] = _p2.get_oY();
139  V2[2] = _p2.get_oZ();
140 
141  // Get the axis of the cylinder
142  ABC = V1-V2;
143 
144  // Build our extremity circles
145  cercle1->setWorldCoordinates(ABC[0],ABC[1],ABC[2],_p1.get_oX(),_p1.get_oY(),_p1.get_oZ(),r);
146  cercle2->setWorldCoordinates(ABC[0],ABC[1],ABC[2],_p2.get_oX(),_p2.get_oY(),_p2.get_oZ(),r);
147 
148  // Build our cylinder
149  c->setWorldCoordinates(ABC[0],ABC[1],ABC[2],(_p1.get_oX()+_p2.get_oX())/2.0,(_p1.get_oY()+_p2.get_oY())/2.0,(_p1.get_oZ()+_p2.get_oZ())/2.0,r);
150 }
151 
152 
158 void
160 {
161  me = _me ;
162  if (meline1 != NULL)
163  {
164  meline1->setMe(me) ;
165  }
166  if (meline2 != NULL)
167  {
168  meline2->setMe(me) ;
169  }
170 }
171 
182 void
183 vpMbtDistanceCylinder::getCylinderLineExtremity(double &i, double &j,double rho, double theta,
184  vpCircle *circle)
185 {
186 // This was taken from the code of art-v1. (from the artCylinder class)
187  double px = cam.get_px() ;
188  double py = cam.get_py() ;
189  double u0 = cam.get_u0() ;
190  double v0 = cam.get_v0() ;
191 
192  double mu11 = circle->p[3];
193  double mu02 = circle->p[4];
194  double mu20 = circle->p[2];
195  double Xg = u0 + circle->p[0]*px;
196  double Yg = v0 + circle->p[1]*py;
197 
198  // Find Intersection between line and ellipse in the image.
199 
200  // Optimised calculation for X
201  double stheta = sin(theta);
202  double ctheta = cos(theta);
203  double sctheta = stheta*ctheta;
204  double m11yg = mu11*Yg;
205  double ctheta2 = vpMath::sqr(ctheta);
206  double m02xg = mu02*Xg;
207  double m11stheta = mu11*stheta;
208  j = ((mu11*Xg*sctheta-mu20*Yg*sctheta+mu20*rho*ctheta
209  -m11yg+m11yg*ctheta2+m02xg-m02xg*ctheta2+
210  m11stheta*rho)/(mu20*ctheta2+2.0*m11stheta*ctheta
211  +mu02-mu02*ctheta2));
212  //Optimised calculation for Y
213  double rhom02 = rho*mu02;
214  double sctheta2 = stheta*ctheta2;
215  double ctheta3 = ctheta2*ctheta;
216  i = (-(-rho*mu11*stheta*ctheta-rhom02+rhom02*ctheta2
217  +mu11*Xg*sctheta2-mu20*Yg*sctheta2-ctheta*mu11*Yg
218  +ctheta3*mu11*Yg+ctheta*mu02*Xg-ctheta3*mu02*Xg)/
219  (mu20*ctheta2+2.0*mu11*stheta*ctheta+mu02-
220  mu02*ctheta2)/stheta);
221 
222 }
223 
224 
232 void
234 {
235  // Perspective projection
236  p1->changeFrame(cMo);
237  p2->changeFrame(cMo);
238  cercle1->changeFrame(cMo);
239  cercle2->changeFrame(cMo);
240  c->changeFrame(cMo);
241 
242  p1->projection();
243  p2->projection();
244  try{
245  cercle1->projection();
246  }
247  catch(...){std::cout<<"Problem when projecting circle 1\n";}
248  try{
249  cercle2->projection();
250  }
251  catch(...){std::cout<<"Problem when projecting circle 2\n";}
252  c->projection();
253 
254  double rho1,theta1;
255  double rho2,theta2;
256 
257 // Create the moving edges containers
258  meline1 = new vpMbtMeLine ;
259  meline1->setMe(me) ;
260  meline2 = new vpMbtMeLine ;
261  meline2->setMe(me) ;
262 
263 // meline->setDisplay(vpMeSite::RANGE_RESULT) ;
264  meline1->setInitRange(0);
265  meline2->setInitRange(0);
266 
267  // Conversion meter to pixels
270 
271  // Determine intersections between circles and limbos
272  double i11,i12,i21,i22,j11,j12,j21,j22;
273  getCylinderLineExtremity(i11, j11, rho1, theta1, cercle1);
274  getCylinderLineExtremity(i12, j12, rho1, theta1, cercle2);
275  getCylinderLineExtremity(i21, j21, rho2, theta2, cercle1);
276  getCylinderLineExtremity(i22, j22, rho2, theta2, cercle2);
277 
278  // Create the image points
279  vpImagePoint ip11,ip12,ip21,ip22;
280  ip11.set_ij(i11,j11);
281  ip12.set_ij(i12,j12);
282  ip21.set_ij(i21,j21);
283  ip22.set_ij(i22,j22);
284 
285  // update limits of the melines.
286  int marge = /*10*/5; //ou 5 normalement
287  if (ip11.get_j()<ip12.get_j()) { meline1->jmin = (int)ip11.get_j()-marge ; meline1->jmax = (int)ip12.get_j()+marge ; } else{ meline1->jmin = (int)ip12.get_j()-marge ; meline1->jmax = (int)ip11.get_j()+marge ; }
288  if (ip11.get_i()<ip12.get_i()) { meline1->imin = (int)ip11.get_i()-marge ; meline1->imax = (int)ip12.get_i()+marge ; } else{ meline1->imin = (int)ip12.get_i()-marge ; meline1->imax = (int)ip11.get_i()+marge ; }
289 
290  if (ip21.get_j()<ip22.get_j()) { meline2->jmin = (int)ip21.get_j()-marge ; meline2->jmax = (int)ip22.get_j()+marge ; } else{ meline2->jmin = (int)ip22.get_j()-marge ; meline2->jmax = (int)ip21.get_j()+marge ; }
291  if (ip21.get_i()<ip22.get_i()) { meline2->imin = (int)ip21.get_i()-marge ; meline2->imax = (int)ip22.get_i()+marge ; } else{ meline2->imin = (int)ip22.get_i()-marge ; meline2->imax = (int)ip21.get_i()+marge ; }
292 
293  // Initialize the tracking
294  while (theta1 > M_PI) { theta1 -= M_PI ; }
295  while (theta1 < -M_PI) { theta1 += M_PI ; }
296 
297  if (theta1 < -M_PI/2.0) theta1 = -theta1 - 3*M_PI/2.0;
298  else theta1 = M_PI/2.0 - theta1;
299 
300  while (theta2 > M_PI) { theta2 -= M_PI ; }
301  while (theta2 < -M_PI) { theta2 += M_PI ; }
302 
303  if (theta2 < -M_PI/2.0) theta2 = -theta2 - 3*M_PI/2.0;
304  else theta2 = M_PI/2.0 - theta2;
305 
306  try
307  {
308  meline1->initTracking(I,ip11,ip12,rho1,theta1);
309  }
310  catch(...)
311  {
312  vpTRACE("the line can't be initialized");
313  }
314  try
315  {
316  meline2->initTracking(I,ip21,ip22,rho2,theta2);
317  }
318  catch(...)
319  {
320  vpTRACE("the line can't be initialized");
321  }
322 }
323 
324 
325 
332 void
334 {
335  try
336  {
337  meline1->track(I) ;
338  }
339  catch(...)
340  {
341  std::cout << "Track meline1 failed" << std::endl;
342  Reinit = true;
343  }
344  try
345  {
346  meline2->track(I) ;
347  }
348  catch(...)
349  {
350  std::cout << "Track meline2 failed" << std::endl;
351  Reinit = true;
352  }
353 
354  // Update the number of features
355  nbFeaturel1 = (unsigned int)meline1->getMeList().size();
356  nbFeaturel2 = (unsigned int)meline2->getMeList().size();
358 }
359 
360 
367 void
369 {
370  // Perspective projection
371  p1->changeFrame(cMo);
372  p2->changeFrame(cMo);
373  cercle1->changeFrame(cMo);
374  cercle2->changeFrame(cMo);
375  c->changeFrame(cMo);
376 
377  p1->projection();
378  p2->projection();
379  try{
380  cercle1->projection();
381  }
382  catch(...){std::cout<<"Probleme projection cercle 1\n";}
383  try{
384  cercle2->projection();
385  }
386  catch(...){std::cout<<"Probleme projection cercle 2\n";}
387  c->projection();
388 
389  // Get the limbos
390  double rho1,theta1;
391  double rho2,theta2;
392 
393  // Conversion meter to pixels
396 
397  // Determine intersections between circles and limbos
398  double i11,i12,i21,i22,j11,j12,j21,j22;
399 
400  getCylinderLineExtremity(i11, j11, rho1, theta1, cercle1);
401  getCylinderLineExtremity(i12, j12, rho1, theta1, cercle2);
402 
403  getCylinderLineExtremity(i21, j21, rho2, theta2, cercle1);
404  getCylinderLineExtremity(i22, j22, rho2, theta2, cercle2);
405 
406  // Create the image points
407  vpImagePoint ip11,ip12,ip21,ip22;
408  ip11.set_ij(i11,j11);
409  ip12.set_ij(i12,j12);
410  ip21.set_ij(i21,j21);
411  ip22.set_ij(i22,j22);
412 
413  // update limits of the meline.
414  int marge = /*10*/5; //ou 5 normalement
415  if (ip11.get_j()<ip12.get_j()) { meline1->jmin = (int)ip11.get_j()-marge ; meline1->jmax = (int)ip12.get_j()+marge ; } else{ meline1->jmin = (int)ip12.get_j()-marge ; meline1->jmax = (int)ip11.get_j()+marge ; }
416  if (ip11.get_i()<ip12.get_i()) { meline1->imin = (int)ip11.get_i()-marge ; meline1->imax = (int)ip12.get_i()+marge ; } else{ meline1->imin = (int)ip12.get_i()-marge ; meline1->imax = (int)ip11.get_i()+marge ; }
417 
418  if (ip21.get_j()<ip22.get_j()) { meline2->jmin = (int)ip21.get_j()-marge ; meline2->jmax = (int)ip22.get_j()+marge ; } else{ meline2->jmin = (int)ip22.get_j()-marge ; meline2->jmax = (int)ip21.get_j()+marge ; }
419  if (ip21.get_i()<ip22.get_i()) { meline2->imin = (int)ip21.get_i()-marge ; meline2->imax = (int)ip22.get_i()+marge ; } else{ meline2->imin = (int)ip22.get_i()-marge ; meline2->imax = (int)ip21.get_i()+marge ; }
420 
421  // Initialize the tracking
422  while (theta1 > M_PI) { theta1 -= M_PI ; }
423  while (theta1 < -M_PI) { theta1 += M_PI ; }
424 
425  if (theta1 < -M_PI/2.0) theta1 = -theta1 - 3*M_PI/2.0;
426  else theta1 = M_PI/2.0 - theta1;
427 
428  while (theta2 > M_PI) { theta2 -= M_PI ; }
429  while (theta2 < -M_PI) { theta2 += M_PI ; }
430 
431  if (theta2 < -M_PI/2.0) theta2 = -theta2 - 3*M_PI/2.0;
432  else theta2 = M_PI/2.0 - theta2;
433 
434  try
435  {
436  //meline1->updateParameters(I,rho1,theta1) ;
437  meline1->updateParameters(I,ip11,ip12,rho1,theta1) ;
438  }
439  catch(...)
440  {
441  Reinit = true;
442  }
443  try
444  {
445  //meline2->updateParameters(I,rho2,theta2) ;
446  meline2->updateParameters(I,ip21,ip22,rho2,theta2) ;
447  }
448  catch(...)
449  {
450  Reinit = true;
451  }
452 
453  // Update the numbers of features
454  nbFeaturel1 = (unsigned int)meline1->getMeList().size();
455  nbFeaturel2 = (unsigned int)meline2->getMeList().size();
457 }
458 
459 
468 void
470 {
471  if(meline1!= NULL)
472  delete meline1;
473  if(meline2!= NULL)
474  delete meline2;
475 
476  meline1 = NULL;
477  meline2 = NULL;
478 
479  initMovingEdge(I,cMo);
480 
481  Reinit = false;
482 }
483 
484 
494 void
496  const vpCameraParameters&camera, const vpColor col, const unsigned int thickness)
497 {
498  // Perspective projection
499  p1->changeFrame(cMo);
500  p2->changeFrame(cMo);
501  cercle1->changeFrame(cMo);
502  cercle2->changeFrame(cMo);
503  c->changeFrame(cMo);
504 
505  p1->projection();
506  p2->projection();
507  try{
508  cercle1->projection();
509  }
510  catch(...){std::cout<<"Problem projection circle 1";}
511  try{
512  cercle2->projection();
513  }
514  catch(...){std::cout<<"Problem projection circle 2";}
515  c->projection();
516 
517  double rho1,theta1;
518  double rho2,theta2;
519 
520  // Meters to pixels conversion
521  vpMeterPixelConversion::convertLine(camera,c->getRho1(),c->getTheta1(),rho1,theta1);
522  vpMeterPixelConversion::convertLine(camera,c->getRho2(),c->getTheta2(),rho2,theta2);
523 
524  // Determine intersections between circles and limbos
525  double i11,i12,i21,i22,j11,j12,j21,j22;
526 
527  getCylinderLineExtremity(i11, j11, rho1, theta1, cercle1);
528  getCylinderLineExtremity(i12, j12, rho1, theta1, cercle2);
529 
530  getCylinderLineExtremity(i21, j21, rho2, theta2, cercle1);
531  getCylinderLineExtremity(i22, j22, rho2, theta2, cercle2);
532 
533  // Create the image points
534  vpImagePoint ip11,ip12,ip21,ip22;
535  ip11.set_ij(i11,j11);
536  ip12.set_ij(i12,j12);
537  ip21.set_ij(i21,j21);
538  ip22.set_ij(i22,j22);
539 
540  // Display
541  vpDisplay::displayLine(I,ip11,ip12,col, thickness);
542  vpDisplay::displayLine(I,ip21,ip22,col, thickness);
543 }
544 
554 void
556  const vpCameraParameters &camera, const vpColor col, const unsigned int thickness)
557 {
558  // Perspective projection
559  p1->changeFrame(cMo);
560  p2->changeFrame(cMo);
561  cercle1->changeFrame(cMo);
562  cercle2->changeFrame(cMo);
563  c->changeFrame(cMo);
564 
565  p1->projection();
566  p2->projection();
567  try{
568  cercle1->projection();
569  }
570  catch(...){std::cout<<"Problem projection circle 1";}
571  try{
572  cercle2->projection();
573  }
574  catch(...){std::cout<<"Problem projection circle 2";}
575  c->projection();
576 
577  double rho1,theta1;
578  double rho2,theta2;
579 
580  // Meters to pixels conversion
581  vpMeterPixelConversion::convertLine(camera,c->getRho1(),c->getTheta1(),rho1,theta1);
582  vpMeterPixelConversion::convertLine(camera,c->getRho2(),c->getTheta2(),rho2,theta2);
583 
584  // Determine intersections between circles and limbos
585  double i11,i12,i21,i22,j11,j12,j21,j22;
586 
587  getCylinderLineExtremity(i11, j11, rho1, theta1, cercle1);
588  getCylinderLineExtremity(i12, j12, rho1, theta1, cercle2);
589 
590  getCylinderLineExtremity(i21, j21, rho2, theta2, cercle1);
591  getCylinderLineExtremity(i22, j22, rho2, theta2, cercle2);
592 
593  // Create the image points
594  vpImagePoint ip11,ip12,ip21,ip22;
595  ip11.set_ij(i11,j11);
596  ip12.set_ij(i12,j12);
597  ip21.set_ij(i21,j21);
598  ip22.set_ij(i22,j22);
599 
600  // Display
601  vpDisplay::displayLine(I,ip11,ip12,col, thickness);
602  vpDisplay::displayLine(I,ip21,ip22,col, thickness);
603 }
604 
605 
616 void
618 {
619  if (meline1 != NULL)
620  {
621  meline1->display(I);
622  }
623  if (meline2 != NULL)
624  {
625  meline2->display(I);
626  }
627 }
628 
632 void
634 {
635  nbFeaturel1 = (unsigned int)meline1->getMeList().size();
636  nbFeaturel2 = (unsigned int)meline2->getMeList().size();
638  L.resize(nbFeature, 6);
640 }
641 
645 void
647 {
648  // Perspective projection
649  c->changeFrame(cMo) ;
650  c->projection() ;
651  cercle1->changeFrame(cMo) ;
652  cercle1->changeFrame(cMo) ;
653  try{
654  cercle1->projection();
655  }
656  catch(...){std::cout<<"Problem projection circle 1\n";}
657  try{
658  cercle2->projection();
659  }
660  catch(...){std::cout<<"Problem projection circle 2\n";}
661 
662  bool disp = false;
663  bool disp2 = false;
664  if (disp || disp2) vpDisplay::flush(I);
665 
666  // Build the lines
669 
670  double rho1 = featureline1.getRho() ;
671  double theta1 = featureline1.getTheta() ;
672  double rho2 = featureline2.getRho() ;
673  double theta2 = featureline2.getTheta() ;
674 
675  double co1 = cos(theta1);
676  double si1 = sin(theta1);
677  double co2 = cos(theta2);
678  double si2 = sin(theta2);
679 
680  double mx = 1.0/cam.get_px() ;
681  double my = 1.0/cam.get_py() ;
682  double xc = cam.get_u0() ;
683  double yc = cam.get_v0() ;
684 
685  double alpha1 ;
686  vpMatrix H1 ;
687  H1 = featureline1.interaction() ;
688  double alpha2 ;
689  vpMatrix H2 ;
690  H2 = featureline2.interaction() ;
691 
692  double x,y ;
693  vpMeSite p ;
694  unsigned int j =0 ;
695  for(std::list<vpMeSite>::const_iterator it=meline1->getMeList().begin(); it!=meline1->getMeList().end(); ++it){
696  x = (double)it->j;
697  y = (double)it->i;
698 
699  x = (x-xc)*mx ;
700  y = (y-yc)*my ;
701 
702  alpha1 = x*si1 - y*co1;
703 
704  double *Lrho = H1[0] ;
705  double *Ltheta = H1[1] ;
706  // Calculate interaction matrix for a distance
707  for (unsigned int k=0 ; k < 6 ; k++){
708  L[j][k] = (Lrho[k] + alpha1*Ltheta[k]);
709  }
710  error[j] = rho1 - ( x*co1 + y*si1) ;
711 
712  if (disp) vpDisplay::displayCross(I, it->i, it->j, (unsigned int)(error[j]*100), vpColor::orange,1);
713 
714  j++;
715  }
716 
717  for(std::list<vpMeSite>::const_iterator it=meline2->getMeList().begin(); it!=meline2->getMeList().end(); ++it){
718  x = (double)it->j;
719  y = (double)it->i;
720 
721  x = (x-xc)*mx ;
722  y = (y-yc)*my ;
723 
724  alpha2 = x*si2 - y*co2;
725 
726  double *Lrho = H2[0] ;
727  double *Ltheta = H2[1] ;
728  // Calculate interaction matrix for a distance
729  for (unsigned int k=0 ; k < 6 ; k++){
730  L[j][k] = (Lrho[k] + alpha2*Ltheta[k]);
731  }
732  error[j] = rho2 - ( x*co2 + y*si2) ;
733 
734  if (disp) vpDisplay::displayCross(I, it->i, it->j, (unsigned int)(error[j]*100),vpColor::red,1);
735 
736  j++;
737  }
738 }
739 
Definition of the vpMatrix class.
Definition: vpMatrix.h:98
void displayMovingEdges(const vpImage< unsigned char > &I)
void updateMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
vpCylinder * c
The cylinder.
void projection(const vpColVector &_cP, vpColVector &_p)
Projection onto the image plane of a point. Input: the 3D coordinates in the camera frame _cP...
Definition: vpPoint.cpp:132
double get_u0() const
void resize(const unsigned int nrows, const unsigned int ncols, const bool nullify=true)
Definition: vpMatrix.cpp:183
void trackMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
double get_i() const
Definition: vpImagePoint.h:194
void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP)
perspective projection of the circle
Definition: vpCircle.cpp:251
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
#define vpTRACE
Definition: vpDebug.h:418
Performs search in a given direction(normal) for a given distance(pixels) for a given 'site'...
Definition: vpMeSite.h:76
Class to define colors available for display functionnalities.
Definition: vpColor.h:125
void track(const vpImage< unsigned char > &I)
double get_oY() const
Get the point Y coordinate in the object frame.
Definition: vpPoint.h:129
double getRho2() const
Definition: vpCylinder.h:148
Contains predetermined masks for sites and holds moving edges tracking parameters.
Definition: vpMe.h:70
unsigned int nbFeature
The number of moving edges.
double getRho() const
double get_py() const
Implementation of a line used by the model-based tracker.
Definition: vpMbtMeLine.h:62
void initTracking(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, double rho, double theta)
double getTheta() const
vpPoint * p1
The first extremity on the axe.
static void flush(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:1994
double get_j() const
Definition: vpImagePoint.h:205
void display(const vpImage< unsigned char > &, vpColor)
Definition: vpMbtMeLine.h:80
void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP)
Definition: vpCylinder.cpp:302
static const vpColor red
Definition: vpColor.h:167
Class that defines what is a point.
Definition: vpPoint.h:65
vpMatrix L
The interaction matrix.
static const vpColor orange
Definition: vpColor.h:177
unsigned int nbFeaturel1
The number of moving edges on line 1.
double getTheta1() const
Definition: vpCylinder.h:141
void projection()
perspective projection of the circle
Definition: vpCircle.cpp:155
void updateParameters(const vpImage< unsigned char > &I, double rho, double theta)
vpCircle * cercle2
The lower circle limiting the cylinder.
double get_v0() const
void reinitMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
static double sqr(double x)
Definition: vpMath.h:106
void setInitRange(const unsigned int &r)
Definition: vpMeTracker.h:126
virtual void displayCross(const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)=0
Generic class defining intrinsic camera parameters.
double get_oZ() const
Get the point Z coordinate in the object frame.
Definition: vpPoint.h:131
vpMbtMeLine * meline1
The moving edge containers (first line of the cylinder)
vpMatrix interaction(const unsigned int select=FEATURE_ALL)
std::list< vpMeSite > & getMeList()
Definition: vpMeTracker.h:161
double get_px() const
void projection()
Definition: vpCylinder.cpp:189
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.
double get_oX() const
Get the point X coordinate in the object frame.
Definition: vpPoint.h:127
Class that defines what is a cylinder.
Definition: vpCylinder.h:97
int j
Definition: vpMeSite.h:98
void initMovingEdge(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo)
void buildFrom(const vpPoint &_p1, const vpPoint &_p2, const double r)
Class that provides a data structure for the column vectors as well as a set of operations on these v...
Definition: vpColVector.h:72
double getRho1() const
Definition: vpCylinder.h:135
double getTheta2() const
Definition: vpCylinder.h:154
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:92
virtual void displayLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)=0
double radius
The radius of the cylinder.
void setWorldCoordinates(const vpColVector &oP)
Definition: vpCylinder.cpp:77
static void create(vpFeaturePoint &s, const vpCameraParameters &cam, const vpDot &d)
void display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor col, const unsigned int thickness=1)
void setMe(vpMe *p_me)
Definition: vpMeTracker.h:140
unsigned int nbFeaturel2
The number of moving edges on line 2.
void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &_cP)
Definition: vpPoint.cpp:150
Class that defines what is a circle.
Definition: vpCircle.h:61
vpMbtMeLine * meline2
The moving edge containers (second line of the cylinder)
void computeInteractionMatrixError(const vpHomogeneousMatrix &cMo, const vpImage< unsigned char > &I)
vpColVector p
Definition: vpTracker.h:78
void set_ij(const double ii, const double jj)
Definition: vpImagePoint.h:180
void setWorldCoordinates(const vpColVector &oP)
Definition: vpCircle.cpp:66
void resize(const unsigned int i, const bool flagNullify=true)
Definition: vpColVector.h:94