( , ). / , . , (, , . .) .
, . , , . .
, . :
1) , , ;
2) .
. , , . , , , . , (, ) :
MATLAB
imfilter(I,h);
I , h- .
, . , , . . , , - . :
∆ x =1 - , 1 , ∆ y =1 - , 1 . , .
, :
- -
- -
, . , .
, ( ):
= | -1 2 -1 |, . . :
|
|
. "" . , , . 2 , , 3 , - 4 . : , , .
, H5 - H15 , , " ". .
. () , . . :
H16 - H18 H13 - H15 , 1, .. .
. . 2´2:
. , . , . , , .
3´3:
.
, . , 3×3 , . : Gx Gy , x y. Gx Gy , x y :
.
Gy Gx:
(i,j) - f i,j ,
, - . , . , , .
|
|
, . , , , , ..
, . , , , . , , , . , - , , .
, , , . , ( , ), .
. .
edge
:
BW=edge(l, method)
BW=edge(l, method, thresh)
BW=edge(l, method, thresh, P)
[BW, thresh]=edge(l, method,...)
:
- , .
BW=edge(I, method) I. BW , I. BW(r, ) 1, I(r, ) . . method : 'sobel', 'prewitt', 'roberts', 'log', 'zerocross', 'canny'. method , 'sobel'.
. BW=edge(I, method, thresh), BW=edge(I, method, thresh, P), thresh , , , .
thresh , . , thresh: [BW, thresh]=edge(I, method,...).
edge .
BW=edge(I, 'sobel', thresh) I [1, 3]; , , thresh. direction: BW=edge(I, 'sobel', thresh, direction), , . direction :
- 'horizontal' - ;
- 'vertical' - ;
- 'both' - ( , direction ).
BW=edge(I, 'prewitt', thresh) I [1,3]; , , thresh. direction: BW=edge(I, 'prewitt', thresh, direction), , . direction .
|
|
BW=edge(I, 'roberts', thresh) I ; , , thresh.
BW=edge(I, 'log', thresh) I [1, 2]; , , thresh. fspecial sigma=2 ( ) n=ceil(sigma*3)*2 + 1 ( ). sigma edge: BW=edge(I, 'log', thresh, sigma).
BW=edge(I, 'zerocross', thresh, h) I h; , , thresh.
BW=edge(I, 'canny', thresh) . , [4]. . . "" "" - . "" , "". edge, .
thresh . , - . thresh , thresh , 0.4*thresh. thresh thresh ([ ]), .
BW=edge(I, 'canny', thresh, sigma) sigma, , , .
:
. . 1, . , , . 1, .
% .
% .
I=imread(lena.bmp);
imshow(l);
% .
BW=edge(l, sobel, 0.09);
figure, imshow(BW);
) | ) |
. 1.
.
1. jpg . .
,
.
2. gif . edge.