Negative Function In Image Processing

%Negative Function In Image Processing
f=imread('cameraman.jpg');
[m,n,]=size(f);
g=zeros(m,n);

L=256;

for x=1:m
    for y=1:n
      
      g(x,y)=(L-1)-f(x,y);     
           
            end
    end
g=mat2gray(g);
subplot(1,2,1),imshow(f),title('original');
subplot(1,2,2),imshow(g),title('processed');
Previous Post Next Post