Auto Enhancement : This Code auto enhances the images, by working on their brightness, color and contrasts. Results are shown for reference :)
hello Dibakar, i am new in this field. i cant run the program! matlab asking me put input arguments after putting it still cant see the original and enhanced image. can you help me?
Rohan: It doesn't. In any real quality sense, it destroys them by pushing data out of gamut and causing clipping.
If I recall correctly, it appears to be an attempt to do chroma stretching in YIQ. Geometrically speaking, the goal would then be to move color points radially away from the luma axis, toward the gamut extent which is a paralleliped whose diagonal is coincident with the luma axis. The problem is not independent of luma; neither is it symmetrical WRT chroma, I or Q. You either have to stay in-gamut or have some means of dealing with being out-of-gamut when you convert back to RGB, otherwise you'll be clipping. Clipping means both hue and brightness are distorted, and local contrast information is lost.
If I recall correctly, the code in this function doesn't even bother operating along the chroma axis. It merely takes the I & Q axis means, subtracts an arbitrary number, and adds that value to the axis. This completely disregards gamut extents and any saturated, bright, or dark content will be clipped. While I think there was some min/max handling at the end, I don't think it was intended for gamut constraint, but rather as some sort of of attempt at range stretching. It happens after YIQ-RGB conversion, so the clipped data is already lost.
Consider using IMCOMPARE to analyze the output of AUTOENHANCE on one of its own example images. The image shows clear loss of local contrast, and the OOG counts show a full 29% of pixels have been truncated.
Highlighting the OOG pixels:
If all you want to do is the equivalent of slamming saturation in photoshop, you can do that using the terse syntax for the 'chroma' mode of IMLNC from the Matlab Image Manipulation Toolbox (FEX). If you don't care to do anything more analytical or nuanced, at least this keeps it from clipping:
For disclosure, I edited the code only to allow it to accept inputs and outputs from the workspace.
Can any one explain me this code how it automatically enhances images????
Re: out of gamut conditions:
This demonstrates how the problem is worse if the change in chroma is large. Dots are image pixel values after adjustment (with clamping disabled).
The simple approach to operating in YIQ is going to end up with a lot of image data being pushed out of gamut. This is especially so if stretching chroma. Truncating in RGB after conversion ends up shifting clipped regions toward the primary-secondary edges of the RGB cube (since points move parallel to the RGB axes and not the axes of the luma-chroma model). It'll also result in dramatic changes in color balance.
This can be seen in the provided images, and my own tests show about 5-20% of pixels being clipped.
If it's desired to do this sort of contrast stretching in a luma-chroma model, it might be better to truncate to gamut extents while still in YIQ.
To that end, gamut boundaries can be calculated in LCH or polar luma-chroma models as demonstrated here:
Of course, those are all cylindrical. If that's okay, something like HSY or HuSL (chroma-normalized polar variations of YPbPr or LAB/LUV) might be able to simplify things since they're normalized to the gamut boundary.
Take it with a grain of salt. I'm only commenting because I'm trying to solve these same problems. (disclosure: I uploaded maxchroma and the HSY/HuSL conversion tools)
Wan, my_limit2 and my_limit3 refer to the heuristic limits to be used to change the I and Q respectively of the NTSC converted image to "optimum" levels.
Shankar, the main aim here is to change the luminance and color profile to the "optimum" levels. To perform those, MATLAB provides built-in functions - RGB2NTSC and NTSC2RGB, so that's why NTSC system is used in the codes.
can you explain the meaning of this line in your coding:-
why did there are more than one limit?
and can u explain what is this limit refer to? i mean is that refer to hue or saturation or intensity?
tq for ur response..
pls clear my doubts. as i already asked we can use other nearest heuristic thresholds which will be applicable to this code. and one more doubt is what is purpose of converting rgb to ntsc. and why cant we use rgb to pal system... pls reply.
can u say other nearest heuristic thersholds which can be applicable to this code
With heuristic I basically meant, from my experiments those values seemed to give me the "best" results. Again the "best" here is subjective to some extent. There is no other material involved.
hi, i am new to this field. can u say what is meant by heuristic thresholds. i need materials for this program. if possible please upload it.
As said earlier, those are heuristic thresholds and nothing to do with them being positive or negative.
what would happen if those threshold levels are changed and generally we use positive threshold levels but here u used negative thresholds. what is the use of negative threshold levels here.
Those are just heuristic thresholds.
could u please tell me why u use the mylimie2=.04 and mylimit3=-.04. please reply me as soon as possible. this is my email id email@example.com. thank u
Maybe those not-brightened images won't look better if brightened. Try sending me email and then you can send me the images, will look at those. Thanks for being part of the feedback community.
thanks for this beautiful code,
This seems to be good.
I ahve tested it on no.of images .
I am getting mixed results.
For grayscale images out of 20 images 10 gets brightened but remaining are as it is.
what will be reason.
thanks in advance.
It's all about working on NTSC level to adjust the luminance and chrominance, and then doing contrast stretching.
Refer to my other codes, maybe that will help you. Cheers !!
Great! Giving good results and executing very fast (0.2sec per image).
Could please give us an explanation about the method. Can t understand anything from the code.
Small Error Fixed :)