szymcio10

lab4- poc

Jul 5th, 2020
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.36 KB | None | 0 0
  1. %1
  2. RGB = imread('lena.jpg');
  3. RGB1 = imread('lena.bmp');
  4. figure(1)
  5. imshow(RGB1)
  6. figure(2)
  7. imshow(RGB)
  8. I = rgb2gray(RGB)
  9. figure(3)
  10. imshow(I)
  11. imwrite(I,'obrazy/lena_gray.bmp')
  12. figure(4)
  13. colormap gray
  14. mesh(I)
  15. figure(5)
  16. plot(I(10,:));
  17. figure(6)
  18. plot(I(:,10));
  19.  
  20. %2
  21. A1 = imread('lena_gray.bmp')
  22. figure(1)
  23. imshow(A1)
  24. figure(2)
  25. I = imhist(A1)
  26. plot(I)
  27. figure(3)
  28. I1 = cumsum(I)
  29. plot(I1)
  30. figure(4)
  31. A2= imbinarize(A1)
  32. imshow(A2)
  33. %3
  34. A1 = imread('lena_gray.bmp')
  35. [X, map] = gray2ind(A1,256);
  36. figure(1)
  37. imshow(X,map)
  38. figure(2)
  39. colormap winter
  40. image(A1)
  41. %4
  42. lena=imread('lena.bmp')
  43. R = lena(:,:,1); G = lena(:,:,2); B = lena(:,:,3);
  44. figure(1);
  45. subplot(2,2,1);
  46. imshow(lena);
  47. title('Oryginal');
  48. subplot(2,2,2);
  49. imshow(R);
  50. title('R');
  51. subplot(2,2,3);
  52. imshow(G);
  53. title('G');
  54. subplot(2,2,4);
  55. imshow(B);
  56. title('B');
  57.  
  58. lena1=rgb2hsv(lena)
  59. H = lena1(:,:,1); S = lena1(:,:,2); V = lena1(:,:,3);
  60. figure(2);
  61. subplot(2,2,1);
  62. imshow(lena1);
  63. title('Oryginal');
  64. subplot(2,2,2);
  65. imshow(H);
  66. title('H');
  67. subplot(2,2,3);
  68. imshow(S);
  69. title('S');
  70. subplot(2,2,4);
  71. imshow(V);
  72. title('V');
  73.  
  74. lena2=rgb2ycbcr(lena)
  75. Y = lena2(:,:,1); CB = lena2(:,:,2); CR = lena2(:,:,3);
  76. figure(3);
  77. subplot(2,2,1);
  78. imshow(lena2);
  79. title('Oryginal');
  80. subplot(2,2,2);
  81. imshow(Y);
  82. title('Y');
  83. subplot(2,2,3);
  84. imshow(CB);
  85. title('Cb');
  86. subplot(2,2,4);
  87. imshow(CR);
  88. title('Cr');
Advertisement
Add Comment
Please, Sign In to add comment