Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.95 KB | None | 0 0
  1. % ----- lab 9
  2.  
  3. % L = imread('Krakow_1.jpg');
  4. % L = rgb2gray(L);
  5. % figure;
  6. % imshow(L);
  7. % hold on;
  8. % setmask = [strcat('m = [str2num(get(t1,''String'')), str2num(get(t2,''String'')), str2num(get(t3,''String''));',...
  9. % 'str2num(get(t4,''String'')), str2num(get(t5,''String'')), str2num(get(t6,''String''));',...
  10. % 'str2num(get(t7,''String'')), str2num(get(t8,''String'')), str2num(get(t9,''String''))];',...
  11. % 'L1 = filter2(m,L); L1 = mat2gray(L1); imshow(L1)')];
  12. % t1 = uicontrol('Style', 'edit', 'String', num2str(1), 'Position', [10 120 30 30], 'Callback', setmask);
  13. % t2 = uicontrol('Style', 'edit', 'String', num2str(1), 'Position', [50 120 30 30], 'Callback', setmask);
  14. % t3 = uicontrol('Style', 'edit', 'String', num2str(1), 'Position', [90 120 30 30], 'Callback', setmask);
  15. % t4 = uicontrol('Style', 'edit', 'String', num2str(1), 'Position', [10 80 30 30], 'Callback', setmask);
  16. % t5 = uicontrol('Style', 'edit', 'String', num2str(1), 'Position', [50 80 30 30], 'Callback', setmask);
  17. % t6 = uicontrol('Style', 'edit', 'String', num2str(1), 'Position', [90 80 30 30], 'Callback', setmask);
  18. % t7 = uicontrol('Style', 'edit', 'String', num2str(1), 'Position', [10 40 30 30], 'Callback', setmask);
  19. % t8 = uicontrol('Style', 'edit', 'String', num2str(1), 'Position', [50 40 30 30], 'Callback', setmask);
  20. % t9 = uicontrol('Style', 'edit', 'String', num2str(1), 'Position', [90 40 30 30], 'Callback', setmask);
  21.  
  22. % L=imread('portret.jpg');
  23. % figure(1);
  24. % imshow(L);
  25. % Maska1=[-1,-1,-1; 0, 1, 0; 1, 1, 1];
  26. % L1=filter2(Maska1, L);
  27. % L1=L1/255;
  28. % figure(2); imshow(L1);
  29.  
  30. % L=imread('Krakow_3.jpg');
  31. % figure(1);
  32. % imshow(L);
  33. %
  34. % Maska1=[-1,-1,-1; -1,8,-1; -1,-1,-1];
  35. % L1=imfilter(L,Maska1);
  36. % figure(2); imshow(L1);
  37. %
  38. %
  39. % Maska2=[1,-2,1; -2,4,-2; 1,-2,1];
  40. % L2=imfilter(L,Maska2);
  41. % figure(3); imshow(L2);
  42. %
  43. % level = graythresh(L2);
  44. % L3 = im2bw(L2,level);
  45. % figure;
  46. % imshow(L3);
  47.  
  48. % L=imread('portret.jpg');
  49. % imshow (L), title('obraz zrodlowy');
  50. % h=ones(5)/25; %dzielenie przez sumę współczynników
  51. % L1=imfilter(L,h);
  52. % figure;
  53. % imshow(L1), title ('obraz bez powielania pikseli brzegowych');
  54. % L2=imfilter(L, h, 'replicate');
  55. % figure;
  56. % imshow (L2), title ('obraz z powielonymi pikselami brzegowymi');
  57.  
  58. % L = imread('portret.jpg');
  59. % h = fspecial('unsharp');
  60. % L1 = imfilter(L,h,'replicate');
  61. % imshow(L);
  62. % figure, imshow(L1);
  63. %
  64. % h = fspecial('average');
  65. % L2 = imfilter(L,h,'replicate');
  66. % figure, imshow(L2);
  67. %
  68. % h = fspecial('gaussian');
  69. % L3 = imfilter(L,h,'replicate');
  70. % figure, imshow(L3);
  71. %
  72. % h = fspecial('laplacian');
  73. % L4 = imfilter(L,h,'replicate');
  74. % figure, imshow(L4);
  75. %
  76. % h = fspecial('motion');
  77. % L5 = imfilter(L,h,'replicate');
  78. % figure, imshow(L5);
  79.  
  80.  
  81. % L=imread('portret.jpg');
  82. % figure(1);
  83. % imshow(L);
  84. % L1=medfilt2(L, [5,5]);
  85. % L1=mat2gray(L1);
  86. % figure(2); imshow(L1);
  87.  
  88. % L=imread('kwadrat.bmp');
  89. % figure(1);
  90. % imshow(L);
  91. % L1=medfilt2(L, [75,75]);
  92. % L1=mat2gray(L1);
  93. % figure(2); imshow(L1);
  94.  
  95. % L=ones([16, 16])*256;
  96. % L(6:11, 6:11)=(0:43:256)'*ones([1 6]);
  97. % L(14,14)=0;
  98. % L=uint8(L);
  99. % figure(1);
  100. % imshow(L, 'InitialMagnification', 'fit');
  101. % L1=imnoise(L, 'salt & pepper', 0.3);
  102. % figure(2);
  103. % imshow(L1,'InitialMagnification', 'fit');
  104. % Maska=[3,3]
  105. % L2=nlfilter(L1, Maska, 'min(x(:))');
  106. % L2=mat2gray(L2);
  107. % figure(3); imshow(L2,'InitialMagnification', 'fit');
  108.  
  109. % Maska=[10,10];
  110. % L3=nlfilter(L1, Maska, 'min(x(:))');
  111. % L3=mat2gray(L3);
  112. % figure(4); imshow(L3, 'InitialMagnification', 'fit');
  113. %
  114. % L=imread('Krakow_3.jpg','jpg');
  115. % L=rgb2gray(L);
  116. % L1=imnoise(L, 'salt & pepper', 0.9);
  117. % figure;
  118. % imshow(L1);
  119. %
  120. % L2=medfilt2(L1, [25,25]);
  121. % L2=mat2gray(L2);
  122. % figure(2); imshow(L2);
  123.  
  124. % ----- lab 5 ----
  125.  
  126. % [L1,map1]=imread('Victoire.tif');
  127. % L1=ind2rgb(L1,map1);
  128. % figure;
  129. % imshow(L1);
  130. % L1r=L1(:,:,1);
  131. % L1g=L1(:,:,2);
  132. % L1b=L1(:,:,3);
  133. % figure;
  134. % [x,y]=hist(L1r(:));
  135. % bar(y,x,1/255);
  136. % xlabel('Nasycenie koloru czerwonego','FontSize',13,'FontName','ArialCE');
  137. % ylabel('Ilość pikseli[/]','FontSize',13,'FontName','Arial CE');
  138. % L2r=histeq(L1r);
  139. % L2g=histeq(L1g);
  140. % L2b=histeq(L1b);
  141. % figure;
  142. % imshow(cat(3,L2r,L1g,L1b));
  143. % figure;
  144. % imshow(cat(3,L1r,L2g,L1b));
  145. % figure;
  146. % imshow(cat(3,L1r,L1g,L2b));
  147. % figure;
  148. % [x,y]=imhist(L2r(:));
  149. % bar(y,x,1/255);
  150. % xlabel('Nasycenie koloru czerwonego','FontSize',13,'FontName','ArialCE');
  151. % ylabel('Ilość pikseli[/]','FontSize',13,'FontName','Arial CE');
  152.  
  153. % L1=imread('portret.jpg');
  154. % figure
  155. % imshow(zeros(800,800));
  156. % [r c] = size(L1);
  157. % [x,y] = meshgrid(0:c-1,0:r-1);
  158. % z = double(L1);
  159. % surfc(x,y,z);
  160. % axis([0 c 0 r 0 255])
  161. % L2 = imresize(L1,size(L1)/8,'nearest');
  162. % figure
  163. % imshow(zeros(800,800));
  164. % [r c] = size(L2);
  165. % [x,y] = meshgrid(0:c-1,0:r-1);
  166. % z = double(L2);
  167. % surfc(x,y,z);
  168. % axis([0 c 0 r 0 255])
  169. % colormap(jet)
  170.  
  171. % L1 = imread('portret.jpg');
  172. % figure; imshow(L1);
  173. % L1 = double(L1)/255;
  174. % hold on
  175. % setbright = ['w = get(suwak,''Value''); L2 = L1; L2 = L2 + w; imshow(L2)'];
  176. % suwak = uicontrol('Style','Slider',...
  177. % 'Position',[10 40 25 400],...
  178. % 'Min',-1,'Max',1,'Value',0,...
  179. % 'Callback',setbright);
  180.  
  181. L1 = imread('Krakow_3.jpg');
  182. figure; imshow(L1);
  183. L1 = double(L1)/255;
  184. hold on
  185.  
  186. % r_img = L1;
  187. % r_img(:,:,[2 3]) = 0;
  188. g_img = L1;
  189. g_img(:,:,[1 3]) = 0;
  190. b_img = L1;
  191. b_img(:,:,[1 2]) = 0;
  192.  
  193. setGreen = ['w = get(suwakGreen,''Value''); r_img = L1; r_img(:,:,[2 3]) + w; imshow(cat(3,r_img,g_img,b_img))'];
  194. suwakGreen = uicontrol('Style','Slider',...
  195. 'Position',[10 40 25 400],...
  196. 'Min',-1,'Max',1,'Value',0,...
  197. 'Callback',setGreen);
  198.  
  199. % setRed = ['w = get(suwakRed,''Value''); L2 = L1; L2 = L2 + w; ;)'];
  200. % suwakRed = uicontrol('Style','Slider',...
  201. % 'Position',[50 40 25 400],...
  202. % 'Min',-1,'Max',1,'Value',0,...
  203. % 'Callback',setRed);
  204. %
  205. % setBlue = ['w = get(suwakBlue,''Value''); L2 = L1; L2 = L2 + w; imshow(L2)'];
  206. % suwak = uicontrol('Style','Slider',...
  207. % 'Position',[100 40 25 400],...
  208. % 'Min',-1,'Max',1,'Value',0,...
  209. % 'Callback',setBlue);
  210. %
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement