szymcio10

Gradienty

May 8th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.03 KB | None | 0 0
  1. close all;
  2. clear all;
  3.  
  4. A1 = imread('jet.bmp');
  5. load('maskiPP.mat');
  6.  
  7. A1m = conv2(A1,R1,'same');
  8. A1m2 = conv2(A1,R2,'same');
  9. A1m = uint8(A1m+128);
  10. A1m2 = uint8(abs(A1m2));
  11.  
  12. figure(1)
  13. subplot(1,3,1);
  14. imshow(A1,[]);
  15. title('obraz startowy')
  16.  
  17. subplot(1,3,2);
  18. imshow(A1m,[]);
  19. title('obraz dodanie')
  20.  
  21. subplot(1,3,3);
  22. imshow(A1m2,[]);
  23. title('obraz srednia')
  24.  
  25. %---------------------------
  26.  
  27. A2m = conv2(A1,P1,'same');
  28. A2m2 = conv2(A1,P2,'same');
  29. A2m = uint8(A2m+128);
  30. A2m2 = uint8(abs(A2m2));
  31.  
  32. figure(2)
  33. subplot(1,3,1);
  34. imshow(A1,[]);
  35. title('obraz startowy')
  36.  
  37. subplot(1,3,2);
  38. imshow(A2m,[]);
  39. title('obraz dodanie')
  40.  
  41. subplot(1,3,3);
  42. imshow(A2m2,[]);
  43. title('obraz srednia')
  44.  
  45. %----------------------------
  46.  
  47. A3m = conv2(A1,S1,'same');
  48. A3m2 = conv2(A1,S2,'same');
  49. A3m = uint8(A3m+128);
  50. A3m2 = uint8(abs(A3m2));
  51.  
  52. figure(3)
  53. subplot(1,3,1);
  54. imshow(A1,[]);
  55. title('obraz startowy')
  56.  
  57. subplot(1,3,2);
  58. imshow(A3m,[]);
  59. title('obraz dodanie')
  60.  
  61. subplot(1,3,3);
  62. imshow(A3m2,[]);
  63. title('obraz srednia')
Advertisement
Add Comment
Please, Sign In to add comment