Advertisement
Voldemord

Untitled

May 3rd, 2020
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 2.36 KB | None | 0 0
  1. close all
  2. I = imread('coins.png');
  3. figure;
  4. subplot(2,1,1);
  5. imshow(I);
  6. subplot(2,1,2);
  7. imhist(I);
  8.  
  9. figure;
  10. I = im2bw(I,80/255);
  11. imshow(I)
  12.  
  13. I = imread('figura.tif');
  14. figure
  15. subplot(3,1,1);
  16. imshow(I);
  17. subplot(3,1,2);
  18. imhist(I);
  19. subplot(3,1,3);
  20. I = im2bw(I,76/255);
  21. imshow(I);
  22. %%Nie trudno
  23.  
  24. I = imread('figura2.tif');
  25. figure
  26. subplot(3,1,1);
  27. imshow(I);
  28. subplot(3,1,2);
  29. imhist(I);
  30. subplot(3,1,3);
  31. I = im2bw(I,76/255);
  32. imshow(I);
  33. %%Tlo stracilo swoją jednolitość, został zwiekszony przedział jasnosci na histogramie
  34.  
  35. I = imread('figura3.tif');
  36. figure
  37. subplot(3,1,1);
  38. imshow(I);
  39. subplot(3,1,2);
  40. imhist(I);
  41. subplot(3,1,3);
  42. I = im2bw(I,76/255);
  43. imshow(I);
  44. %%Figura stracila swoja jednolitosc, jednak jej ksztalt jest dalej czytelny
  45.  
  46. I = imread('figura4.tif');
  47. figure
  48. subplot(3,1,1);
  49. imshow(I);
  50. subplot(3,1,2);
  51. imhist(I);
  52. subplot(3,1,3);
  53. I = im2bw(I,76/255);
  54. imshow(I);
  55.  
  56. %% Binaryzacja jest niemozliwa, figura stracila swoj ksztalt
  57.  
  58. figure;
  59. I = imread('coins.png');
  60.  
  61. subplot(2,3,1);
  62. imshow(I);
  63.  
  64. subplot(2,3,2);
  65. imhist(I);
  66.  
  67. subplot(2,3,3);
  68. imshow(im2bw(I,80/255));
  69. title(['Bin. reczna: ',num2str(80/255)]);
  70.  
  71. subplot(2,3,4);
  72. imshow(im2bw(I,graythresh(I)));
  73. title(['Bin. graythresh: ',num2str(graythresh(I))]);
  74.  
  75. subplot(2,3,5);
  76. imshow(im2bw(I,clusterKittler(I)/255));
  77. title(['Bin. kittler: ',num2str(clusterKittler(I)/255)]);
  78.  
  79. subplot(2,3,6);
  80. imshow(im2bw(I,entropyYen(I)/255));
  81. title(['Bin. yen: ',num2str(entropyYen(I)/255)]);
  82.  
  83.  
  84.  
  85. figure
  86.  
  87. I = imread('rice.png');
  88.  
  89. subplot(4,2,1);
  90. imshow(im2bw(I,106/255));
  91. title(['Bin. reczna: ',num2str(80/255)]);
  92.  
  93. subplot(4,2,2);
  94. imshow(im2bw(I,entropyYen(I)/255));
  95. title(['Bin. yen: ',num2str(entropyYen(I)/255)]);
  96.  
  97. I = imread('tekst.bmp');
  98.  
  99. subplot(4,2,3);
  100. imshow(im2bw(I,182/255));
  101. title(['Bin. reczna: ',num2str(182/255)]);
  102.  
  103. subplot(4,2,4);
  104. imshow(im2bw(I,entropyYen(I)/255));
  105. title(['Bin. gray: ',num2str(graythresh(I))]);
  106.  
  107.  
  108. I = imread('obiekty.bmp');
  109.  
  110. subplot(4,2,5);
  111. imshow(im2bw(I,161/255));
  112. title(['Bin. reczna: ',num2str(181/255)]);
  113.  
  114. subplot(4,2,6);
  115. imshow(im2bw(I,entropyYen(I)/255));
  116. title(['Bin. Kittler: ',num2str(clusterKittler(I)/255)]);
  117.  
  118. I = imread('katalog.bmp');
  119.  
  120. subplot(4,2,7);
  121. imshow(im2bw(I,161/255));
  122. title(['Bin. reczna: ',num2str(161/255)]);
  123.  
  124. subplot(4,2,8);
  125. imshow(im2bw(I,graythresh(I/255)));
  126. title(['Bin. gray: ',num2str(graythresh(I))]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement