sobelcv

Calculates the derivatives using the Sobel operator.

Syntax

R = sobelcv(handle, depth, dx, dy...)

R = sobelcv(handle, depth, dx, dy, ksize, scale, delta, type)

Inputs

handle
Handle of an image.
Type: integer
depth
Depth of R. A value of -1 will result in the same depth as handle. Valid values are:
-1
Same depth as input.
0
8-bit unsigned integer [CV_8U]
2
16-bit unsigned integer [CV_16U]
3
16-bit signed integer [CV_16S]
5
32-bit floating point number [CV_32F]
6
64-bit floating point number [CV_64F]
Type: integer
dx
Order of derivative x, must be 0 or 1.
Type: integer
dy
Order of derivative y, must be 0 or 1.
Type: integer
ksize
Optional parameter specifying the size of extended Sobel kernel. Defaults to 3, valid values are 1,3,5 or 7.
Type: integer
scale
Optional parameter specifying the scale factor. Defaults to 1.
Type: scalar
delta
Optional value to be added to each pixel of R. Default value is 0.
Type: scalar
type
Optional parameter specifying the pixel extrapolation method. Default value is 4. Valid values are:
0
Type cv::BORDER_CONSTANT.
1
Type cv::BORDER_REPLICATE
2
Type cv::BORDER_REFLECT
4
Type cv::BORDER_DEFAULT - default
16
Type cv::BORDER_ISOLATED
Type: integer

Outputs

R
Handle of the resulting image.
Type: integer

Example

Use the Sobel operator on an image with default parameters:

handle = imreadcv('owl.jpg', 0);
depth = -1;
dx = 1;
dy = 0;
R = sobelcv(handle, depth, dx, dy);


Figure 1. Input image


Figure 2. Output image