edge — Edge detection
E = edge(Img)
E = edge(Img, <named_args>)
E = edge(Img, method)
E = edge(Img, method, thresh)
E = edge(Img, method, thresh, direction)
E = edge(Img, method, thresh, direction, sigma)
E
, will have the un-thresholded gradient image.
The function edge performs edge detection on a grayscale intensity image. The user may set the method, the threshold level and the direction of the edge detection.
Img
, using the sobel gradient estimator, 0.5 threshold level and in both horizontal and vertical directions.
The other parameters are optional and non-positional. That is, they may be passed to the function by their name. The following example illustrates this.
initial_dir = PWD; chdir (SIPDIR + 'images'); Img = imread('tru.jpg'); Img = im2gray(Img); xbasc() imshow(Img); e = edge(Img); // sobel, thresh = 0.5 xbasc() imshow(e,2) e = edge(Img,'prewitt'); // thresh = 0.5 xbasc() imshow(e,2) e = edge(Img,'fftderiv', 0.4); // FFT gradient method; 0.4 threshold xbasc() imshow(e,[]) // It is useful to thin the edges, eliminating redundant pixels: e = thin(e); xbasc() imshow(e,[]) e = edge(Img,'fftderiv',sigma=3,thresh=-1); // thicker edges, no threshold xbasc() imshow(e,[]) e = edge(Img,thresh=-1); xbasc() imshow(e,[]) chdir(initial_dir);