Visual Servoing Platform  version 3.0.0
vpMbtMeLine.cpp
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2015 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
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 http://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  * Make the complete tracking of an object by using its CAD model
32  *
33  * Authors:
34  * Nicolas Melchior
35  * Romain Tallonneau
36  * Eric Marchand
37  *
38  *****************************************************************************/
39 #include <visp3/core/vpConfig.h>
40 #ifndef DOXYGEN_SHOULD_SKIP_THIS
41 
46 #include <cmath> // std::fabs
47 #include <limits> // numeric_limits
48 #include <algorithm> // std::min
49 
50 #include <visp3/mbt/vpMbtMeLine.h>
51 #include <visp3/core/vpTrackingException.h>
52 #include <visp3/core/vpRobust.h>
53 
55 static void
56 normalizeAngle(double &delta)
57 {
58  while (delta > M_PI) { delta -= M_PI ; }
59  while (delta < -M_PI) { delta += M_PI ; }
60 }
61 
62 
66 vpMbtMeLine::vpMbtMeLine()
67  : rho(0.), theta(0.), theta_1(M_PI/2), delta(0.), delta_1(0), sign(1),
68  a(0.), b(0.), c(0.), imin(0), imax(0), jmin(0), jmax(0),
69  expecteddensity(0.)
70 {
71 }
72 
76 vpMbtMeLine::~vpMbtMeLine()
77 {
78  list.clear();
79 }
80 
93 void
94 vpMbtMeLine::initTracking(const vpImage<unsigned char> &I, const vpImagePoint &ip1, const vpImagePoint &ip2,
95  double rho_, double theta_)
96 {
97  vpCDEBUG(1) <<" begin vpMeLine::initTracking()"<<std::endl ;
98 
99  try
100  {
101  // 1. On fait ce qui concerne les droites (peut etre vide)
102  // Points extremites
103  PExt[0].ifloat = (float)ip1.get_i() ;
104  PExt[0].jfloat = (float)ip1.get_j() ;
105  PExt[1].ifloat = (float)ip2.get_i() ;
106  PExt[1].jfloat = (float)ip2.get_j() ;
107 
108  this->rho = rho_;
109  this->theta = theta_;
110  theta_1 = theta_;
111 
112  a = cos(theta);
113  b = sin(theta);
114  c = -rho;
115 
116  delta = - theta + M_PI/2.0;
117  normalizeAngle(delta);
118  delta_1 = delta;
119 
120  sample(I) ;
121  expecteddensity = (double)list.size();
122 
124  }
125  catch(vpException &e)
126  {
127  throw e;
128  }
129  vpCDEBUG(1) <<" end vpMeLine::initTracking()"<<std::endl ;
130 }
131 
132 
139 void
140 vpMbtMeLine::sample(const vpImage<unsigned char>& I)
141 {
142  int rows = (int)I.getHeight() ;
143  int cols = (int)I.getWidth() ;
144  double n_sample;
145 
146  //if (me->getSampleStep==0)
147  if (std::fabs(me->getSampleStep()) <= std::numeric_limits<double>::epsilon())
148  {
150  "Function vpMbtMeLine::sample() called with moving-edges sample step = 0")) ;
151  }
152 
153  // i, j portions of the line_p
154  double diffsi = PExt[0].ifloat-PExt[1].ifloat;
155  double diffsj = PExt[0].jfloat-PExt[1].jfloat;
156 
157  double length_p = sqrt((vpMath::sqr(diffsi)+vpMath::sqr(diffsj)));
158 
159  // number of samples along line_p
160  n_sample = length_p/(double)me->getSampleStep();
161 
162  double stepi = diffsi/(double)n_sample;
163  double stepj = diffsj/(double)n_sample;
164 
165  // Choose starting point
166  double is = PExt[1].ifloat;
167  double js = PExt[1].jfloat;
168 
169  // Delete old list
170  list.clear();
171 
172  // sample positions at i*me->getSampleStep() interval along the
173  // line_p, starting at PSiteExt[0]
174 
175  vpImagePoint ip;
176  for(int i=0; i<=vpMath::round(n_sample); i++)
177  {
178  // If point is in the image, add to the sample list
179  if(!outOfImage(vpMath::round(is), vpMath::round(js), (int)(me->getRange()+me->getMaskSize()+1), (int)rows, (int)cols))
180  {
181  vpMeSite pix ; //= list.value();
182  pix.init((int)is, (int)js, delta, 0, sign) ;
183 
184  pix.track(I, me, false);
185 
186  pix.setDisplay(selectDisplay) ;
187 
188  if(vpDEBUG_ENABLE(3))
189  {
190  ip.set_i( is );
191  ip.set_j( js );
193  }
194 
195  list.push_back(pix);
196  }
197  is += stepi;
198  js += stepj;
199 
200  }
201 
202  vpCDEBUG(1) << "end vpMeLine::sample() : ";
203  vpCDEBUG(1) << list.size() << " point inserted in the list " << std::endl ;
204 }
205 
206 
212 void
213 vpMbtMeLine::suppressPoints(const vpImage<unsigned char> & I)
214 {
215  for(std::list<vpMeSite>::iterator it=list.begin(); it!=list.end(); ){
216  vpMeSite s = *it;//current reference pixel
217 
218  if (fabs(sin(theta)) > 0.9) // Vertical line management
219  {
220  if ((s.i < imin) ||(s.i > imax))
221  {
223  }
224  }
225 
226  else if (fabs(cos(theta)) > 0.9) // Horizontal line management
227  {
228  if ((s.j < jmin) || (s.j > jmax))
229  {
231  }
232  }
233 
234  else
235  {
236  if ((s.i < imin) ||(s.i > imax) || (s.j < jmin) || (s.j > jmax) )
237  {
239  }
240 
241  }
242 
243  if (outOfImage(s.i, s.j, (int)(me->getRange()+me->getMaskSize()+1), (int)I.getHeight(), (int)I.getWidth()))
244  {
246  }
247 
249  it = list.erase(it);
250  else
251  ++it;
252  }
253 }
254 
255 
261 void
262 vpMbtMeLine::seekExtremities(const vpImage<unsigned char> &I)
263 {
264  vpCDEBUG(1) <<"begin vpMeLine::sample() : "<<std::endl ;
265 
266  int rows = (int)I.getHeight() ;
267  int cols = (int)I.getWidth() ;
268  double n_sample;
269 
270  //if (me->getSampleStep()==0)
271  if (std::fabs(me->getSampleStep()) <= std::numeric_limits<double>::epsilon())
272  {
274  "Function called with sample step = 0")) ;
275  }
276 
277  // i, j portions of the line_p
278  double diffsi = PExt[0].ifloat-PExt[1].ifloat;
279  double diffsj = PExt[0].jfloat-PExt[1].jfloat;
280 
281  double s = vpMath::sqr(diffsi)+vpMath::sqr(diffsj) ;
282 
283  double di = diffsi/sqrt(s) ; // pas de risque de /0 car d(P1,P2) >0
284  double dj = diffsj/sqrt(s) ;
285 
286  double length_p = sqrt(s); /*(vpMath::sqr(diffsi)+vpMath::sqr(diffsj))*/
287 
288  // number of samples along line_p
289  n_sample = length_p/(double)me->getSampleStep();
290  double sample_step = (double)me->getSampleStep();
291 
292  vpMeSite P ;
293  P.init((int) PExt[0].ifloat, (int)PExt[0].jfloat, delta_1, 0, sign) ;
294  P.setDisplay(selectDisplay) ;
295 
296  unsigned int memory_range = me->getRange() ;
297  me->setRange(1);
298 
299  for (int i=0 ; i < 3 ; i++)
300  {
301  P.ifloat = P.ifloat + di*sample_step ; P.i = (int)P.ifloat ;
302  P.jfloat = P.jfloat + dj*sample_step ; P.j = (int)P.jfloat ;
303 
304  if ((P.i < imin) ||(P.i > imax) || (P.j < jmin) || (P.j > jmax) )
305  {
307  }
308  else
309  if(!outOfImage(P.i, P.j, (int)(me->getRange()+me->getMaskSize()+1), (int)rows, (int)cols))
310  {
311  P.track(I,me,false) ;
312 
314  {
315  list.push_back(P);
317  }
318  else
320  }
321  }
322 
323  P.init((int) PExt[1].ifloat, (int)PExt[1].jfloat, delta_1, 0, sign) ;
324  P.setDisplay(selectDisplay) ;
325  for (int i=0 ; i < 3 ; i++)
326  {
327  P.ifloat = P.ifloat - di*sample_step ; P.i = (int)P.ifloat ;
328  P.jfloat = P.jfloat - dj*sample_step ; P.j = (int)P.jfloat ;
329 
330  if ((P.i < imin) ||(P.i > imax) || (P.j < jmin) || (P.j > jmax) )
331  {
333  }
334 
335  else
336  if(!outOfImage(P.i, P.j, (int)(me->getRange()+me->getMaskSize()+1), (int)rows, (int)cols))
337  {
338  P.track(I,me,false) ;
339 
341  {
342  list.push_back(P);
344  }
345  else
347  }
348  }
349 
350  me->setRange(memory_range);
351 
352  vpCDEBUG(1) <<"end vpMeLine::sample() : " ;
353  vpCDEBUG(1) << n_sample << " point inserted in the list " << std::endl ;
354 }
355 
356 
365 void
366 vpMbtMeLine::computeProjectionError(const vpImage<unsigned char>& _I, double &_sumErrorRad, unsigned int &_nbFeatures)
367 {
368  _sumErrorRad = 0;
369  _nbFeatures = 0;
370  double deltaNormalized = theta;
371  unsigned int iter = 0;
372 
373  while (deltaNormalized<0) deltaNormalized += M_PI;
374  while (deltaNormalized>M_PI) deltaNormalized -= M_PI;
375 
376  vpColVector vecLine(2);
377  vecLine[0] = cos(deltaNormalized);
378  vecLine[1] = sin(deltaNormalized);
379  vecLine.normalize();
380 
381 // vpMatrix filterX(3,3);
382 // filterX[0][0] = -1;
383 // filterX[1][0] = -2;
384 // filterX[2][0] = -1;
385 
386 // filterX[0][1] = 0;
387 // filterX[1][1] = 0;
388 // filterX[2][1] = 0;
389 
390 // filterX[0][2] = 1;
391 // filterX[1][2] = 2;
392 // filterX[2][2] = 1;
393 
394 // vpMatrix filterY(3,3);
395 // filterY[0][0] = -1;
396 // filterY[0][1] = -2;
397 // filterY[0][2] = -1;
398 
399 // filterY[1][0] = 0;
400 // filterY[1][1] = 0;
401 // filterY[1][2] = 0;
402 
403 // filterY[2][0] = 1;
404 // filterY[2][1] = 2;
405 // filterY[2][2] = 1;
406 
407  vpMatrix filterX(5,5);
408  filterX[0][0] = -1;
409  filterX[1][0] = -4;
410  filterX[2][0] = -6;
411  filterX[3][0] = -4;
412  filterX[4][0] = -1;
413 
414  filterX[0][1] = -2;
415  filterX[1][1] = -8;
416  filterX[2][1] = -12;
417  filterX[3][1] = -8;
418  filterX[4][1] = -2;
419 
420  filterX[0][2] = 0;
421  filterX[1][2] = 0;
422  filterX[2][2] = 0;
423  filterX[3][2] = 0;
424  filterX[4][2] = 0;
425 
426  filterX[0][3] = 2;
427  filterX[1][3] = 8;
428  filterX[2][3] = 12;
429  filterX[3][3] = 8;
430  filterX[4][3] = 2;
431 
432  filterX[0][4] = 1;
433  filterX[1][4] = 4;
434  filterX[2][4] = 6;
435  filterX[3][4] = 4;
436  filterX[4][4] = 1;
437 
438  vpMatrix filterY(5,5);
439  filterY[0][0] = -1;
440  filterY[0][1] = -4;
441  filterY[0][2] = -6;
442  filterY[0][3] = -4;
443  filterY[0][4] = -1;
444 
445  filterY[1][0] = -2;
446  filterY[1][1] = -8;
447  filterY[1][2] = -12;
448  filterY[1][3] = -8;
449  filterY[1][4] = -2;
450 
451  filterY[2][0] = 0;
452  filterY[2][1] = 0;
453  filterY[2][2] = 0;
454  filterY[2][3] = 0;
455  filterY[2][4] = 0;
456 
457  filterY[3][0] = 2;
458  filterY[3][1] = 8;
459  filterY[3][2] = 12;
460  filterY[3][3] = 8;
461  filterY[3][4] = 2;
462 
463  filterY[4][0] = 1;
464  filterY[4][1] = 4;
465  filterY[4][2] = 6;
466  filterY[4][3] = 4;
467  filterY[4][4] = 1;
468 
469  double offset = std::floor(filterX.getRows() / 2.0f);
470 
471  for(std::list<vpMeSite>::iterator it=list.begin(); it!=list.end(); ++it){
472  if(iter != 0 && iter+1 != list.size()){
473  double gradientX = 0;
474  double gradientY = 0;
475 
476  double iSite = it->ifloat;
477  double jSite = it->jfloat;
478 
479  for(unsigned int i = 0; i<filterX.getRows() ; i++){
480  double iImg = iSite + (i - offset);
481  for (unsigned int j = 0; j< filterX.getCols(); j++){
482  double jImg = jSite + (j-offset);
483 
484  if(iImg < 0) iImg = 0.0;
485  if(jImg < 0) jImg = 0.0;
486 
487  if(iImg > _I.getHeight()-1) iImg = _I.getHeight()-1;
488  if(jImg > _I.getWidth()-1) jImg = _I.getWidth()-1;
489 
490  gradientX += filterX[i][j] * _I((unsigned int)iImg, (unsigned int)jImg);
491  }
492  }
493 
494  for(unsigned int i = 0; i<filterY.getRows() ; i++){
495  double iImg = iSite + (i - offset);
496  for (unsigned int j = 0; j< filterY.getCols(); j++){
497  double jImg = jSite + (j-offset);
498 
499  if(iImg < 0) iImg = 0.0;
500  if(jImg < 0) jImg = 0.0;
501 
502  if(iImg > _I.getHeight()-1) iImg = _I.getHeight()-1;
503  if(jImg > _I.getWidth()-1) jImg = _I.getWidth()-1;
504 
505  gradientY += filterY[i][j] * _I((unsigned int)iImg, (unsigned int)jImg);
506  }
507  }
508 
509  double angle = atan2(gradientX,gradientY);
510  while (angle<0) angle += M_PI;
511  while (angle>M_PI) angle -= M_PI;
512 
513  vpColVector vecGrad(2);
514  vecGrad[0] = cos(angle);
515  vecGrad[1] = sin(angle);
516  vecGrad.normalize();
517 
518  double angle1 = acos(vecLine * vecGrad);
519  double angle2 = acos(vecLine * (-vecGrad));
520 
521 // double angle1 = sqrt(vpMath::sqr(deltaNormalized-angle));
522 // double angle2 = sqrt(vpMath::sqr(deltaNormalized- (angle-M_PI)));
523 
524  _sumErrorRad += std::min(angle1,angle2);
525 
526 // if(std::fabs(deltaNormalized-angle) > M_PI / 2)
527 // {
528 // sumErrorRad += sqrt(vpMath::sqr(deltaNormalized-angle)) - M_PI / 2;
529 // } else {
530 // sumErrorRad += sqrt(vpMath::sqr(deltaNormalized-angle));
531 // }
532 
533  _nbFeatures++;
534  }
535  iter++;
536  }
537 }
538 
549 void
550 vpMbtMeLine::reSample(const vpImage<unsigned char> &I)
551 {
552  unsigned int n = numberOfSignal() ;
553 
554  if ((double)n<0.5*expecteddensity && n > 0)
555  {
556  double delta_new = delta;
557  delta = delta_1;
558  sample(I) ;
559  expecteddensity = (double)list.size();
560  delta = delta_new;
561  // 2. On appelle ce qui n'est pas specifique
562  {
564  }
565  }
566 }
567 
568 
581 void
582 vpMbtMeLine::reSample(const vpImage<unsigned char> &I, vpImagePoint ip1, vpImagePoint ip2)
583 {
584  size_t n = list.size();
585 
586  if ((double)n<0.5*expecteddensity /*&& n > 0*/) // n is always > 0
587  {
588  double delta_new = delta;
589  delta = delta_1;
590  PExt[0].ifloat = (float)ip1.get_i() ;
591  PExt[0].jfloat = (float)ip1.get_j() ;
592  PExt[1].ifloat = (float)ip2.get_i() ;
593  PExt[1].jfloat = (float)ip2.get_j() ;
594  sample(I) ;
595  expecteddensity = (double)list.size();
596  delta = delta_new;
597  vpMeTracker::track(I) ;
598  }
599 }
600 
604 void
605 vpMbtMeLine::updateDelta()
606 {
607  vpMeSite p_me ;
608 
609  double diff = 0;
610 
611  //if(fabs(theta) == M_PI )
612  if(std::fabs(std::fabs(theta) - M_PI) <= vpMath::maximum(std::fabs(theta), (double)M_PI)*std::numeric_limits<double>::epsilon() )
613  {
614  theta = 0 ;
615  }
616 
617  diff = fabs(theta - theta_1);
618  if (diff > M_PI/2.0)
619  sign *= -1;
620 
621  theta_1 = theta;
622 
623  delta = - theta + M_PI/2.0;
624  normalizeAngle(delta);
625 
626  for(std::list<vpMeSite>::iterator it=list.begin(); it!=list.end(); ++it){
627  p_me = *it;
628  p_me.alpha = delta ;
629  p_me.mask_sign = sign;
630  *it = p_me;
631  }
632  delta_1 = delta;
633 }
634 
640 void
641 vpMbtMeLine::track(const vpImage<unsigned char> &I)
642 {
643  // 2. On appelle ce qui n'est pas specifique
644  try
645  {
647  }
648  catch(vpException &e)
649  {
650  throw e;
651  }
652 
653  // supression des points rejetes par les ME
654  // suppressPoints(I);
655  // setExtremities();
656 }
657 
658 
666 void
667 vpMbtMeLine::updateParameters(const vpImage<unsigned char> &I, double rho_, double theta_)
668 {
669  this->rho = rho_;
670  this->theta = theta_;
671  a = cos(theta);
672  b = sin(theta);
673  c = -rho;
674  // recherche de point aux extremite de la droites
675  // dans le cas d'un glissement
676  suppressPoints(I);
677  seekExtremities(I);
678  suppressPoints(I);
679  setExtremities();
680  //reechantillonage si necessaire
681  reSample(I);
682 
683  // remet a jour l'angle delta pour chaque point de la liste
684  updateDelta();
685 }
686 
687 
697 void
698 vpMbtMeLine::updateParameters(const vpImage<unsigned char> &I, vpImagePoint ip1, vpImagePoint ip2,
699  double rho_, double theta_)
700 {
701  this->rho = rho_;
702  this->theta = theta_;
703  a = cos(theta);
704  b = sin(theta);
705  c = -rho;
706  // recherche de point aux extremite de la droites
707  // dans le cas d'un glissement
708  suppressPoints(I);
709  seekExtremities(I);
710  suppressPoints(I);
711  setExtremities();
712  //reechantillonage si necessaire
713  reSample(I,ip1,ip2);
714 
715  // remet a jour l'angle delta pour chaque point de la liste
716  updateDelta();
717 }
718 
719 
723 void
724 vpMbtMeLine::setExtremities()
725 {
726  double i_min = +1e6 ;
727  double j_min = +1e6;
728  double i_max = -1 ;
729  double j_max = -1 ;
730 
731  // Loop through list of sites to track
732  for(std::list<vpMeSite>::const_iterator it=list.begin(); it!=list.end(); ++it){
733  vpMeSite s = *it;//current reference pixel
734  if (s.ifloat < i_min)
735  {
736  i_min = s.ifloat ;
737  j_min = s.jfloat ;
738  }
739 
740  if (s.ifloat > i_max)
741  {
742  i_max = s.ifloat ;
743  j_max = s.jfloat ;
744  }
745  }
746 
747  if ( ! list.empty() )
748  {
749  PExt[0].ifloat = i_min ;
750  PExt[0].jfloat = j_min ;
751  PExt[1].ifloat = i_max ;
752  PExt[1].jfloat = j_max ;
753  }
754 
755  if (fabs(i_min-i_max) < 25)
756  {
757  for(std::list<vpMeSite>::const_iterator it=list.begin(); it!=list.end(); ++it){
758  vpMeSite s = *it;//current reference pixel
759  if (s.jfloat < j_min)
760  {
761  i_min = s.ifloat ;
762  j_min = s.jfloat ;
763  }
764 
765  if (s.jfloat > j_max)
766  {
767  i_max = s.ifloat ;
768  j_max = s.jfloat ;
769  }
770  }
771 
772  if (! list.empty())
773  {
774  PExt[0].ifloat = i_min ;
775  PExt[0].jfloat = j_min ;
776  PExt[1].ifloat = i_max ;
777  PExt[1].jfloat = j_max ;
778  }
779  bubbleSortJ();
780  }
781 
782  else
783  bubbleSortI();
784 }
785 
786 
787 static bool sortByI(const vpMeSite& s1, const vpMeSite& s2){
788  return (s1.ifloat > s2.ifloat);
789 }
790 
791 void
792 vpMbtMeLine::bubbleSortI()
793 {
794 #if 0
795  unsigned int nbElmt = list.size();
796  for (unsigned int pass = 1; pass < nbElmt; pass++)
797  {
798  list.front();
799  for (unsigned int i=0; i < nbElmt-pass; i++)
800  {
801  vpMeSite s1 = list.value() ;
802  vpMeSite s2 = list.nextValue() ;
803  if (s1.ifloat > s2.ifloat)
804  list.swapRight();
805  else
806  list.next();
807  }
808  }
809 #endif
810  list.sort(sortByI);
811 }
812 
813 
814 static bool sortByJ(const vpMeSite& s1, const vpMeSite& s2){
815  return (s1.jfloat > s2.jfloat);
816 }
817 
818 void
819 vpMbtMeLine::bubbleSortJ()
820 {
821 #if 0
822  unsigned int nbElmt = list.size();
823  for(unsigned int pass=1; pass < nbElmt; pass++)
824  {
825  list.front();
826  for (unsigned int i=0; i < nbElmt-pass; i++)
827  {
828  vpMeSite s1 = list.value() ;
829  vpMeSite s2 = list.nextValue() ;
830  if (s1.jfloat > s2.jfloat)
831  list.swapRight();
832  else
833  list.next();
834  }
835  }
836 #endif
837  list.sort(sortByJ);
838 }
839 
840 
841 void
842 vpMbtMeLine::findSignal(const vpImage<unsigned char>& I, const vpMe *p_me, double *conv)
843 {
844  vpImagePoint itest(PExt[0].ifloat+(PExt[1].ifloat-PExt[0].ifloat)/2, PExt[0].jfloat+(PExt[1].jfloat-PExt[0].jfloat)/2);
845 
846  vpMeSite pix ; //= list.value();
847  pix.init(itest.get_i(), itest.get_j(), delta, 0, sign);
848 
849  vpMeSite *list_query_pixels;
850 // double convolution = 0;
851  unsigned int range = p_me->getRange();
852 
853  list_query_pixels = pix.getQueryList(I, (int)range);
854 
856  vpDisplay::displayLine(I,vpImagePoint(list_query_pixels[0].ifloat,list_query_pixels[0].jfloat),vpImagePoint(list_query_pixels[2*range].ifloat,list_query_pixels[2*range].jfloat),vpColor::cyan);
857  vpDisplay::displayCross(I,vpImagePoint(list_query_pixels[0].ifloat,list_query_pixels[0].jfloat),5,vpColor::orange,3);
858 
859  for(unsigned int n = 0 ; n < 2 * range + 1 ; n++)
860  {
861  conv[n] = list_query_pixels[n].convolution(I, p_me);
862  }
863  delete [] list_query_pixels;
864 }
865 
866 #endif
867 
unsigned int getRange() const
Definition: vpMe.h:225
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:92
void init()
Definition: vpMeSite.cpp:69
double get_i() const
Definition: vpImagePoint.h:190
unsigned int getWidth() const
Definition: vpImage.h:161
double jfloat
Definition: vpMeSite.h:96
#define vpDEBUG_ENABLE(level)
Definition: vpDebug.h:526
double convolution(const vpImage< unsigned char > &ima, const vpMe *me)
Definition: vpMeSite.cpp:308
Performs search in a given direction(normal) for a given distance(pixels) for a given 'site'...
Definition: vpMeSite.h:72
double alpha
Definition: vpMeSite.h:100
int i
Definition: vpMeSite.h:94
error that can be emited by ViSP classes.
Definition: vpException.h:73
Definition: vpMe.h:59
int mask_sign
Definition: vpMeSite.h:98
static const vpColor green
Definition: vpColor.h:166
static int round(const double x)
Definition: vpMath.h:248
double get_j() const
Definition: vpImagePoint.h:201
vpMeSiteState getState() const
Definition: vpMeSite.h:198
static Type maximum(const Type &a, const Type &b)
Definition: vpMath.h:141
static const vpColor orange
Definition: vpColor.h:173
double ifloat
Definition: vpMeSite.h:96
void set_i(const double ii)
Definition: vpImagePoint.h:154
Error that can be emited by the vpTracker class and its derivates.
static const vpColor cyan
Definition: vpColor.h:172
static double sqr(double x)
Definition: vpMath.h:110
virtual void displayCross(const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)=0
void setDisplay(vpMeSiteDisplayType select)
Definition: vpMeSite.h:148
#define vpCDEBUG(level)
Definition: vpDebug.h:502
void track(const vpImage< unsigned char > &I)
Track sampled pixels.
vpMeSite * getQueryList(const vpImage< unsigned char > &I, const int range)
Definition: vpMeSite.cpp:225
void setState(const vpMeSiteState &flag)
Definition: vpMeSite.h:185
void set_j(const double jj)
Definition: vpImagePoint.h:165
int j
Definition: vpMeSite.h:94
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
void track(const vpImage< unsigned char > &im, const vpMe *me, const bool test_contraste=true)
Definition: vpMeSite.cpp:377
void initTracking(const vpImage< unsigned char > &I)
unsigned int getHeight() const
Definition: vpImage.h:152
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:88
virtual void displayLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)=0
static const vpColor blue
Definition: vpColor.h:169