views:

31

answers:

1

I split color image for 3 channels and made a contrast enhancement of each channel. Then merged them together, I like the image at the result, but it has different colors. Black objects became yellow and so on...

EDIT: The algorithm I used is to calculate the 5th percentile and the 95th percentile as min and max values, and then expand the values of image so that it will have min and max values as 0 and 255. If there is a better approach please tell me.

+2  A: 

When doing contrast enhancement in color images, it is a good idea to only adjust the luminance (brightness) and leave the color information alone. This requires a colorspace conversion from RGB to something like YUV. In this colorspace, the Y component is similar to a grayscale version of the image, while the other components provide the color. This effectively allows you to adjust contrast (by running your algorithm on just the Y component) without distorting the color information. Finally, you can convert back to RGB.

Jason
Thank you, I got it, but it failed.I did it, enhanced only YUV's Y plane but the color changed..I am sure I did change the correct plane. May be my algorithm is wrong?
erjik
Sorry It is ok, I just made mistake:instead of RGB I wrote BGR
erjik