Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. %lab4 zad1
  2. clearvars;
  3. close all;
  4. clc;
  5.  
  6. I1 = imread('lena1.bmp');
  7. I2 = imread('lena2.bmp');
  8. I3 = imread('lena3.bmp');
  9. I4 = imread('lena4.bmp');
  10.  
  11. figure(1);
  12. subplot(4,2,1);
  13. imshow(I1);
  14. subplot(4,2,2);
  15. imshow(I2);
  16. subplot(4,2,3);
  17. imshow(I3);
  18. subplot(4,2,4);
  19. imshow(I4);
  20.  
  21. subplot(4,2,5);
  22. imhist(I1, 256);
  23. subplot(4,2,6);
  24. imhist(I2, 256);
  25. subplot(4,2,7);
  26. imhist(I3, 256);
  27. subplot(4,2,8);
  28. imhist(I4, 256);
  29.  
  30. I5 = imread('hist1.bmp');
  31. figure(2);
  32. subplot(2,1,1);
  33. imshow(I5);
  34. subplot(2,1,2);
  35. imhist(I5, 256);
  36.  
  37. I6=imadjust(I5);
  38. figure(3);
  39. subplot(1,2,1);
  40. imshow(I6);
  41. subplot(1,2,2);
  42. imhist(I6,256);
  43.  
  44. [H,x] = imhist(I6);
  45. C = cumsum(H);
  46. k=max(C)./max(H);
  47. C2=C./k;
  48.  
  49.  
  50. figure(4);
  51. hold on;
  52. plot(x,H);
  53. plot(x,C2);
  54. hold off;
  55.  
  56. [H,x] = imhist(I5);
  57. C3 = cumsum(H);
  58. k=max(C3)./max(H);
  59. C4=C3./k;
  60.  
  61.  
  62. figure(5);
  63. hold on;
  64. plot(x,H);
  65. plot(x,C4);
  66. hold off;
  67. [H,x] = imhist(I5,256);
  68. lut = intlut(I5, uint8(255*C2/max(C2)));
  69. [H2,x2]=imhist(lut,256);
  70. Ch = cumsum(H2);
  71. k=max(Ch)./max(H2);
  72. Ch2=Ch./k;
  73.  
  74. figure(6);
  75. subplot(2,1,1);
  76. imshow(lut);
  77. subplot(2,1,2);
  78. hold on;
  79. plot(x,H);
  80. plot(x2,Ch2);
  81. hold off;
  82.  
  83. A = histeq(I5, 256);
  84. figure(7);
  85. imshow(A);
  86. B = adapthisteq(I5 );
  87. figure(8);
  88. imshow(B);
  89.  
  90. %lab4 zad 2
  91. clearvars;
  92. close all;
  93. clc;
  94.  
  95. I1 = imread('phobos.bmp');
  96. subplot(1,2,1);
  97. imshow(I1);
  98. A = histeq(I1, 256);
  99. subplot(1,2,2);
  100. imshow(A)
  101. load histogramZadany;
  102. figure(2);
  103. plot(histogramZadany);
  104.  
  105. A1 = histeq(I1, histogramZadany);
  106. subplot(1,2,1);
  107. imshow(I1);
  108. subplot(1,2,2);
  109. imshow(A1);
  110.  
  111. figure(3);
  112. A2 = imadjust(I1);
  113. subplot(1,2,1);
  114. imshow(A2);
  115. A3 = adapthisteq(I1);
  116. subplot(1,2,2);
  117. imshow(A3);
  118.  
  119. %lab4 zad3
  120. clearvars;
  121. close all;
  122. clc;
  123.  
  124. I1 = imread('lenaRGB.bmp');
  125. figure(1);
  126. imshow(I1);
  127. lenaR = I1(:,:,1);
  128. lenaG = I1(:,1,:);
  129. lenaB = I1(1,:,:);
  130.  
  131. figure(2);
  132. subplot(1,3,1);
  133. imhist(lenaR);
  134. subplot(1,3,2);
  135. imhist(lenaG);
  136. subplot(1,3,3);
  137. imhist(lenaB);
  138.  
  139. A = histeq(lenaR, 256);
  140. B = histeq(lenaG, 256);
  141. C = histeq(lenaB, 256);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement