ViSP  2.10.0
vpImageFilter.cpp
1 /****************************************************************************
2  *
3  * $Id: vpImageFilter.cpp 5200 2015-01-24 08:34:54Z 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  *
34  * Description:
35  * Various image tools, convolution, ...
36  *
37  * Authors:
38  * Eric Marchand
39  *
40  *****************************************************************************/
41 
42 #include <visp/vpImageFilter.h>
43 #include <visp/vpImageConvert.h>
44 #if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020408)
45 # include <opencv2/imgproc/imgproc.hpp>
46 #elif defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020101)
47 # include <opencv2/imgproc/imgproc_c.h>
48 #elif defined(VISP_HAVE_OPENCV)
49 # include <cv.h>
50 #endif
51 
60 void
62  vpImage<double>& If,
63  const vpMatrix& M)
64 {
65 
66  unsigned int size = M.getRows() ;
67  unsigned int half_size = size/2 ;
68 
69  If.resize(I.getHeight(),I.getWidth()) ;
70 
71  If = 0 ;
72 
73  for (unsigned int i=half_size ; i < I.getHeight()-half_size ; i++)
74  {
75  for (unsigned int j=half_size ; j < I.getWidth()-half_size ; j++)
76  {
77  double conv_x = 0 ;
78 
79  for(unsigned int a = 0 ; a < size ; a++ )
80  for(unsigned int b = 0 ; b < size ; b++ )
81  {
82  double val = I[i-half_size+a][j-half_size+b] ;
83  conv_x += M[a][b] * val ;
84  }
85  If[i][j] = conv_x ;
86  }
87  }
88 
89 }
90 
100 void
102  vpImage<double>& Iu,
103  vpImage<double>& Iv,
104  const vpMatrix& M)
105 {
106 
107  unsigned int size = M.getRows() ;
108  unsigned int half_size = size/2 ;
109 
110  Iu.resize(I.getHeight(),I.getWidth()) ;
111  Iv.resize(I.getHeight(),I.getWidth()) ;
112 
113  Iu = 0 ;
114  Iv = 0 ;
115  for (unsigned int v=half_size ; v < I.getHeight()-half_size ; v++)
116  {
117  for (unsigned int u=half_size ; u < I.getWidth()-half_size ; u++)
118  {
119  double conv_u = 0 ;
120  double conv_v = 0 ;
121 
122  for(unsigned int a = 0 ; a < size ; a++ )
123  for(unsigned int b = 0 ; b < size ; b++ )
124  {
125  double val = I[v-half_size+a][u-half_size+b] ;
126  conv_u += M[a][b] * val ;
127  conv_v += M[b][a] * val ;
128  }
129  Iu[v][u] = conv_u ;
130  Iv[v][u] = conv_v ;
131  }
132  }
133 
134 }
135 
136 #if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
137 
177 void
180  const unsigned int gaussianFilterSize,
181  const double thresholdCanny,
182  const unsigned int apertureSobel)
183 {
184 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
185  IplImage* img_ipl = NULL;
186  vpImageConvert::convert(Isrc, img_ipl);
187  IplImage* edges_ipl;
188  edges_ipl = cvCreateImage(cvSize(img_ipl->width, img_ipl->height), img_ipl->depth, img_ipl->nChannels);
189 
190  cvSmooth(img_ipl, img_ipl, CV_GAUSSIAN, (int)gaussianFilterSize, (int)gaussianFilterSize, 0, 0);
191  cvCanny(img_ipl, edges_ipl, thresholdCanny, thresholdCanny, (int)apertureSobel);
192 
193  vpImageConvert::convert(edges_ipl, Ires);
194  cvReleaseImage(&img_ipl);
195  cvReleaseImage(&edges_ipl);
196 #else
197  cv::Mat img_cvmat, edges_cvmat;
198  vpImageConvert::convert(Isrc, img_cvmat);
199  cv::GaussianBlur(img_cvmat, img_cvmat, cv::Size((int)gaussianFilterSize, (int)gaussianFilterSize), 0, 0);
200  cv::Canny(img_cvmat, edges_cvmat, thresholdCanny, thresholdCanny, (int)apertureSobel);
201  vpImageConvert::convert(edges_cvmat, Ires);
202 #endif
203 }
204 #endif
205 
209 void vpImageFilter::filter(const vpImage<unsigned char> &I, vpImage<double>& GI, const double *filter,unsigned int size)
210 {
211  vpImage<double> GIx ;
212  filterX(I, GIx,filter,size);
213  filterY(GIx, GI,filter,size);
214  GIx.destroy();
215 }
216 
220 void vpImageFilter::filter(const vpImage<double> &I, vpImage<double>& GI, const double *filter,unsigned int size)
221 {
222  vpImage<double> GIx ;
223  filterX(I, GIx,filter,size);
224  filterY(GIx, GI,filter,size);
225  GIx.destroy();
226 }
227 
228 void vpImageFilter::filterX(const vpImage<unsigned char> &I, vpImage<double>& dIx, const double *filter,unsigned int size)
229 {
230  dIx.resize(I.getHeight(),I.getWidth()) ;
231  for (unsigned int i=0 ; i < I.getHeight() ; i++)
232  {
233  for (unsigned int j=0 ; j < (size-1)/2 ; j++)
234  {
235  dIx[i][j]=vpImageFilter::filterXLeftBorder(I,i,j,filter,size);
236  //dIx[i][j]=0;
237  }
238  for (unsigned int j=(size-1)/2 ; j < I.getWidth()-(size-1)/2 ; j++)
239  {
240  dIx[i][j]=vpImageFilter::filterX(I,i,j,filter,size);
241  }
242  for (unsigned int j=I.getWidth()-(size-1)/2 ; j < I.getWidth() ; j++)
243  {
244  dIx[i][j]=vpImageFilter::filterXRightBorder(I,i,j,filter,size);
245  //dIx[i][j]=0;
246  }
247  }
248 }
249 void vpImageFilter::filterX(const vpImage<double> &I, vpImage<double>& dIx, const double *filter,unsigned int size)
250 {
251  dIx.resize(I.getHeight(),I.getWidth()) ;
252  for (unsigned int i=0 ; i < I.getHeight() ; i++)
253  {
254  for (unsigned int j=0 ; j < (size-1)/2 ; j++)
255  {
256  dIx[i][j]=vpImageFilter::filterXLeftBorder(I,i,j,filter,size);
257  //dIx[i][j]=0;
258  }
259  for (unsigned int j=(size-1)/2 ; j < I.getWidth()-(size-1)/2 ; j++)
260  {
261  dIx[i][j]=vpImageFilter::filterX(I,i,j,filter,size);
262  }
263  for (unsigned int j=I.getWidth()-(size-1)/2 ; j < I.getWidth() ; j++)
264  {
265  dIx[i][j]=vpImageFilter::filterXRightBorder(I,i,j,filter,size);
266  //dIx[i][j]=0;
267  }
268  }
269 }
270 void vpImageFilter::filterY(const vpImage<unsigned char> &I, vpImage<double>& dIy, const double *filter,unsigned int size)
271 {
272  dIy.resize(I.getHeight(),I.getWidth()) ;
273  for (unsigned int i=0 ; i < (size-1)/2 ; i++)
274  {
275  for (unsigned int j=0 ; j < I.getWidth() ; j++)
276  {
277  dIy[i][j]=vpImageFilter::filterYTopBorder(I,i,j,filter,size);
278  }
279  }
280  for (unsigned int i=(size-1)/2 ; i < I.getHeight()-(size-1)/2 ; i++)
281  {
282  for (unsigned int j=0 ; j < I.getWidth() ; j++)
283  {
284  dIy[i][j]=vpImageFilter::filterY(I,i,j,filter,size);
285  }
286  }
287  for (unsigned int i=I.getHeight()-(size-1)/2 ; i < I.getHeight() ; i++)
288  {
289  for (unsigned int j=0 ; j < I.getWidth() ; j++)
290  {
291  dIy[i][j]=vpImageFilter::filterYBottomBorder(I,i,j,filter,size);
292  }
293  }
294 }
295 void vpImageFilter::filterY(const vpImage<double> &I, vpImage<double>& dIy, const double *filter,unsigned int size)
296 {
297  dIy.resize(I.getHeight(),I.getWidth()) ;
298  for (unsigned int i=0 ; i < (size-1)/2 ; i++)
299  {
300  for (unsigned int j=0 ; j < I.getWidth() ; j++)
301  {
302  dIy[i][j]=vpImageFilter::filterYTopBorder(I,i,j,filter,size);
303  }
304  }
305  for (unsigned int i=(size-1)/2 ; i < I.getHeight()-(size-1)/2 ; i++)
306  {
307  for (unsigned int j=0 ; j < I.getWidth() ; j++)
308  {
309  dIy[i][j]=vpImageFilter::filterY(I,i,j,filter,size);
310  }
311  }
312  for (unsigned int i=I.getHeight()-(size-1)/2 ; i < I.getHeight() ; i++)
313  {
314  for (unsigned int j=0 ; j < I.getWidth() ; j++)
315  {
316  dIy[i][j]=vpImageFilter::filterYBottomBorder(I,i,j,filter,size);
317  }
318  }
319 }
320 
330 void vpImageFilter::gaussianBlur(const vpImage<unsigned char> &I, vpImage<double>& GI, unsigned int size, double sigma, bool normalize)
331 {
332  double *fg=new double[(size+1)/2] ;
333  vpImageFilter::getGaussianKernel(fg, size, sigma, normalize) ;
334  vpImage<double> GIx ;
335  vpImageFilter::filterX(I, GIx,fg,size);
336  vpImageFilter::filterY(GIx, GI,fg,size);
337  GIx.destroy();
338  delete[] fg;
339 }
340 
350 void vpImageFilter::getGaussianKernel(double *filter, unsigned int size, double sigma, bool normalize)
351 {
352  if (size%2 != 1)
354  "Bad Gaussian filter size"));
355 
356  if (sigma<= 0)
357  sigma = (size-1)/6.0;
358 
359  int middle = (int)(size-1)/2;
360  double sigma2 = vpMath::sqr(sigma);
361  for( int i=0; i<= middle; i++)
362  {
363  filter[i] = (1./(sigma*sqrt(2.*M_PI)))*exp(-(i*i)/(2.*sigma2));
364  }
365  if (normalize) {
366  //renormalization
367  double sum=0;
368  for(int i=1; i<=middle; i++)
369  {
370  sum += 2*filter[i] ;
371  }
372  sum += filter[0];
373 
374  for(int i=0; i<=middle; i++)
375  {
376  filter[i] = filter[i]/sum;
377  }
378  }
379 }
380 
390 void vpImageFilter::getGaussianDerivativeKernel(double *filter, unsigned int size, double sigma, bool normalize)
391 {
392  if (size%2 != 1)
394  "Bad Gaussian filter size"));
395 
396  if (sigma<= 0)
397  sigma = (size-1)/6.0;
398 
399  int middle = (int)(size-1)/2;
400  double sigma2 = vpMath::sqr(sigma);
401  filter[0] = 0.;
402  for(int i=1; i<= middle; i++)
403  {
404  filter[i] = -(1./(sigma*sqrt(2.*M_PI)))*(exp(-((i+1)*(i+1))/(2.*sigma2))-exp(-((i-1)*(i-1))/(2.*sigma2)))/2.;
405  }
406 
407  if (normalize) {
408  double sum=0;
409  for(int i=1; i<=middle; i++)
410  {
411  sum += 2.*(1./(sigma*sqrt(2.*M_PI)))*exp(-(i*i)/(2.*sigma2));
412  }
413  sum += (1./(sigma*sqrt(2.*M_PI))) ;
414 
415  for(int i=1; i<=middle; i++)
416  {
417  filter[i] = filter[i]/sum;
418  }
419  }
420 }
421 
422 
424 {
425  dIx.resize(I.getHeight(),I.getWidth()) ;
426  //dIx=0;
427  for (unsigned int i=0 ; i < I.getHeight() ; i++)
428  {
429  for (unsigned int j=0 ; j < 3 ; j++)
430  {
431  dIx[i][j]=0;
432  }
433  for (unsigned int j=3 ; j < I.getWidth()-3 ; j++)
434  {
435  dIx[i][j]=vpImageFilter::derivativeFilterX(I,i,j);
436  }
437  for (unsigned int j=I.getWidth()-3 ; j < I.getWidth() ; j++)
438  {
439  dIx[i][j]=0;
440  }
441  }
442 }
443 
445 {
446  dIy.resize(I.getHeight(),I.getWidth()) ;
447  //dIy=0;
448  for (unsigned int i=0 ; i < 3 ; i++)
449  {
450  for (unsigned int j=0 ; j < I.getWidth() ; j++)
451  {
452  dIy[i][j]=0;
453  }
454  }
455  for (unsigned int i=3 ; i < I.getHeight()-3 ; i++)
456  {
457  for (unsigned int j=0 ; j < I.getWidth() ; j++)
458  {
459  dIy[i][j]=vpImageFilter::derivativeFilterY(I,i,j);
460  }
461  }
462  for (unsigned int i=I.getHeight()-3 ; i < I.getHeight() ; i++)
463  {
464  for (unsigned int j=0 ; j < I.getWidth() ; j++)
465  {
466  dIy[i][j]=0;
467  }
468  }
469 }
470 
471 void vpImageFilter::getGradX(const vpImage<unsigned char> &I, vpImage<double>& dIx, const double *filter,unsigned int size)
472 {
473  dIx.resize(I.getHeight(),I.getWidth()) ;
474  //#pragma omp parallel for
475  for (unsigned int i=0 ; i < I.getHeight() ; i++)
476  {
477  for (unsigned int j=0 ; j < (size-1)/2 ; j++)
478  {
479  dIx[i][j]=0;
480  }
481  for (unsigned int j=(size-1)/2 ; j < I.getWidth()-(size-1)/2 ; j++)
482  {
483  dIx[i][j]=vpImageFilter::derivativeFilterX(I,i,j,filter,size);
484  }
485  for (unsigned int j=I.getWidth()-(size-1)/2 ; j < I.getWidth() ; j++)
486  {
487  dIx[i][j]=0;
488  }
489  }
490 }
491 void vpImageFilter::getGradX(const vpImage<double> &I, vpImage<double>& dIx, const double *filter,unsigned int size)
492 {
493  dIx.resize(I.getHeight(),I.getWidth()) ;
494  //dIx=0;
495  for (unsigned int i=0 ; i < I.getHeight() ; i++)
496  {
497  for (unsigned int j=0 ; j < (size-1)/2 ; j++)
498  {
499  dIx[i][j]=0;
500  }
501  for (unsigned int j=(size-1)/2 ; j < I.getWidth()-(size-1)/2 ; j++)
502  {
503  dIx[i][j]=vpImageFilter::derivativeFilterX(I,i,j,filter,size);
504  }
505  for (unsigned int j=I.getWidth()-(size-1)/2 ; j < I.getWidth() ; j++)
506  {
507  dIx[i][j]=0;
508  }
509  }
510 }
511 
512 void vpImageFilter::getGradY(const vpImage<unsigned char> &I, vpImage<double>& dIy, const double *filter,unsigned int size)
513 {
514  dIy.resize(I.getHeight(),I.getWidth()) ;
515  //#pragma omp parallel for
516  for (unsigned int i=0 ; i < (size-1)/2 ; i++)
517  {
518  for (unsigned int j=0 ; j < I.getWidth() ; j++)
519  {
520  dIy[i][j]=0;
521  }
522  }
523  //#pragma omp parallel for
524  for (unsigned int i=(size-1)/2 ; i < I.getHeight()-(size-1)/2 ; i++)
525  {
526  for (unsigned int j=0 ; j < I.getWidth() ; j++)
527  {
528  dIy[i][j]=vpImageFilter::derivativeFilterY(I,i,j,filter,size);
529  }
530  }
531  //#pragma omp parallel for
532  for (unsigned int i=I.getHeight()-(size-1)/2 ; i < I.getHeight() ; i++)
533  {
534  for (unsigned int j=0 ; j < I.getWidth() ; j++)
535  {
536  dIy[i][j]=0;
537  }
538  }
539 }
540 
541 void vpImageFilter::getGradY(const vpImage<double> &I, vpImage<double>& dIy, const double *filter,unsigned int size)
542 {
543  dIy.resize(I.getHeight(),I.getWidth()) ;
544  //dIy=0;
545  for (unsigned int i=0 ; i < (size-1)/2 ; i++)
546  {
547  for (unsigned int j=0 ; j < I.getWidth() ; j++)
548  {
549  dIy[i][j]=0;
550  }
551  }
552  for (unsigned int i=(size-1)/2 ; i < I.getHeight()-(size-1)/2 ; i++)
553  {
554  for (unsigned int j=0 ; j < I.getWidth() ; j++)
555  {
556  dIy[i][j]=vpImageFilter::derivativeFilterY(I,i,j,filter,size);
557  }
558  }
559  for (unsigned int i=I.getHeight()-(size-1)/2 ; i < I.getHeight() ; i++)
560  {
561  for (unsigned int j=0 ; j < I.getWidth() ; j++)
562  {
563  dIy[i][j]=0;
564  }
565  }
566 }
567 
576 void vpImageFilter::getGradXGauss2D(const vpImage<unsigned char> &I, vpImage<double>& dIx, const double *gaussianKernel, const double *gaussianDerivativeKernel, unsigned int size)
577 {
578  vpImage<double> GIy;
579  vpImageFilter::filterY(I, GIy, gaussianKernel, size);
580  vpImageFilter::getGradX(GIy, dIx, gaussianDerivativeKernel, size);
581 }
582 
591 void vpImageFilter::getGradYGauss2D(const vpImage<unsigned char> &I, vpImage<double>& dIy, const double *gaussianKernel, const double *gaussianDerivativeKernel,unsigned int size)
592 {
593  vpImage<double> GIx;
594  vpImageFilter::filterX(I, GIx, gaussianKernel, size);
595  vpImageFilter::getGradY(GIx, dIy, gaussianDerivativeKernel, size);
596 }
597 
598 //operation pour pyramide gaussienne
600 {
602 #if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x030000)
603  cv::Mat imgsrc, imgdest;
604  vpImageConvert::convert(I, imgsrc);
605  cv::pyrDown( imgsrc, imgdest, cv::Size((int)I.getWidth()/2,(int)I.getHeight()/2));
606  vpImageConvert::convert(imgdest, GI);
607 #elif defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020408)
608  cv::Mat imgsrc, imgdest;
609  vpImageConvert::convert(I, imgsrc);
610  cv::pyrDown( imgsrc, imgdest, cvSize((int)I.getWidth()/2,(int)I.getHeight()/2));
611  vpImageConvert::convert(imgdest, GI);
612 #elif defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
613  IplImage* imgsrc = NULL;//cvCreateImage(cvGetSize(imgign), IPL_DEPTH_8U, 1);
614  IplImage* imgdest = NULL;//cvCreateImage(cvGetSize(imgign), IPL_DEPTH_8U, 1);
615  imgsrc = cvCreateImage(cvSize((int)I.getWidth(),(int)I.getHeight()), IPL_DEPTH_8U, 1);
616  imgdest = cvCreateImage(cvSize((int)I.getWidth()/2,(int)I.getHeight()/2), IPL_DEPTH_8U, 1);
617  vpImageConvert::convert(I,imgsrc);
618  cvPyrDown( imgsrc, imgdest);
619  vpImageConvert::convert(imgdest,GI);
620 
621  cvReleaseImage(&imgsrc);
622  cvReleaseImage(&imgdest);
623  //vpImage<unsigned char> sGI;sGI=GI;
624 
625 #else
628 #endif
629 }
630 
632 {
633 #if 0
634  GI.resize(I.getHeight(),(int)((I.getWidth()+1.)/2.)) ;
635  for (unsigned int i=0 ; i < I.getHeight() ; i++)
636  {
637  GI[i][0]=I[i][0];
638  for (unsigned int j=1 ; j < ((I.getWidth()+1.)/2.)-1 ; j++)
639  {
640  GI[i][j]=vpImageFilter::filterGaussXPyramidal(I,i,2*j);
641  }
642  GI[i][(int)((I.getWidth()+1.)/2.)-1]=I[i][2*((int)((I.getWidth()+1.)/2.)-1)];
643  }
644 #else
645  unsigned int w = I.getWidth()/2;
646 
647  GI.resize(I.getHeight(), w) ;
648  for (unsigned int i=0 ; i < I.getHeight() ; i++)
649  {
650  GI[i][0]=I[i][0];
651  for (unsigned int j=1 ; j < w-1 ; j++)
652  {
653  GI[i][j]=vpImageFilter::filterGaussXPyramidal(I,i,2*j);
654  }
655  GI[i][w-1]=I[i][2*w-1];
656  }
657 
658 #endif
659 }
661 {
662 
663 #ifdef ORIG
664  GI.resize((int)((I.getHeight()+1.)/2.),I.getWidth()) ;
665  for (unsigned int j=0 ; j < I.getWidth() ; j++)
666  {
667  GI[0][j]=I[0][j];
668  for (unsigned int i=1 ; i < ((I.getHeight()+1.)/2.)-1 ; i++)
669  {
670  GI[i][j]=vpImageFilter::filterGaussYPyramidal(I,2*i,j);
671  }
672  GI[(int)((I.getHeight()+1.)/2.)-1][j]=I[2*((int)((I.getHeight()+1.)/2.)-1)][j];
673  }
674 
675 #else
676  unsigned int h = I.getHeight()/2;
677 
678  GI.resize(h, I.getWidth()) ;
679  for (unsigned int j=0 ; j < I.getWidth() ; j++)
680  {
681  GI[0][j]=I[0][j];
682  for (unsigned int i=1 ; i < h-1 ; i++)
683  {
684  GI[i][j]=vpImageFilter::filterGaussYPyramidal(I,2*i,j);
685  }
686  GI[h-1][j]=I[2*h-1][j];
687  }
688 #endif
689 }
690 
691 
static void getGaussPyramidal(const vpImage< unsigned char > &I, vpImage< unsigned char > &GI)
Definition of the vpMatrix class.
Definition: vpMatrix.h:98
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:106
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:536
void destroy()
destructor
Definition: vpImage.h:592
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)
unsigned int getRows() const
Return the number of rows of the matrix.
Definition: vpMatrix.h:161
static double derivativeFilterX(const vpImage< T > &I, const unsigned int r, const unsigned int c)
Definition: vpImageFilter.h:91