
It has dimensions of 160 x 170 pixel units. To enhance the contrast of the image, its Probability Distribution Function (PDF) was first determined.
From the histogram, the spread across the x axis(gray level) is not that wide since the image is of poor contrast. Using the cumsum function from scilab, the Cumulative Distribution Function (CDF) of the image was plotted.
The enhanced image is shown below with its PDF and CDF plots.
The program I used is:
im=imread('water1.jpg'); //g=::1,(im);
val=[];
num=[];
counter=1;
for i=0:1:255
[x,y]=find(im==i); //finds where im==i (or g==i)
val(counter)=i;
num(counter)=length(x); //find how many pixels of im have value of i
counter=counter+1;
end
pixels=size(im,1)*size(im,2) //27200
plot1=plot(val, num);
num2=num/pixels;
plot2=plot(val, num2); //normalized
plot(val,cumsum(num2)); //CDF
im2 = [];
for ii = 1:1:size(im,1)
for jj = 1:1:size(im,2)
cdf = cumsum([number/(length(im2))]);
newim(ii,jj) = cdf(im(ii,jj));
imwrite(im2, 'waterfinal.jpg');
end
end
rating-10, because I have successfully enhanced the contrast of my image
Acknowledgments:
Cole and Angel- for assisting me in the process of backprojecting my image.
Paul - for helping me find the error in my code
No comments:
Post a Comment