Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- input_image = rgb2gray(imread("cotillard.jpg"));
- imageWidth = size(input_image) (1)
- imageLenght = size(input_image) (2)
- e = [];
- image = [];
- e(1) = input_image(1)(1)
- counter = 1;
- %%%%% KODOWANIE %%%%%%%%
- for i = 1 : imageWidth
- for j = 1 : imageLenght
- image(counter) = input_image(i,j);
- counter++;
- endfor
- endfor
- for x = 1 : size(image)(2)
- if (x == 1)
- e(x) = image(1);
- else
- e(x) = image(x) - image(x-1);
- endif
- endfor
- %%%%%% DEKODOWANIE %%%%%%%
- g = [];
- out_image = uint8([]);
- for x = 1 : size(image)(2)
- if (x == 1)
- g(x) = e(1);
- else
- g(x) = e(x) + g(x-1);
- endif
- endfor
- counter = 1;
- for i = 1 : imageWidth
- for j = 1 : imageLenght
- out_image(i,j) = uint8(g(counter));
- counter++;
- endfor
- endfor
- figure
- subplot(1,2,1)
- imshow(input_image)
- title ('Obraz wejsciowy');
- subplot(1,2,2)
- imshow(out_image)
- title ('Obraz wyjsciowy');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement