Due: Feb 2, 2011
Use histogram equalization to enhance digital images.
You need to implement a function called 4tn4_histeq() which takes the
path to an image file as its parameter and returns the histogram
equalized version of that image in image matrix format. For example,
if you successfully implement this function, the following commands
should show histogram equalized 'Lenna.png' on screen,
img = 4tn4_histeq('Lenna.png');
imshow(img);
Please note that most image processing libraries, such as Matlab and OpenCV, have build-in histogram equalization functions, however, you are not allowed to use them in your submission; you have to implement your own version of the algorithm.
Standard histogram equalization algorithm only works with grayscale images rather than common RGB color images. Thus, if the input image is a RGB image, it must be first converted to a color space with an independent luminance channel, like Lab, YCbCr or YUV(NTSC), then doing histogram equalization on the luminance channel and converting the image back to RGB with the other two channels untouched will produce an enhanced image without color distortion. Overall, what you need to do in pseudo code is as follows,
img = imread(filename); yuv = rgb2ntsc(img); yuv(:,:,1) = histeq(yuv(:,:,1)); img_enhanced = ntsc2rgb(yuv);
With the source code, you are also required to submit a brief report showing the output of the program for your own test samples and explaining for what types of images histogram equalization produces good or bad visual results separately.