cannycv

Detects edges of an image handle with the Canny algorithm.

Syntax

R = cannycv(handle, threshold1, threshold2...)

R = cannycv(handle, threshold1, threshold2, size, gradient)

Inputs

handle
Handle of a single channel gray scale image.
Type: integer
threshold1
Lower edge detection threshold.
Type: scalar
threshold2
Upper edge detection threshold.
Type: scalar
size
Optional aperture size for the Sobel operator. Default value is 3
Type: integer
gradient
Optional flag for gradient. Default value is false, indicating that default gradient will be used.
Type: logical

Outputs

R
Handle of the output image.
Type: integer

Example

Detect the edges with the Canny algorithm:
handle = imreadcv('bird3.jpg', 0);
R = cannycv(handle, 50, 100);
Figure 1. Input image


Figure 2. Output image


Detect the edges and dilate the output:
imgoriginal = imreadcv('Dog.jpg',1);
figure(1);
imshowcv(imgoriginal);

%Conver the image to gray scale
img = cvtcolorcv(imgoriginal, 6);

edges = cannycv(img, 70, 180);
dilatededges = dilatecv(edges, []);

figure(2);
imshowcv(erodededges);
Figure 3. Input image


Figure 4. Output image