Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % CONVCORR esimerkkejä kuvatason suodatuksesta
- %%S1
- I=imread('coins.png');
- figure,imshow(I);
- h=[1 2 3;4 5 6; 7 8 9]*1/45 %satunnainen suodatin
- I1=conv2(I,h,'same');
- imshowpair(I,I1,'montage')
- plot(I(:,120))
- %%S2
- %alipäästösuodatus, keskiarvottavan suodatin
- h1=ones(10,10)*1/100
- I3=conv2(I,h1);
- imshowpair(I,I3,'montage')
- I3=conv2(I,h1,'same');
- imshowpair(I,I3,'montage')
- %% S3
- %alipäästösuodatin poistaa korkeat taajuudet kuvasta
- figure,plot(I(:,120))
- figure,plot(I3(:,120))
- %% S4
- %ylipäästösuodatin (Laplace-suodin)
- h2=[0 1 0; 1 -4 1;0 1 0]
- I4=conv2(I,h2,'same');
- imshowpair(I,I4,'montage')
- figure,plot(I4(:,120))
- %% S5 Esimerkkejä fspecial-funktion käytöstä
- h3= fspecial('sobel')
- I5=filter2(h3,I,'same');
- imshowpair(I,I5,'montage')
- I6=abs(I5);
- h4=h3' % Transponoidaan suodatin
- I7=filter2(h4,I,'same');
- imshowpair(I,I7,'montage')
- I8=I6+abs(I7);
- imshowpair(I,I8,'montage')
- %% S6 muunnetaan kuva binäärikuvaksi
- %I9=imadjust(I8);
- level = graythresh(I8)
- %bw = imbinarize(I8,level);
- I9=edge(I8,'canny');
- I10=imfill(I9,'holes');
- imshowpair(I,I10,'montage')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement