, imfilter . ( ) .
hy=fspecial('sobel');hx=hy';Iy=imfilter(double(I), hy, 'replicate');Ix=imfilter(double(I), hx, 'replicate');gradmag=sqrt(Ix.^2+Iy.^2);figure, imshow(gradmag,[]), title(' '), , .
L=watershed(gradmag);Lrgb=label2rgb(L);figure, imshow(Lrgb), title('Lrgb'), , .
3: .
. , " " " ". imregionalmax.
, . . imopen.
se=strel('disk', 20);Io=imopen(I, se);figure, imshow(Io), title('Io')imerode imreconstruct.
Ie=imerode(I, se);Iobr=imreconstruct(Ie, I);figure, imshow(Iobr), title('Iobr'). . imclose:
Ioc=imclose(Io, se);figure, imshow(Ioc), title('Ioc')imdilate, imreconstruct. , imreconstruct .
Iobrd=imdilate(Iobr, se);Iobrcbr=imreconstruct(imcomplement(Iobrd), imcomplement(Iobr));Iobrcbr=imcomplement(Iobrcbr);figure, imshow(Iobrcbr), title('Iobrcbr')Iobrcbr Ioc , . Iobrcbr .
fgm=imregionalmax(Iobrcbr); figure, imshow(fgm), title('fgm').
I2=I; I2(fgm)=255; figure, imshow(I2), title('fgm, '), . . , . . , .
|
|
. bwareaopen, .
fgm4=bwareaopen(fgm3, 20); I3=I; I3(fgm4)=255; figure, imshow(I3) title('fgm4, ')