Write a MATLAB program for Image Negation


Code:

clear;
clc;
a = imread('d:/matimage/baby.jpg'); % Read image from graphics file
b = 255-a; % conversion from black to white and vice-versa (black =0 and white = 255)
subplot(2,1,1), %Create axes in tiled positions
imshow(a), % displays the original image.
title('original image'); % Add title to current axes
subplot(2,1,2), %Create axes in tiled positions.
imshow(b), % displays the negative of original image.
title('negative of original image'); % Add title to current axes


Output:



No comments

Powered by Blogger.