edge parameter calculation

3 vues (au cours des 30 derniers jours)
bhargavi
bhargavi le 3 Mar 2011
how to use the Sobel edge detection method to detect image edges (IE) is obtained by filtering an input image with two convolution kernels concomitantly, one to detect changes in vertical contrast (hx) and the other to detect horizontal contrast (hy ), shown in equation (1). Image output (IE ) is obtained by calculating the gradient magnitude of each pixel, as shown in equation (2). Subsequently, the edge parameter (E) is calculated, whereby E (r, c) is increased by one each time when IE (x, y) = ‘1’ in a supervised block, as shown in equation (3) Hx = ? ? ? ? ? ? ? ? ? ? ? ? ? 1 0 1 2 0 2 1 0 1 ,Hy = ? ? ? ? ? ? ? ? ? ? ? ? ? 1 2 1 0 0 0 1 2 1 (1) I (x, y) I 2 (x, y) I 2 (x, y) E x y = + (2) ? ? = == x y B E r c IEP ( , ) ( , ) ( 1) (3)

Réponses (1)

David Young
David Young le 3 Mar 2011
If you have the Image Processing Toolbox, the Sobel edge detector is available as one of the methods implemented in the EDGE function. See
doc edge
  4 commentaires
bhargavi
bhargavi le 23 Mar 2011
bw = edge(double(i), 'sobel'); i have tried this also
unction EDGE expected its first input, I, to be two-dimensional.
Error in ==> edge>parse_inputs at 564
iptcheckinput(I,{'numeric'},{'nonsparse','2d'},mfilename,'I',1);
Error in ==> edge at 197
[a,method,thresh,sigma,thinning,H,kx,ky] = parse_inputs(varargin{:});
>>
David Young
David Young le 28 Mar 2011
So I guess the array i is not two-dimensional. You can use the size function to see whether it is or not.
If the array is three-dimensional because it is an RGB image, you could use rgb2gray to convert it to s 2-D grayscale image.

Connectez-vous pour commenter.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by