Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A1=imread('coins.png')
- figure(1)
- subplot(2,2,1)
- imshow(A1)
- subplot(2,2,2)
- imhist(A1)
- A2=im2bw(A1,0.41)
- subplot(2,2,3)
- imshow(A2)
- O1=imread('figura.tif')
- O2=imread('figura2.tif')
- O3=imread('figura3.tif')
- O4=imread('figura4.tif')
- figure(2)
- subplot(2,2,1)
- imhist(O1)
- subplot(2,2,2)
- imhist(O2)
- subplot(2,2,3)
- imhist(O3)
- subplot(2,2,4)
- imhist(O4)
- %Nie da sie jedno zanczenie określić czy tak czy nie, zależy to od metody
- %wpyłnęlo w taki sposób że zmniejszyło wartości i rozłożyło na grupy
- %Tak jest możliwe wyznaczenie progu na podstawie histogramu, ale tak ja
- %wczesniej pisałem zależy od metody
- %tak, zalezy do metody
- figure(3)
- level=graythresh(A1)
- level1=clusterKittler(A1)
- level2=entropyYen(A1)
- BW=im2bw(A1,level)
- BW1=im2bw(A1,level1/255)
- BW2=im2bw(A1,level2/255)
- BW3=im2bw(A1,0.49)
- %probi były obliczanie dla obrazu coins.png
- %moj próg 0.49
- %próg otrzymany metoda otshu 0.5137
- %próg otrzymany metoda kittlera 0.6313
- %próg otrzymany meyoda yeana 0.4588
- subplot(2,3,1)
- imshow(A1)
- title('obraz startowy')
- subplot(2,3,2)
- imhist(A1)
- title('histogram')
- subplot(2,3,3)
- imshow(BW)
- title(['prog graythresha, ',num2str(level)])
- subplot(2,3,4)
- imshow(BW1)
- title(['prog kittlera, ',num2str(level1/255)])
- subplot(2,3,5)
- imshow(BW2)
- title(['prog yena, ',num2str(level2/255)])
- subplot(2,3,6)
- imshow(BW3)
- title(['moj prog, ',num2str(0.49)])
- A3=imread('rice.png')
- figure(4)
- level=graythresh(A3)
- level1=clusterKittler(A3)
- level2=entropyYen(A3)
- BW=im2bw(A3,level)
- BW1=im2bw(A3,level1/255)
- BW2=im2bw(A3,level2/255)
- BW3=im2bw(A3,0.41)
- subplot(2,3,1)
- imshow(A3)
- title('obraz startowy')
- subplot(2,3,2)
- imhist(A3)
- title('histogram')
- subplot(2,3,3)
- imshow(BW)
- title(['prog graythresha, ',num2str(level)])
- subplot(2,3,4)
- imshow(BW1)
- title(['prog kittlera, ',num2str(level1/255)])
- subplot(2,3,5)
- imshow(BW2)
- title(['prog yena, ',num2str(level2/255)])
- subplot(2,3,6)
- imshow(BW3)
- title(['moj prog, ',num2str(0.49)])
Advertisement
Add Comment
Please, Sign In to add comment