Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.78 KB | None | 0 0
  1. photoRGB = imread('kck/jankos.jpg');
  2. photoHSV = rgb2hsv(photoRGB);
  3. [x, y, z] = size(photoRGB);
  4. photoAfterHSVFilter = ((photoHSV(:,:,1) <= 0.1 | photoHSV(:,:,1) >= 0.9) & ...
  5.                        (photoHSV(:,:,2) >= 0.2 & photoHSV(:,:,2) <= 0.6) & ...
  6.                        (photoHSV(:,:,3) >= 0.4));
  7. scale = 0.4;
  8. photoAfterScale = uint8(imresize(medfilt2(imresize(photoAfterHSVFilter, scale)),[x, y]));
  9.  
  10. cuttedPhoto(:,:,1) = photoRGB(:,:,1) .* photoAfterScale;
  11. cuttedPhoto(:,:,2) = photoRGB(:,:,2) .* photoAfterScale;
  12. cuttedPhoto(:,:,3) = photoRGB(:,:,3) .* photoAfterScale;
  13. subplot(2,2,1);
  14. imshow(photoRGB);
  15. subplot(2,2,2);
  16. imshow(photoAfterHSVFilter);
  17. subplot(2,2,3);
  18. imshow(photoAfterScale .* 255);
  19. subplot(2,2,4);
  20. imshow(cuttedPhoto);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement