% ============================================================================= % Math 336 - Image Processing - Laboratory 2 % % A Matlab function for the histogram equalization intesity transformation. % % Marty Kandes % Department of Physics % San Diego State University % Fall 2008 % ----------------------------------------------------------------------------- function [E] = equal(IMAGE) F = imread(IMAGE); F = uint8(F); H = imhist(F); [M,N] = size(F); [L,Z] = size(H); nK = zeros(L,1); for K = 1:L for I = 1:M for J = 1:N if F(I,J) == K nK(K,1) = nK(K,1) + 1; end; end; end; end; E = zeros(M,N); for I = 1:M for J = 1:N for K = 1:F(I,J) E(I,J) = E(I,J) + nK(K,1); end; end; end; E = E./(M*N); E = L.*E; E = uint8(E); imshow(E); end