42 #include <visp/vpImageFilter.h>
43 #include <visp/vpImageConvert.h>
44 #if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020101)
45 #include <opencv2/imgproc/imgproc_c.h>
46 #elif defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
64 unsigned int size = M.
getRows() ;
65 unsigned int half_size = size/2 ;
71 for (
unsigned int i=half_size ; i < I.
getHeight()-half_size ; i++)
73 for (
unsigned int j=half_size ; j < I.
getWidth()-half_size ; j++)
77 for(
unsigned int a = 0 ; a < size ; a++ )
78 for(
unsigned int b = 0 ; b < size ; b++ )
80 double val = I[i-half_size+a][j-half_size+b] ;
81 conv_x += M[a][b] * val ;
105 unsigned int size = M.
getRows() ;
106 unsigned int half_size = size/2 ;
113 for (
unsigned int v=half_size ; v < I.
getHeight()-half_size ; v++)
115 for (
unsigned int u=half_size ; u < I.
getWidth()-half_size ; u++)
120 for(
unsigned int a = 0 ; a < size ; a++ )
121 for(
unsigned int b = 0 ; b < size ; b++ )
123 double val = I[v-half_size+a][u-half_size+b] ;
124 conv_u += M[a][b] * val ;
125 conv_v += M[b][a] * val ;
134 #if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
178 const unsigned int gaussianFilterSize,
179 const double thresholdCanny,
180 const unsigned int apertureSobel)
182 IplImage* img_ipl = NULL;
185 edges_ipl = cvCreateImage(cvSize(img_ipl->width, img_ipl->height), img_ipl->depth, img_ipl->nChannels);
187 cvSmooth(img_ipl, img_ipl, CV_GAUSSIAN, (
int)gaussianFilterSize, (
int)gaussianFilterSize, 0, 0);
188 cvCanny(img_ipl, edges_ipl, thresholdCanny, thresholdCanny, (
int)apertureSobel);
191 cvReleaseImage(&img_ipl);
192 cvReleaseImage(&edges_ipl);
Definition of the vpMatrix class.
unsigned int getWidth() const
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
void resize(const unsigned int height, const unsigned int width)
set the size of the image
static void filter(const vpImage< double > &I, vpImage< double > &Iu, vpImage< double > &Iv, const vpMatrix &M)
unsigned int getHeight() const
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.