This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > PainShop Pro Scripting > February 2006 > Beta - PhotoCorrect script
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Beta - PhotoCorrect script
|
|
| Howard Dickson 2006-02-08, 12:24 am |
| Folks,
I've been playing around with a script to auto adjust the luminance of
an image, to bring it back to mid-luminance... a sort of auto exposure
compensation.
The script first measures a sample of the image and determines its
Luminance value. It then applies an adjustment layer and alters the
brightness to bring the luminance back to a value of 128. So a mid grey,
should always be brought back to RGB 128,128,128.
It then goes on to run Auto Colour Balance, to correct any colour cast.
I've attached an image with a couple of examples, and the beta script
for you to try. I would appreciate any comments and feedback, to see if
this will be a useful photo correction tool.
Many thanks.
Rgds,
Howard
--
---oooOOOooo---
Sheilsoft
ComputerSystems
www.sheilsoft.com
---oooOOOooo---
| |
|
| Howard Dickson <howard@REMOVEsheilsoft.com> wrote in
news:43d6b152_1@cnews:
> Folks,
>
> I've been playing around with a script to auto adjust the
luminance of
> an image, to bring it back to mid-luminance... a sort of auto
exposure
> compensation.
>
> The script first measures a sample of the image and determines
its
> Luminance value. It then applies an adjustment layer and alters
the
> brightness to bring the luminance back to a value of 128. So a
mid grey,
> should always be brought back to RGB 128,128,128.
>
> It then goes on to run Auto Colour Balance, to correct any
colour cast.
>
> I've attached an image with a couple of examples, and the beta
script
> for you to try. I would appreciate any comments and feedback,
to see if
> this will be a useful photo correction tool.
>
> Many thanks.
>
> Rgds,
> Howard
Hi Howard,
My only comment at this stage is that while it looks good on the
images you provided, they both have a wide luminence range to
start with. The script (on my brief test) will have the opposite
effect on an underxeposed snowscape, making it even darker. HTH
Regards,
JoeB
| |
| Howard Dickson 2006-02-08, 12:24 am |
| JoeB wrote:
> Howard Dickson <howard@REMOVEsheilsoft.com> wrote in
> news:43d6b152_1@cnews:
>
>
>
> luminance of
>
>
> exposure
>
>
> its
>
>
> the
>
>
> mid grey,
>
>
> colour cast.
>
>
> script
>
>
> to see if
>
>
>
> Hi Howard,
>
> My only comment at this stage is that while it looks good on the
> images you provided, they both have a wide luminence range to
> start with. The script (on my brief test) will have the opposite
> effect on an underxeposed snowscape, making it even darker. HTH
>
> Regards,
>
> JoeB
Joe,
Yeah, I don't really expect it to be effective on all shots, and
snowscapes are particularly difficult to get correct exposure/luminance.
Thanks for the feedback.
Rgds,
Howard
--
---oooOOOooo---
Sheilsoft
ComputerSystems
www.sheilsoft.com
---oooOOOooo---
| |
|
| Howard Dickson <howard@REMOVEsheilsoft.com> wrote in
news:43d6ccfe$1_2@cnews:
> JoeB wrote:
alters[color=darkred]
the[color=darkred]
opposite[color=darkred]
HTH[color=darkred]
> Joe,
>
> Yeah, I don't really expect it to be effective on all shots,
and
> snowscapes are particularly difficult to get correct
exposure/luminance.
> Thanks for the feedback.
>
> Rgds,
> Howard
>
Yes, like you I do realize the problem with snowscapes, which is
why I tested with those. I wasn't sure if you were thinking of
looking for a way to deal with those admittedly tough images but
figured I'd provide the feedback anyway just in case.
Regards,
JoeB
| |
|
| JoeB wrote:
> Howard Dickson <howard@REMOVEsheilsoft.com> wrote in
> news:43d6b152_1@cnews:
>
>
>
> luminance of
>
>
> exposure
>
>
> its
>
>
> the
>
>
> mid grey,
>
>
> colour cast.
>
>
> script
>
>
> to see if
>
>
>
> Hi Howard,
>
> My only comment at this stage is that while it looks good on the
> images you provided, they both have a wide luminence range to
> start with. The script (on my brief test) will have the opposite
> effect on an underxeposed snowscape, making it even darker. HTH
>
> Regards,
>
> JoeB
This is what I get using PSPX. I tried both checking and unchecking the
Execution mode button:
Executing FileOpen
Executing RunScript
Executing GetMaterial
Traceback (most recent call last):
File "D:\My PSP
Files\Scripts-Restricted\SsoftzPhotoCorrectBETA\SsoftzPhotoCorrectBETA.PspScript",
line 117, in Do
col= Mat['Color']
TypeError: unsubscriptable object
Script 'SsoftzPhotoCorrectBETA' has completed with an error.
Executing RunScript
Executing ReturnImageInfo
Executing Resize
Executing Eyedropper
Executing UndoLastCmd
Executing Resize
Executing SetMaterialStyle
Executing GetMaterial
Traceback (most recent call last):
File "D:\My PSP
Files\Scripts-Restricted\SsoftzPhotoCorrectBETA\SsoftzPhotoCorrectBETA.PspScript",
line 117, in Do
col= Mat['Color']
TypeError: unsubscriptable object
Script 'SsoftzPhotoCorrectBETA' has completed with an error.
Hope this helps!
Gloria
| |
| Spandex Rutabaga 2006-02-08, 12:24 am |
| Howard Dickson wrote:
>
> Folks,
>
> I've been playing around with a script to auto adjust the luminance of
> an image, to bring it back to mid-luminance... a sort of auto exposure
> compensation.
A few suggestions:
You use HSL L as a measure of luminance. This is one of the less
perceptually oriented ways of estimating how a human responds to
brightness. You may be able to improve things there by using a
different expression for luminance.
You treat images with mean L less than 128 in the same way as
those with average L higher than 128. My suspicion is that you
need an unsymmetrical approach because human contrast sensitivity
does not have a symmetric peak about some mean brightness. In
other words, the human ability to see detail in light and in dark
regions is not the same. Alternatively, a given size of brightness
step isn't equally easy to notice or detect in bright as in dark
regions.
You use a Brightness/Contrast Adjustment layer. This is a bad
thing to do because the filter takes an image value and either
adds an offset to it or subtracts an offset from it. The end result
is that the histogram is slid left or right along the color channel
value axis. Whenever it hits either end of this axis clipping of
color values occurs leading to permanent loss of image information.
This has happened in your images. Both of the images have had their
histograms shifted to the right and the histogram is piled up
against the right (upper) edge of the luminance range, indicating
clipping. The location of this clipping is shown as the white
areas in the attachment, which was thresholded at 254. Instead of
sliding the histogram off the channel value axis it is better to
alter the balance between amount of shadows and the amount of
highlights in your image. You can do this with Gamma Correction
and you won't have clipping. On the other hand if you have
underexposed images which don't use the full brightness range you
won't have corrected for that. To cope with this you could try
to do a Histogram Stretch to full range before applying the
estimated Gamma Correction. Most images should be using the full
available brightness range. (An exception might be something like a
close-up shot of a pastel wall, pastels being light by definition
and having no dark component, but that is a rarely encountered
situation.)
It might be helpful to compare the mean brightness around the
"border" of the image with the mean brightness at the "center" of
the image. This could provide a way to respond to backlit scenes
or to do a better job on snow or beach scenes. I've used quotes
since I can't say what the best definition of these two quantities
would be but a subdivision of images in this way has been used
in auto-exposure compensation during conventional photo film
development.
Getting this to work well requires two things I think. First, you
need a good strategy for estimating improvement. At a minimum the
estimated change must always be in the correct direction. Second,
you need a strategy for limiting excessive changes so that even if
the script doesn't produce an optimal improvement it never makes the
image worse.
My own personal belief is that trying to make this work is fraught
with difficulty since a backlit object on a light background (which
object needs correction) and an authentically dark object on a light
background (which is already correctly exposed) produce the same
brightness distribution for an image. How a script can reliably tell
these two things apart is not clear to me.
One thing puzzles me. In your car example the original image has a
vaguely sepia (purplish brown) tinge. However, the result image
looks desaturated and very close to pure greyscale. That doesn't
seem like the correct result. Perhaps it's the result of having the
Auto Color Balance step in the script.
| |
| Spandex Rutabaga 2006-02-08, 12:24 am |
| Spandex Rutabaga wrote:
> [Image]
Apologies for all the spelling errors in the text of the previous
attachment. "Brightness differences" not "brighness differences".
"Despite initially" not "despite iintially".
| |
| Andy Forrester 2006-02-08, 12:24 am |
| Howard,
I tried this out on PSP X and it seems to work fine
andy f
"Howard Dickson" <howard@REMOVEsheilsoft.com> wrote in message
news:43d6b152_1@cnews...
> Folks,
>
> I've been playing around with a script to auto adjust the luminance of
> an image, to bring it back to mid-luminance... a sort of auto exposure
> compensation.
>
> The script first measures a sample of the image and determines its
> Luminance value. It then applies an adjustment layer and alters the
> brightness to bring the luminance back to a value of 128. So a mid grey,
> should always be brought back to RGB 128,128,128.
>
> It then goes on to run Auto Colour Balance, to correct any colour cast.
>
> I've attached an image with a couple of examples, and the beta script
> for you to try. I would appreciate any comments and feedback, to see if
> this will be a useful photo correction tool.
>
> Many thanks.
>
> Rgds,
> Howard
> --
>
> ---oooOOOooo---
>
> Sheilsoft
> ComputerSystems
>
> www.sheilsoft.com
>
> ---oooOOOooo---
>
--------------------------------------------------------------------------------
| |
| Howard Dickson 2006-02-08, 12:24 am |
| Spandex Rutabaga wrote:
> Howard Dickson wrote:
>
>
>
> A few suggestions:
>
> You use HSL L as a measure of luminance. This is one of the less
> perceptually oriented ways of estimating how a human responds to
> brightness. You may be able to improve things there by using a
> different expression for luminance.
>
> You treat images with mean L less than 128 in the same way as
> those with average L higher than 128. My suspicion is that you
> need an unsymmetrical approach because human contrast sensitivity
> does not have a symmetric peak about some mean brightness. In
> other words, the human ability to see detail in light and in dark
> regions is not the same. Alternatively, a given size of brightness
> step isn't equally easy to notice or detect in bright as in dark
> regions.
>
> You use a Brightness/Contrast Adjustment layer. This is a bad
> thing to do because the filter takes an image value and either
> adds an offset to it or subtracts an offset from it. The end result
> is that the histogram is slid left or right along the color channel
> value axis. Whenever it hits either end of this axis clipping of
> color values occurs leading to permanent loss of image information.
> This has happened in your images. Both of the images have had their
> histograms shifted to the right and the histogram is piled up
> against the right (upper) edge of the luminance range, indicating
> clipping. The location of this clipping is shown as the white
> areas in the attachment, which was thresholded at 254. Instead of
> sliding the histogram off the channel value axis it is better to
> alter the balance between amount of shadows and the amount of
> highlights in your image. You can do this with Gamma Correction
> and you won't have clipping. On the other hand if you have
> underexposed images which don't use the full brightness range you
> won't have corrected for that. To cope with this you could try
> to do a Histogram Stretch to full range before applying the
> estimated Gamma Correction. Most images should be using the full
> available brightness range. (An exception might be something like a
> close-up shot of a pastel wall, pastels being light by definition
> and having no dark component, but that is a rarely encountered
> situation.)
>
> It might be helpful to compare the mean brightness around the
> "border" of the image with the mean brightness at the "center" of
> the image. This could provide a way to respond to backlit scenes
> or to do a better job on snow or beach scenes. I've used quotes
> since I can't say what the best definition of these two quantities
> would be but a subdivision of images in this way has been used
> in auto-exposure compensation during conventional photo film
> development.
>
> Getting this to work well requires two things I think. First, you
> need a good strategy for estimating improvement. At a minimum the
> estimated change must always be in the correct direction. Second,
> you need a strategy for limiting excessive changes so that even if
> the script doesn't produce an optimal improvement it never makes the
> image worse.
>
> My own personal belief is that trying to make this work is fraught
> with difficulty since a backlit object on a light background (which
> object needs correction) and an authentically dark object on a light
> background (which is already correctly exposed) produce the same
> brightness distribution for an image. How a script can reliably tell
> these two things apart is not clear to me.
>
> One thing puzzles me. In your car example the original image has a
> vaguely sepia (purplish brown) tinge. However, the result image
> looks desaturated and very close to pure greyscale. That doesn't
> seem like the correct result. Perhaps it's the result of having the
> Auto Color Balance step in the script.
>
>
> ------------------------------------------------------------------------
>
Spandex,
I take onboard everything you have said. This has been a difficult
script from the beginning, and I have tried various methods to achieve
the desired effect. The sampling and use of L from the HSL values is, I
know, not ideal, but I think I may stick with it, although as you
suggested, I may extend the sample areas to include an averaged method
from the middle of the image and the outer edges.
I have tried using different corrective techniques including blending
two layers with Screen and Multiply blend modes, and I have tried using
Histogram Stretch also with, as you might guess, variable results. The
real problem I'm trying to keep away from is blown highlights,
particularly problematic with high contrast originals. I was finding
that using Clarify instead of Contrast adjustment at the end of the
script kept the high end just within bounds. Yes, the histogram was
pushed to either end, but I found the the highlights were 'just' in
scale (not quite 255,255,255), although that again depends on the
original. Shadows, as any photographer will tell you, are less
problematic, but I would prefer to keep them in range with a minimum of
clipping.
I have deliberately put this up in beta form, because as a photographer,
I am not totally happy with it myself, because of some of the reasons
you have mentioned, and I do appreciate the time you have taken to give
me your thoughts. Obviously 'serious' photographers will deal with these
exposure problems with dedicated RAW post-processing software (I for
instance use Nikon Capture), but I do think that there is a use for a
script, something like this, although there will be limits to what it
can realistically achieve, particularly on problematic images, where
there may have to be sub-routines for certain conditions. I'll be
putting more work into it, and may offer up further betas for comment.
I should have mentioned in my first post, that the beta script I
attached was written for PSP9, but could easily be edited for other
versions.
Thanks again for the feedback and comments, and I look forward to any
further views or ideas on the matter. This is a difficult one (for me
anyway) with many techniques and tweaks to investigate, and I appreciate
an open discussion.
Rgds,
Howard
--
---oooOOOooo---
Sheilsoft
ComputerSystems
www.sheilsoft.com
---oooOOOooo---
| |
| Spandex Rutabaga 2006-02-08, 12:24 am |
| Howard Dickson wrote:
> Thanks again for the feedback and comments, and I look forward to any
> further views or ideas on the matter.
Just don't be discouraged by my comments :) They are meant as an
encouragement and as suggestions for how to make more headway.
|
|
|
| | Copyright 2003 - 2009 forum4designers.com Software forum Computer Hardware reviews |
|