July 1, 2008
10:28 pm
This is a continuation of the image enhancement via cumulative distribution function (CDF) manipulation. This time the desired CDF is of the form G(z) = k tanh (z-128)/125 where z is the gray level pixel value and k is a positive constant here chosen to be 16. The original image is shown on the left.
Its enhanced image by forcing the CDF to be equal to G is shown on the right. Notice the changes in intensity. While there is more contrast in the original image, the modified image is more pleasing to look at.
What happens to their histograms and CDFs. The histogram of the altered image become
s bell-shaped. Its CDF takes the shape of a tanh which is our desired CDF.
SELF-EVALUATION RATING: 10/10 because I got the tanh shape for the output image CDF
Code:
If A is the original image with pixel values ranging from 0 to 255, and if its Cumulative Distributive Function is represented as cdf and B is the new image with a tanh shape CDF, then to obtain B:
z = [0:255];
G = (1+tanh(16*(z-128)/255))/2;
dimensions = (size(A,1)*size(A,2));
B = zeros(size(A,1),size(A,2));
for i = 0:255
m = cdf(i+1);
desired = interp1(G,z,m);
[x,y] = find(A==i);
for k = 1:length(x)
B(x(k),y(k)) = desired;
end
end
Tuesday, July 1, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment