I'd like to Discuss Retinex. I decided to do it here before submitting a bug report.
In theory the retinex operation is very useful in fixing badly lit images. In practice, I've had little success with it. So I decided to fiddle around with it. My test picture was a chinese temple on a background of blue sky. usually you want to just brighten up some darker areas or bring detail in an area that's too brightly lit, without changing the rest of the image. In my test case, The sky's color was ruined when retinex was applied and most of the well-lit areas lost most of their color.
I'll break down what happened:
1. The properties that can be changed by the sliders in the retinex dialog are not clear at all. The documentation doesn't explain the first two in terms understandable to a non-mathematician. Whatever it is they are doing, they are not helping in correcting images.
2. The result is too strong. I find I have to do a "fade" every time I use it. My suggestion: add a multiplier slider that would do an internal fade. The default should be about 0.5.
3. The algorithm is indiscriminate: it is used to fix bad lighting but it also works on well-lit areas. I believe it should have less effect on pixels (or areas) whose average luminosity value is 0.5, and more effect on pixels with values closer to 0 or 1.
I managed to achieve a selective retinex using the following method: 1. copy the layer 2. paste into quick mask 3. blur the mask using gaussian blur (8.0 radius) 4. invert the colors (only if you want to affect just the darker areas) 5. use levels or contrast to mask out the mid values 6. Perform Retinex
The above procedure can probably be turned into an integral part of retinex so that retinex only works on those parts. Perhaps adding another slider that controls the luminosity / strength ratio.
Photoshop's "lighting/shadow" algorithm has two sliders. One for choosing the strength of the effect on lighter parts of the image, and one for choosing the strength of the effect on darker parts of the image. This seems like a desirable thing to have.
Comments?