Visual Servoing Platform  version 3.0.0
vpImageFilter.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  * Various image tools, convolution, ...
32  *
33  * Authors:
34  * Eric Marchand
35  *
36  *****************************************************************************/
37 
38 #include <visp3/core/vpImageFilter.h>
39 #include <visp3/core/vpImageConvert.h>
40 #if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020408)
41 # include <opencv2/imgproc/imgproc.hpp>
42 #elif defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020101)
43 # include <opencv2/imgproc/imgproc_c.h>
44 #elif defined(VISP_HAVE_OPENCV)
45 # include <cv.h>
46 #endif
47 
56 void
58  vpImage<double>& If,
59  const vpMatrix& M)
60 {
61 
62  unsigned int size = M.getRows() ;
63  unsigned int half_size = size/2 ;
64 
65  If.resize(I.getHeight(),I.getWidth()) ;
66 
67  If = 0 ;
68 
69  for (unsigned int i=half_size ; i < I.getHeight()-half_size ; i++)
70  {
71  for (unsigned int j=half_size ; j < I.getWidth()-half_size ; j++)
72  {
73  double conv_x = 0 ;
74 
75  for(unsigned int a = 0 ; a < size ; a++ )
76  for(unsigned int b = 0 ; b < size ; b++ )
77  {
78  double val = I[i-half_size+a][j-half_size+b] ;
79  conv_x += M[a][b] * val ;
80  }
81  If[i][j] = conv_x ;
82  }
83  }
84 
85 }
86 
96 void
98  vpImage<double>& Iu,
99  vpImage<double>& Iv,
100  const vpMatrix& M)
101 {
102 
103  unsigned int size = M.getRows() ;
104  unsigned int half_size = size/2 ;
105 
106  Iu.resize(I.getHeight(),I.getWidth()) ;
107  Iv.resize(I.getHeight(),I.getWidth()) ;
108 
109  Iu = 0 ;
110  Iv = 0 ;
111  for (unsigned int v=half_size ; v < I.getHeight()-half_size ; v++)
112  {
113  for (unsigned int u=half_size ; u < I.getWidth()-half_size ; u++)
114  {
115  double conv_u = 0 ;
116  double conv_v = 0 ;
117 
118  for(unsigned int a = 0 ; a < size ; a++ )
119  for(unsigned int b = 0 ; b < size ; b++ )
120  {
121  double val = I[v-half_size+a][u-half_size+b] ;
122  conv_u += M[a][b] * val ;
123  conv_v += M[b][a] * val ;
124  }
125  Iu[v][u] = conv_u ;
126  Iv[v][u] = conv_v ;
127  }
128  }
129 
130 }
131 
132 #if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
133 
173 void
176  const unsigned int gaussianFilterSize,
177  const double thresholdCanny,
178  const unsigned int apertureSobel)
179 {
180 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
181  IplImage* img_ipl = NULL;
182  vpImageConvert::convert(Isrc, img_ipl);
183  IplImage* edges_ipl;
184  edges_ipl = cvCreateImage(cvSize(img_ipl->width, img_ipl->height), img_ipl->depth, img_ipl->nChannels);
185 
186  cvSmooth(img_ipl, img_ipl, CV_GAUSSIAN, (int)gaussianFilterSize, (int)gaussianFilterSize, 0, 0);
187  cvCanny(img_ipl, edges_ipl, thresholdCanny, thresholdCanny, (int)apertureSobel);
188 
189  vpImageConvert::convert(edges_ipl, Ires);
190  cvReleaseImage(&img_ipl);
191  cvReleaseImage(&edges_ipl);
192 #else
193  cv::Mat img_cvmat, edges_cvmat;
194  vpImageConvert::convert(Isrc, img_cvmat);
195  cv::GaussianBlur(img_cvmat, img_cvmat, cv::Size((int)gaussianFilterSize, (int)gaussianFilterSize), 0, 0);
196  cv::Canny(img_cvmat, edges_cvmat, thresholdCanny, thresholdCanny, (int)apertureSobel);
197  vpImageConvert::convert(edges_cvmat, Ires);
198 #endif
199 }
200 #endif
201 
205 void vpImageFilter::filter(const vpImage<unsigned char> &I, vpImage<double>& GI, const double *filter,unsigned int size)
206 {
207  vpImage<double> GIx ;
208  filterX(I, GIx,filter,size);
209  filterY(GIx, GI,filter,size);
210  GIx.destroy();
211 }
212 
216 void vpImageFilter::filter(const vpImage<double> &I, vpImage<double>& GI, const double *filter,unsigned int size)
217 {
218  vpImage<double> GIx ;
219  filterX(I, GIx,filter,size);
220  filterY(GIx, GI,filter,size);
221  GIx.destroy();
222 }
223 
224 void vpImageFilter::filterX(const vpImage<unsigned char> &I, vpImage<double>& dIx, const double *filter,unsigned int size)
225 {
226  dIx.resize(I.getHeight(),I.getWidth()) ;
227  for (unsigned int i=0 ; i < I.getHeight() ; i++)
228  {
229  for (unsigned int j=0 ; j < (size-1)/2 ; j++)
230  {
231  dIx[i][j]=vpImageFilter::filterXLeftBorder(I,i,j,filter,size);
232  //dIx[i][j]=0;
233  }
234  for (unsigned int j=(size-1)/2 ; j < I.getWidth()-(size-1)/2 ; j++)
235  {
236  dIx[i][j]=vpImageFilter::filterX(I,i,j,filter,size);
237  }
238  for (unsigned int j=I.getWidth()-(size-1)/2 ; j < I.getWidth() ; j++)
239  {
240  dIx[i][j]=vpImageFilter::filterXRightBorder(I,i,j,filter,size);
241  //dIx[i][j]=0;
242  }
243  }
244 }
245 void vpImageFilter::filterX(const vpImage<double> &I, vpImage<double>& dIx, const double *filter,unsigned int size)
246 {
247  dIx.resize(I.getHeight(),I.getWidth()) ;
248  for (unsigned int i=0 ; i < I.getHeight() ; i++)
249  {
250  for (unsigned int j=0 ; j < (size-1)/2 ; j++)
251  {
252  dIx[i][j]=vpImageFilter::filterXLeftBorder(I,i,j,filter,size);
253  //dIx[i][j]=0;
254  }
255  for (unsigned int j=(size-1)/2 ; j < I.getWidth()-(size-1)/2 ; j++)
256  {
257  dIx[i][j]=vpImageFilter::filterX(I,i,j,filter,size);
258  }
259  for (unsigned int j=I.getWidth()-(size-1)/2 ; j < I.getWidth() ; j++)
260  {
261  dIx[i][j]=vpImageFilter::filterXRightBorder(I,i,j,filter,size);
262  //dIx[i][j]=0;
263  }
264  }
265 }
266 void vpImageFilter::filterY(const vpImage<unsigned char> &I, vpImage<double>& dIy, const double *filter,unsigned int size)
267 {
268  dIy.resize(I.getHeight(),I.getWidth()) ;
269  for (unsigned int i=0 ; i < (size-1)/2 ; i++)
270  {
271  for (unsigned int j=0 ; j < I.getWidth() ; j++)
272  {
273  dIy[i][j]=vpImageFilter::filterYTopBorder(I,i,j,filter,size);
274  }
275  }
276  for (unsigned int i=(size-1)/2 ; i < I.getHeight()-(size-1)/2 ; i++)
277  {
278  for (unsigned int j=0 ; j < I.getWidth() ; j++)
279  {
280  dIy[i][j]=vpImageFilter::filterY(I,i,j,filter,size);
281  }
282  }
283  for (unsigned int i=I.getHeight()-(size-1)/2 ; i < I.getHeight() ; i++)
284  {
285  for (unsigned int j=0 ; j < I.getWidth() ; j++)
286  {
287  dIy[i][j]=vpImageFilter::filterYBottomBorder(I,i,j,filter,size);
288  }
289  }
290 }
291 void vpImageFilter::filterY(const vpImage<double> &I, vpImage<double>& dIy, const double *filter,unsigned int size)
292 {
293  dIy.resize(I.getHeight(),I.getWidth()) ;
294  for (unsigned int i=0 ; i < (size-1)/2 ; i++)
295  {
296  for (unsigned int j=0 ; j < I.getWidth() ; j++)
297  {
298  dIy[i][j]=vpImageFilter::filterYTopBorder(I,i,j,filter,size);
299  }
300  }
301  for (unsigned int i=(size-1)/2 ; i < I.getHeight()-(size-1)/2 ; i++)
302  {
303  for (unsigned int j=0 ; j < I.getWidth() ; j++)
304  {
305  dIy[i][j]=vpImageFilter::filterY(I,i,j,filter,size);
306  }
307  }
308  for (unsigned int i=I.getHeight()-(size-1)/2 ; i < I.getHeight() ; i++)
309  {
310  for (unsigned int j=0 ; j < I.getWidth() ; j++)
311  {
312  dIy[i][j]=vpImageFilter::filterYBottomBorder(I,i,j,filter,size);
313  }
314  }
315 }
316 
326 void vpImageFilter::gaussianBlur(const vpImage<unsigned char> &I, vpImage<double>& GI, unsigned int size, double sigma, bool normalize)
327 {
328  double *fg=new double[(size+1)/2] ;
329  vpImageFilter::getGaussianKernel(fg, size, sigma, normalize) ;
330  vpImage<double> GIx ;
331  vpImageFilter::filterX(I, GIx,fg,size);
332  vpImageFilter::filterY(GIx, GI,fg,size);
333  GIx.destroy();
334  delete[] fg;
335 }
336 
346 void vpImageFilter::gaussianBlur(const vpImage<double> &I, vpImage<double>& GI, unsigned int size, double sigma, bool normalize)
347 {
348  double *fg=new double[(size+1)/2] ;
349  vpImageFilter::getGaussianKernel(fg, size, sigma, normalize) ;
350  vpImage<double> GIx ;
351  vpImageFilter::filterX(I, GIx,fg,size);
352  vpImageFilter::filterY(GIx, GI,fg,size);
353  GIx.destroy();
354  delete[] fg;
355 }
356 
366 void vpImageFilter::getGaussianKernel(double *filter, unsigned int size, double sigma, bool normalize)
367 {
368  if (size%2 != 1)
370  "Bad Gaussian filter size"));
371 
372  if (sigma<= 0)
373  sigma = (size-1)/6.0;
374 
375  int middle = (int)(size-1)/2;
376  double sigma2 = vpMath::sqr(sigma);
377  for( int i=0; i<= middle; i++)
378  {
379  filter[i] = (1./(sigma*sqrt(2.*M_PI)))*exp(-(i*i)/(2.*sigma2));
380  }
381  if (normalize) {
382  //renormalization
383  double sum=0;
384  for(int i=1; i<=middle; i++)
385  {
386  sum += 2*filter[i] ;
387  }
388  sum += filter[0];
389 
390  for(int i=0; i<=middle; i++)
391  {
392  filter[i] = filter[i]/sum;
393  }
394  }
395 }
396 
406 void vpImageFilter::getGaussianDerivativeKernel(double *filter, unsigned int size, double sigma, bool normalize)
407 {
408  if (size%2 != 1)
410  "Bad Gaussian filter size"));
411 
412  if (sigma<= 0)
413  sigma = (size-1)/6.0;
414 
415  int middle = (int)(size-1)/2;
416  double sigma2 = vpMath::sqr(sigma);
417  filter[0] = 0.;
418  for(int i=1; i<= middle; i++)
419  {
420  filter[i] = -(1./(sigma*sqrt(2.*M_PI)))*(exp(-((i+1)*(i+1))/(2.*sigma2))-exp(-((i-1)*(i-1))/(2.*sigma2)))/2.;
421  }
422 
423  if (normalize) {
424  double sum=0;
425  for(int i=1; i<=middle; i++)
426  {
427  sum += 2.*(1./(sigma*sqrt(2.*M_PI)))*exp(-(i*i)/(2.*sigma2));
428  }
429  sum += (1./(sigma*sqrt(2.*M_PI))) ;
430 
431  for(int i=1; i<=middle; i++)
432  {
433  filter[i] = filter[i]/sum;
434  }
435  }
436 }
437 
438 
440 {
441  dIx.resize(I.getHeight(),I.getWidth()) ;
442  //dIx=0;
443  for (unsigned int i=0 ; i < I.getHeight() ; i++)
444  {
445  for (unsigned int j=0 ; j < 3 ; j++)
446  {
447  dIx[i][j]=0;
448  }
449  for (unsigned int j=3 ; j < I.getWidth()-3 ; j++)
450  {
451  dIx[i][j]=vpImageFilter::derivativeFilterX(I,i,j);
452  }
453  for (unsigned int j=I.getWidth()-3 ; j < I.getWidth() ; j++)
454  {
455  dIx[i][j]=0;
456  }
457  }
458 }
459 
461 {
462  dIy.resize(I.getHeight(),I.getWidth()) ;
463  //dIy=0;
464  for (unsigned int i=0 ; i < 3 ; i++)
465  {
466  for (unsigned int j=0 ; j < I.getWidth() ; j++)
467  {
468  dIy[i][j]=0;
469  }
470  }
471  for (unsigned int i=3 ; i < I.getHeight()-3 ; i++)
472  {
473  for (unsigned int j=0 ; j < I.getWidth() ; j++)
474  {
475  dIy[i][j]=vpImageFilter::derivativeFilterY(I,i,j);
476  }
477  }
478  for (unsigned int i=I.getHeight()-3 ; i < I.getHeight() ; i++)
479  {
480  for (unsigned int j=0 ; j < I.getWidth() ; j++)
481  {
482  dIy[i][j]=0;
483  }
484  }
485 }
486 
487 void vpImageFilter::getGradX(const vpImage<unsigned char> &I, vpImage<double>& dIx, const double *filter,unsigned int size)
488 {
489  dIx.resize(I.getHeight(),I.getWidth()) ;
490  //#pragma omp parallel for
491  for (unsigned int i=0 ; i < I.getHeight() ; i++)
492  {
493  for (unsigned int j=0 ; j < (size-1)/2 ; j++)
494  {
495  dIx[i][j]=0;
496  }
497  for (unsigned int j=(size-1)/2 ; j < I.getWidth()-(size-1)/2 ; j++)
498  {
499  dIx[i][j]=vpImageFilter::derivativeFilterX(I,i,j,filter,size);
500  }
501  for (unsigned int j=I.getWidth()-(size-1)/2 ; j < I.getWidth() ; j++)
502  {
503  dIx[i][j]=0;
504  }
505  }
506 }
507 void vpImageFilter::getGradX(const vpImage<double> &I, vpImage<double>& dIx, const double *filter,unsigned int size)
508 {
509  dIx.resize(I.getHeight(),I.getWidth()) ;
510  //dIx=0;
511  for (unsigned int i=0 ; i < I.getHeight() ; i++)
512  {
513  for (unsigned int j=0 ; j < (size-1)/2 ; j++)
514  {
515  dIx[i][j]=0;
516  }
517  for (unsigned int j=(size-1)/2 ; j < I.getWidth()-(size-1)/2 ; j++)
518  {
519  dIx[i][j]=vpImageFilter::derivativeFilterX(I,i,j,filter,size);
520  }
521  for (unsigned int j=I.getWidth()-(size-1)/2 ; j < I.getWidth() ; j++)
522  {
523  dIx[i][j]=0;
524  }
525  }
526 }
527 
528 void vpImageFilter::getGradY(const vpImage<unsigned char> &I, vpImage<double>& dIy, const double *filter,unsigned int size)
529 {
530  dIy.resize(I.getHeight(),I.getWidth()) ;
531  //#pragma omp parallel for
532  for (unsigned int i=0 ; i < (size-1)/2 ; i++)
533  {
534  for (unsigned int j=0 ; j < I.getWidth() ; j++)
535  {
536  dIy[i][j]=0;
537  }
538  }
539  //#pragma omp parallel for
540  for (unsigned int i=(size-1)/2 ; i < I.getHeight()-(size-1)/2 ; i++)
541  {
542  for (unsigned int j=0 ; j < I.getWidth() ; j++)
543  {
544  dIy[i][j]=vpImageFilter::derivativeFilterY(I,i,j,filter,size);
545  }
546  }
547  //#pragma omp parallel for
548  for (unsigned int i=I.getHeight()-(size-1)/2 ; i < I.getHeight() ; i++)
549  {
550  for (unsigned int j=0 ; j < I.getWidth() ; j++)
551  {
552  dIy[i][j]=0;
553  }
554  }
555 }
556 
557 void vpImageFilter::getGradY(const vpImage<double> &I, vpImage<double>& dIy, const double *filter,unsigned int size)
558 {
559  dIy.resize(I.getHeight(),I.getWidth()) ;
560  //dIy=0;
561  for (unsigned int i=0 ; i < (size-1)/2 ; i++)
562  {
563  for (unsigned int j=0 ; j < I.getWidth() ; j++)
564  {
565  dIy[i][j]=0;
566  }
567  }
568  for (unsigned int i=(size-1)/2 ; i < I.getHeight()-(size-1)/2 ; i++)
569  {
570  for (unsigned int j=0 ; j < I.getWidth() ; j++)
571  {
572  dIy[i][j]=vpImageFilter::derivativeFilterY(I,i,j,filter,size);
573  }
574  }
575  for (unsigned int i=I.getHeight()-(size-1)/2 ; i < I.getHeight() ; i++)
576  {
577  for (unsigned int j=0 ; j < I.getWidth() ; j++)
578  {
579  dIy[i][j]=0;
580  }
581  }
582 }
583 
592 void vpImageFilter::getGradXGauss2D(const vpImage<unsigned char> &I, vpImage<double>& dIx, const double *gaussianKernel, const double *gaussianDerivativeKernel, unsigned int size)
593 {
594  vpImage<double> GIy;
595  vpImageFilter::filterY(I, GIy, gaussianKernel, size);
596  vpImageFilter::getGradX(GIy, dIx, gaussianDerivativeKernel, size);
597 }
598 
607 void vpImageFilter::getGradYGauss2D(const vpImage<unsigned char> &I, vpImage<double>& dIy, const double *gaussianKernel, const double *gaussianDerivativeKernel,unsigned int size)
608 {
609  vpImage<double> GIx;
610  vpImageFilter::filterX(I, GIx, gaussianKernel, size);
611  vpImageFilter::getGradY(GIx, dIy, gaussianDerivativeKernel, size);
612 }
613 
614 //operation pour pyramide gaussienne
616 {
618 #if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x030000)
619  cv::Mat imgsrc, imgdest;
620  vpImageConvert::convert(I, imgsrc);
621  cv::pyrDown( imgsrc, imgdest, cv::Size((int)I.getWidth()/2,(int)I.getHeight()/2));
622  vpImageConvert::convert(imgdest, GI);
623 #elif defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020408)
624  cv::Mat imgsrc, imgdest;
625  vpImageConvert::convert(I, imgsrc);
626  cv::pyrDown( imgsrc, imgdest, cvSize((int)I.getWidth()/2,(int)I.getHeight()/2));
627  vpImageConvert::convert(imgdest, GI);
628 #elif defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
629  IplImage* imgsrc = NULL;//cvCreateImage(cvGetSize(imgign), IPL_DEPTH_8U, 1);
630  IplImage* imgdest = NULL;//cvCreateImage(cvGetSize(imgign), IPL_DEPTH_8U, 1);
631  imgsrc = cvCreateImage(cvSize((int)I.getWidth(),(int)I.getHeight()), IPL_DEPTH_8U, 1);
632  imgdest = cvCreateImage(cvSize((int)I.getWidth()/2,(int)I.getHeight()/2), IPL_DEPTH_8U, 1);
633  vpImageConvert::convert(I,imgsrc);
634  cvPyrDown( imgsrc, imgdest);
635  vpImageConvert::convert(imgdest,GI);
636 
637  cvReleaseImage(&imgsrc);
638  cvReleaseImage(&imgdest);
639  //vpImage<unsigned char> sGI;sGI=GI;
640 
641 #else
644 #endif
645 }
646 
648 {
649 #if 0
650  GI.resize(I.getHeight(),(int)((I.getWidth()+1.)/2.)) ;
651  for (unsigned int i=0 ; i < I.getHeight() ; i++)
652  {
653  GI[i][0]=I[i][0];
654  for (unsigned int j=1 ; j < ((I.getWidth()+1.)/2.)-1 ; j++)
655  {
656  GI[i][j]=vpImageFilter::filterGaussXPyramidal(I,i,2*j);
657  }
658  GI[i][(int)((I.getWidth()+1.)/2.)-1]=I[i][2*((int)((I.getWidth()+1.)/2.)-1)];
659  }
660 #else
661  unsigned int w = I.getWidth()/2;
662 
663  GI.resize(I.getHeight(), w) ;
664  for (unsigned int i=0 ; i < I.getHeight() ; i++)
665  {
666  GI[i][0]=I[i][0];
667  for (unsigned int j=1 ; j < w-1 ; j++)
668  {
669  GI[i][j]=vpImageFilter::filterGaussXPyramidal(I,i,2*j);
670  }
671  GI[i][w-1]=I[i][2*w-1];
672  }
673 
674 #endif
675 }
677 {
678 
679 #ifdef ORIG
680  GI.resize((int)((I.getHeight()+1.)/2.),I.getWidth()) ;
681  for (unsigned int j=0 ; j < I.getWidth() ; j++)
682  {
683  GI[0][j]=I[0][j];
684  for (unsigned int i=1 ; i < ((I.getHeight()+1.)/2.)-1 ; i++)
685  {
686  GI[i][j]=vpImageFilter::filterGaussYPyramidal(I,2*i,j);
687  }
688  GI[(int)((I.getHeight()+1.)/2.)-1][j]=I[2*((int)((I.getHeight()+1.)/2.)-1)][j];
689  }
690 
691 #else
692  unsigned int h = I.getHeight()/2;
693 
694  GI.resize(h, I.getWidth()) ;
695  for (unsigned int j=0 ; j < I.getWidth() ; j++)
696  {
697  GI[0][j]=I[0][j];
698  for (unsigned int i=1 ; i < h-1 ; i++)
699  {
700  GI[i][j]=vpImageFilter::filterGaussYPyramidal(I,2*i,j);
701  }
702  GI[h-1][j]=I[2*h-1][j];
703  }
704 #endif
705 }
706 
707 
static void getGaussPyramidal(const vpImage< unsigned char > &I, vpImage< unsigned char > &GI)
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:92
static double filterXLeftBorder(const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
unsigned int getWidth() const
Definition: vpImage.h:161
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
static void getGradX(const vpImage< unsigned char > &I, vpImage< double > &dIx)
static void getGaussYPyramidal(const vpImage< unsigned char > &I, vpImage< unsigned char > &GI)
static void getGradY(const vpImage< unsigned char > &I, vpImage< double > &dIy)
static double derivativeFilterY(const vpImage< T > &I, const unsigned int r, const unsigned int c)
static void getGaussianKernel(double *filter, unsigned int size, double sigma=0., bool normalize=true)
static unsigned char filterGaussYPyramidal(const vpImage< unsigned char > &I, unsigned int i, unsigned int j)
static void getGradYGauss2D(const vpImage< unsigned char > &I, vpImage< double > &dIy, const double *gaussianKernel, const double *gaussianDerivativeKernel, unsigned int size)
Error that can be emited by the vpImage class and its derivates.
static void getGradXGauss2D(const vpImage< unsigned char > &I, vpImage< double > &dIx, const double *gaussianKernel, const double *gaussianDerivativeKernel, unsigned int size)
static void filterY(const vpImage< unsigned char > &I, vpImage< double > &dIx, const double *filter, unsigned int size)
static void getGaussXPyramidal(const vpImage< unsigned char > &I, vpImage< unsigned char > &GI)
static void filter(const vpImage< double > &I, vpImage< double > &Iu, vpImage< double > &Iv, const vpMatrix &M)
static double sqr(double x)
Definition: vpMath.h:110
static void gaussianBlur(const vpImage< unsigned char > &I, vpImage< double > &GI, unsigned int size=7, double sigma=0., bool normalize=true)
static double filterYTopBorder(const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static double filterXRightBorder(const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
void resize(const unsigned int h, const unsigned int w)
set the size of the image without initializing it.
Definition: vpImage.h:616
unsigned int getRows() const
Return the number of rows of the 2D array.
Definition: vpArray2D.h:152
void destroy()
destructor
Definition: vpImage.h:672
static void filterX(const vpImage< unsigned char > &I, vpImage< double > &dIx, const double *filter, unsigned int size)
static void getGaussianDerivativeKernel(double *filter, unsigned int size, double sigma=0., bool normalize=true)
static double filterYBottomBorder(const vpImage< unsigned char > &I, unsigned int r, unsigned int c, const double *filter, unsigned int size)
static unsigned char filterGaussXPyramidal(const vpImage< unsigned char > &I, unsigned int i, unsigned int j)
unsigned int getHeight() const
Definition: vpImage.h:152
static void canny(const vpImage< unsigned char > &I, vpImage< unsigned char > &Ic, const unsigned int gaussianFilterSize, const double thresholdCanny, const unsigned int apertureSobel)
static double derivativeFilterX(const vpImage< T > &I, const unsigned int r, const unsigned int c)
Definition: vpImageFilter.h:87