Wednesday, May 28, 2008

edge detection in OpenCv(sobel,laplace,canny)

void cvLaplace( const CvArr* src, CvArr* dst, int aperture_size=3 );
void cvCanny( const CvArr* image, CvArr* edges, double threshold1,double threshold2, int aperture_size=3 );
void cvSobel( const CvArr* src, CvArr* dst, int xorder, int yorder, int aperture_size=3 );

The important point is that the src image in three above funtctions must be 1 channel (gray). So you need use cvCvtColor() to change the image from BGR to Gray.
The depth of dst image in cvCanny and cvSobel can be 8u and 1 channel.But the output image of cvLaplace can't be 8u too.. It just can use 16s or 32f. I use 16s here, and it can work very well..I dont know why....

No comments: