fraczek95

Untitled

Jun 14th, 2019
540
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. image_buf =[];
  9. e(1) = input_image(1)(1)
  10. counter = 1;
  11. eta = 25;
  12.  
  13. %%%%% KODOWANIE %%%%%%%%
  14.  
  15. for i = 1 : imageWidth
  16.   for j = 1 : imageLenght
  17.     image(counter) = input_image(i,j);
  18.     counter++;
  19.     endfor
  20. endfor
  21.  
  22. image_buf(1) = image(1);
  23.  
  24. for x = 2 : size(image)(2)
  25.      
  26.   e(x) = image(x) - image_buf(x-1);
  27.  
  28.   if e(x) >= 0
  29.     e(x) = eta;
  30.   else
  31.     e(x) = -eta;
  32.   endif
  33.  
  34.   image_buf(x) = image_buf(x-1) + e(x);
  35.  
  36. endfor
  37.  
  38. %%%%%% DEKODOWANIE %%%%%%%
  39.  
  40.  
  41. out_image = uint8([]);
  42. counter = 1;
  43.  
  44. for i = 1 : imageWidth
  45.   for j = 1 : imageLenght
  46.     out_image_e1(i,j) = uint8(image_buf(counter));
  47.     counter++;
  48.     endfor
  49. endfor
  50.  
  51.  
  52.  
  53. figure
  54. subplot(1,2,1)
  55. imshow(input_image)
  56. subplot(1,2,2)
  57. imshow(out_image)
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×