Auto Contrast Matlab Code


I=imread('E:\IP\imgs\lena.jpg');
amin = 0;
amax = 255;
if length(size(I))==3
        I=rgb2gray(I);
end
alow = min(min(I));
ahigh = max(max(I));

[r,c] = size(I);
J = zeros(r,c);

for m=1:r
    for n=1:c
        a = I(m,n);
        a1 = amin +((a - alow) * ((amax - amin) / (ahigh - alow)));
        J(m,n) = a1;
    end
end
J = uint8(J);
subplot(1,2,1); imshow(I);
subplot(1,2,2); imshow(J);

Comments

Popular posts from this blog

GL_QUAD_STRIP Example In OpenGl

GL_POLYGON Example In OpenGl