SHARE
TWEET

Untitled

fraczek95 Jun 14th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. input_image = rgb2gray(imread("cotillard.jpg"));
  2.  
  3. imageWidth = size(input_image) (1)
  4. imageLenght = size(input_image) (2)
  5.  
  6. e = [];
  7. image = [];
  8. e(1) = input_image(1)(1)
  9. counter = 1;
  10.  
  11. %%%%% KODOWANIE %%%%%%%%
  12.  
  13. for i = 1 : imageWidth
  14.   for j = 1 : imageLenght
  15.     image(counter) = input_image(i,j);
  16.     counter++;
  17.     endfor
  18. endfor
  19.  
  20. for x = 1 : size(image)(2)
  21.   if (x == 1)
  22.     e(x) = image(1);
  23.   else
  24.     e(x) = image(x) - image(x-1);    
  25.   endif
  26. endfor
  27.  
  28. %%%%%% DEKODOWANIE %%%%%%%
  29.  
  30. g = [];
  31. out_image = uint8([]);
  32.  
  33. for x = 1 : size(image)(2)
  34.   if (x == 1)
  35.     g(x) = e(1);
  36.   else
  37.     g(x) = e(x) + g(x-1);
  38.   endif
  39. endfor
  40.  
  41. counter = 1;
  42.  
  43. for i = 1 : imageWidth
  44.   for j = 1 : imageLenght
  45.     out_image(i,j) = uint8(g(counter));
  46.     counter++;
  47.     endfor
  48. endfor
  49.  
  50.  
  51.  
  52. figure
  53. subplot(1,2,1)
  54. imshow(input_image)
  55. title ('Obraz wejsciowy');
  56. subplot(1,2,2)
  57. imshow(out_image)
  58. title ('Obraz wyjsciowy');
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top