Advertisement
Guest User

Untitled

a guest
Apr 28th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. A=imread('C:\Users\samsung\Desktop\modelowanie\image1.jpg')
  2. B=imread('C:\Users\samsung\Desktop\modelowanie\image2.jpg')
  3. C=imread('C:\Users\samsung\Desktop\modelowanie\image3.jpg')
  4.  
  5. subplot(2,3,1)
  6. imshow(A);
  7.  
  8. subplot(2,3,2)
  9. imshow(B);
  10.  
  11. subplot(2,3,3)
  12. imshow(C);
  13.  
  14.  
  15. grA=rgb2gray(A);
  16. % figure
  17. % imshow(grA);
  18.  
  19. grB=rgb2gray(B);
  20. % figure
  21. % imshow(grB);
  22.  
  23. grC=rgb2gray(C);
  24. % figure
  25. % imshow(grC);
  26.  
  27. % ad=imadjust(gr);
  28. % figure
  29. % imshow(ad);
  30.  
  31.  
  32.  
  33. binA=grA>125;
  34. %figure
  35. %imshow(bin);
  36.  
  37. binB=grB>125;
  38. % figure
  39. % imshow(bin);
  40.  
  41. binC=grC>125;
  42. % figure
  43. % imshow(bin);
  44.  
  45. % filt=medfilt2(bin,[3,3]);
  46. % filt=medfilt2(bin,[3,3]);
  47. % figure
  48. % imshow(filt);
  49.  
  50. % bw=im2bw(filt);
  51. % figure
  52. % imshow(bw);
  53.  
  54. elemstr = strel('disk',2);
  55. erodeobrA = imerode(binA,elemstr);
  56. dilateobrA = imdilate(erodeobrA,elemstr);
  57.  
  58. elemstr = strel('disk',1);
  59. erodeobrB = imerode(binB,elemstr);
  60. dilateobrB = imdilate(erodeobrB,elemstr);
  61.  
  62.  
  63. % elemstr = strel('disk',1);
  64. % erodeobrC = imerode(binC,elemstr);
  65. % dilateobrC = imdilate(erodeobrC,elemstr);
  66. %B
  67. % figure
  68. % imshow(dilateobr);
  69.  
  70. filtrA=medfilt2(dilateobrA,[3,3]);
  71. filtrA = bwmorph(filtrA,'clean');
  72. % figure
  73. % imshow(filtrA);
  74.  
  75. filtrB=medfilt2(dilateobrB,[3,3]);
  76. filtrB = bwmorph(filtrB,'clean');
  77. % figure
  78. % imshow(filtrB);
  79.  
  80. filtrC=medfilt2(binC,[3,3]);
  81. filtrC = bwmorph(filtrC,'clean');
  82. filtrC = bwmorph(filtrC,'erode');
  83. % figure
  84. % imshow(filtrC);
  85.  
  86. filtr2A=medfilt2(filtrA,[3,3]);
  87. subplot(2,3,4);
  88. imshow(filtr2A);
  89.  
  90.  
  91. filtr2B=medfilt2(filtrB,[3,3]);
  92. subplot(2,3,5);
  93. imshow(filtr2B);
  94.  
  95. filtr2C=medfilt2(filtrC,[3,3]);
  96. subplot(2,3,6);
  97. imshow(filtr2C);
  98.  
  99.  
  100. SA=numel(filtrA);
  101. JA=nnz(filtrA);
  102. wartA=JA/SA;
  103.  
  104. SB=numel(filtrB);
  105. JB=nnz(filtrB);
  106. wartB=JB/SB;
  107.  
  108. SC=numel(filtrC);
  109. JC=nnz(filtrC);
  110. wartC=JC/SC;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement