Re: [Gimp-developer] Retinex color operation

On 04/25/12 10:43, Michael Grosberg wrote:
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 (I can upload the XCF on request). 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. If it is opssible
to give them more descriptive names this would be great.

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 closer to 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).
now your light areas are masked out.
5. use levels to also mask out the mid values: in the input scale, push
the black triangle to about midpoint. This part may require a different
setting for each image.
6. go back from quick mask to image and perform Retinex.
7. Fade the result

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 emulates what I did with the levels operation, to
choose how much you want to affect midtones in the image.

Lastly a comparison to photoshop:
Photoshop's "shadow/highlight" operation (basically retinex) has two
sliders in its basic settings. 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. So basically it's like doing
what I did with masks twice, one for dark areas and one for light, and
combining the result. There are also dual extended options, one set for
dark areas and one for light areas. In it there is a "tonal width"
slider which according to the help file does pretty much what I did with
the levels operation.


I agree with your initial reaction, I found it fairly useless as it was and consigned it be yet another interesting but practically useless toy.

You experiments with masking etc are very helpful. If the filter could be made to act in a more useful manner that does not involve having to discover all this , it would be a valuable addition.

thanks for the input.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]