Page 1 of 1

How to improve a picture with severely underexposed areas?

Posted: 2007-01-29T09:32:41-07:00
by bio
Dear IM users,
I desire to improve the quality of a serie of picture taken with a digital camera.
All the pictures presents severely underexposed areas in the bottom due to a strong backlighting.
I tried adjusting with Photoshop CS and the result was satisfactory; in particular I used the Shadow/Highlight, using these settings for Shadow: amount 50%, tonal width 50%.

"Bad" original:

Image


"Better" modified with Photoshop Highlight/Shadows function; now in the bottom area you can see more details, the sky instead is unchanged.

Image

Since the photos are taken every 5 minutes and uploaded to my web site as webcam "live" view, I need to repeat this operation every 5 minutes. So I need to use IM to do this picture enanchement.

My question: is there a function or a procedure in IM wich can do a job similar to Photoshop CS Shadows/Highlight function?

Thanks in advance

Marco

Re: How to improve a picture with severely underexposed areas?

Posted: 2009-04-08T11:16:25-07:00
by Catman
Hi,

I see this is an old question, but I have the same problem: I am working on a simple photo enhancer tool, and I would need to achive something similar with ImageMagikc (actually JMagick) like with Photoshop's Shadow/Hightlight tool. Do you have any suggestion how to do it?

Re: How to improve a picture with severely underexposed areas?

Posted: 2009-04-08T11:23:32-07:00
by Catman
Actually, I have found an interesting tutorial (unfortunately it's not for ImageMagick): http://www.ncplus.net/~birchbay/3tone/3tone.htm

Is it possible to do the same with ImageMagick?

Re: How to improve a picture with severely underexposed areas?

Posted: 2009-04-08T13:51:31-07:00
by fmw42
For some non-masking techniques, you may want to look at my scripts, redist and retinex at http://www.fmwconcepts.com/imagemagick/index.html. They are not quick, especially retinex, but can be effective. Someone could speed them up by either converting to IM functions or at least recoding with one of the IM APIs.

Here are 2 tests results from each method.

Your original image trimmed to remove the top and bottom text.
http://www.fmwconcepts.com/misc_tests/r ... m3_sub.jpg

REDIST 1:
redist -m RGB 60,60,60 cam3_sub.jpg cam3_sub_redist_rgb_60_60_60.jpg
http://www.fmwconcepts.com/misc_tests/r ... _60_60.jpg

REDIST 2:
redist -m RGB 60,90,90 cam3_sub.jpg cam3_sub_redist_rgb_60_90_90.jpg
http://www.fmwconcepts.com/misc_tests/r ... _90_90.jpg

RETINEX 1:
retinex -m RGB -f 0 cam3_sub.jpg cam3_sub_rtx_rgb_f0.jpg
http://www.fmwconcepts.com/misc_tests/r ... rgb_f0.jpg

RETINEX 2:
retinex -m RGB -f 50 cam3_sub.jpg cam3_sub_rtx_rgb_f50.jpg
http://www.fmwconcepts.com/misc_tests/r ... gb_f50.jpg

Re: How to improve a picture with severely underexposed areas?

Posted: 2009-04-08T19:21:51-07:00
by anthony
The other solution is to create a grey scale mask of your image, whcih you then threshold to divide the image into bright and dark areas. You now adjust two copys of the image appropriatally and merge them using that thresholded mask. That is a 3 image composition.

The threshold hold does not need to be sharp, but could be a 'fuzzy threshold' which you can create using a strong -sigmoidal-contrast operator instead of -threshold. The mask will have a greys for pixels that are border line between the bright and dark areas, and thus get a partial modification from the two modified images.

If I can get a small but very distinct example image(s) to play with, I'll see about putting an example of this in Photo Handling in IM Examples

Re: How to improve a picture with severely underexposed areas?

Posted: 2009-04-09T10:53:23-07:00
by Catman
Thank you for your reply! I like anthony's idea, I will try to implement it using jmagick...

Re: How to improve a picture with severely underexposed area

Posted: 2010-05-11T08:53:48-07:00
by baibaichen
anthony wrote: If I can get a small but very distinct example image(s) to play with, I'll see about putting an example of this in Photo Handling in IM Examples
hi anthony
could you try left part of this image "http://www.naturescapes.net/062004/Figure1.jpg" to show how to use sigmoidal-contrast for adjusting shadow/highlight.

By the way , I used Fred's balance script with parameter(25,0,0) for this image, the effect is not good.

Thanks
Chang

Re: How to improve a picture with severely underexposed area

Posted: 2010-05-11T11:11:33-07:00
by fmw42
try my redist script

redist cam3_s.jpg cam3_s_redist.jpg
or
redist 50,70,70 cam3_s.jpg cam3_s_redist_50_70_70.jpg

or balance script with the following arguments

balance 20,20,0 cam3_s.jpg cam3_s_balance_20_20_0.jpg

or my script, autolevel

autolevel -m 0.6 cam3_s.jpg cam3_s_al_0p6.jpg

Re: How to improve a picture with severely underexposed area

Posted: 2010-05-11T16:50:25-07:00
by anthony
baibaichen wrote:hi anthony
could you try left part of this image "http://www.naturescapes.net/062004/Figure1.jpg" to show how to use sigmoidal-contrast for adjusting shadow/highlight.
Image link is broken!

Re: How to improve a picture with severely underexposed area

Posted: 2010-05-11T18:59:04-07:00
by fmw42
NOTE: the pictures used to create http://www.naturescapes.net/062004/Figure1.jpg were probably HDRI so had more dynamic range to get a better corrected picture than the low quality versions that were actually in this figure.

original:
Image

redist 50,50,40 Figure1L.jpg Figure1L_redist_50_50_40.jpg
Image

Here is the result of an autobalance script that I am working on

autobalance -t shadows -m 0.4 -s 2 Figure1L.jpg Figure1L_autobalance_shadows_b0_m0p4_l255_s2.jpg
Image



convert cam3_s.jpg -resize 50% cam3_s2.jpg
Image

redist 50,70,70 cam3_s2.jpg cam3_s2_redist_50_70_70.jpg
Image

autobalance -t both -m 0.4 cam3.jpg cam3_s2_autobalance_both_b20_m0p4_s2.jpg
Image

Re: How to improve a picture with severely underexposed area

Posted: 2010-05-15T10:41:38-07:00
by fmw42
I have just posted a new script, duotonemap, to simulate Photoshops Shadows/Highlights function, with some improvements. see link below

(also similar to http://www.ncplus.net/~birchbay/3tone/3tone.htm, except 2tones rather than 3)

Re: How to improve a picture with severely underexposed area

Posted: 2010-05-16T19:54:21-07:00
by anthony
Also of interest is these two 'Fake HDRI' references.

http://www.nill.cz/index.php?set=tu1

http://jtrujillo.net/qpix/

This is after all what HDRI was originally invented for, though really HDRI was not needed to produce such results.

Re: How to improve a picture with severely underexposed area

Posted: 2013-04-14T11:13:51-07:00
by fmw42
bio wrote:Dear IM users,
I desire to improve the quality of a serie of picture taken with a digital camera.
All the pictures presents severely underexposed areas in the bottom due to a strong backlighting.
I tried adjusting with Photoshop CS and the result was satisfactory; in particular I used the Shadow/Highlight, using these settings for Shadow: amount 50%, tonal width 50%.

My question: is there a function or a procedure in IM wich can do a job similar to Photoshop CS Shadows/Highlight function?
I just created a new script, shadowhighlight, at the link below, to emulate the Photoshop function of the same name.