**Sobel**

This website uses cookies. By using this site, you consent to the use of cookies. For more information, please take a look at our Privacy Policy.

Use the extended Sobel operator to calculate first, second, third, or mixed image differences.

Use the extended Sobel operator to calculate first, second, third, or mixed image differences.

void cvSobel( const CvArr* src, CvArr* dst, int xorder, int yorder, int aperture_size=3 );

*src

*Enter the image.

*dst

*Output image.

*xorder

*Order of difference in x direction

*yorder

*Difference order in y direction

*aperture_size

The size of the extended Sobel core must be 1, 3, 5 or 7. Except for the size of 1, in other cases, the aperture_size × aperture_size separable kernel will be used to calculate the difference. For aperture_size=1, use 3x1 or 1x3 kernel (no Gaussian smoothing operation). There is a special variable CV_SCHARR (=-1), corresponding to the 3x3 Scharr filter, which can give more accurate results than the 3x3 Sobel filter.

*Transpose to the x-direction or the matrix to the y-direction.

The function cvSobel calculates the image difference by convolving the image with the corresponding kernel

Since the Sobel operator combines Gaussian smoothing and differentiation, the result is more or less robust to noise. Usually, the function call uses the following parameters (xorder=1, yorder=0, aperture_size=3) or (xorder=0, yorder=1, aperture_size=3) to calculate the first-order x- or y-direction image difference.

Since this function does not perform image scale conversion, compared with the input image (array), the elements of the output image (array) usually have a larger absolute value (Translator's Note: the bit depth of the pixel). To prevent overflow, when the input image is 8-bit, the output image is required to be 16-bit. Of course, you can use the function cvConvertScale or cvConvertScaleAbs to convert the operation result (dst) to 8 bits. In addition to 8-bit images, the function also accepts 32-bit floating-point images. All input and output images must be single-channel and have the same image size or ROI size.

Support