Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %Nioi Pier Giuliano
- %creates negative of grayscale image
- %
- %function usage
- % imshow(negative(imread('cameraman.tif')));
- %
- %
- function immNeg=wrong_negative(image)
- %create output image of the same size as the input image
- [rows,cols]=size(image);
- immNeg=zeros(rows,cols);
- %conversion for working double
- %values range in [0,1] , instead of [0,255]
- image=im2double(image);
- %finding max and min gray level value
- max_gray=max(max(image));
- %Wrong trasformation
- for i=1:rows
- for j=1:cols
- immNeg(i,j)=max_gray - image(i,j);
- end
- end
- %conversion back to uint8
- immNeg=im2uint8(immNeg);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement