clear all

X = imread( 'lenna256.jpg' ); % Unsigned 8-bit integer for storage
XX = double( X ); % double precision variable for floating point operations
whos
mn = min( min( XX ) )
mx = max( max( XX ) )
sz = size(XX)
entry = XX(100,150)
XM = X + 1.22;
XXM = XX + 1.22;
test1 = min( min( XM ) )
test2 = min( min( XXM ) )
imagesc( XX )
colormap( gray ( 256 ) )
axis image
Y = max( max( XX ) ) - XX;
imagesc( Y )
colormap( gray ( 256 ) )
axis image
save lenna256neg.mat Y
clear all
whos % No viraibles in workspace
load lenna256neg.mat % Create variable Y
whos
imwrite(Y,gray(256),'lenna256neg.bmp','bmp')
dir *.bmp
imshow('lenna256neg.bmp')
colormap( gray ( 256 ) )
Z = imcomplement( Y ); % In image processing toolbox
imagesc( Z )
axis image