Implementing Digital Negative and Grayscale of Image in MATLAB

a=imread('C:\Users\Public\Pictures\Sample Pictures\Desert.jpg');
b=rgb2gray(a);
c(:,:,:)=255-b(:,:,:);
imwrite(c,'neg.jpg');
subplot(1,3,1);
imshow(a);
title('Original Image');
subplot(1,3,2);
imshow(b);
title('Grayscale Image');
subplot(1,3,3);
imshow(c);
title('Negative Image');
Output

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.