Sign up now! · Forgot password?
RSS/Atom feed identi.ca Twitter

Retinex color operation

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

Retinex color operation Michael Grosberg 25 Apr 08:43
  Retinex color operation gg 25 Apr 09:15
   Retinex color operation Øyvind Kolås 25 Apr 10:49
Michael Grosberg
2012-04-25 08:43:04 UTC (about 2 years ago)

Retinex color operation

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.

Comments?

gg
2012-04-25 09:15:50 UTC (about 2 years ago)

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.

Comments?

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.

Øyvind Kolås
2012-04-25 10:49:48 UTC (about 2 years ago)

Retinex color operation

On Wed, Apr 25, 2012 at 11:15 AM, gg wrote:

On 04/25/12 10:43, Michael Grosberg wrote:

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. ..

Retinex is a quite specific operation, that does local contrast enhancement and whitebalancing on an image. In the GEGL tool you should find other ops that have somewhat similar intentions: fattal02, mantiuk06, reinhard05 and stress - perhaps one of them does a better job in your opinion? (some of these are rather expensive operations to compute) Like with any other op - if you want to affect only portions of an image; shadows only or similar; creating a mask to adjust which pixels are affected how much is business as usual - doing this could perhaps be made easier overall in GIMP; but integrating it in the operations themselves could almost be likened to adding a sharpening step or similar to brightness contrast/curves/blur and similar.

/

The future is already here. It's just not very evenly distributed
                        -- William Gibson
_______________________________________________
gimp-developer-list mailing list
gimp-developer-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gimp-developer-list