Re: Automatic Brightness and Contrast correction?

=?iso-8859-1?Q?H=E5kan=20Kvarnstr=F6m?= (Hakan.K.Kvarnstrom@telia.se)
Mon, 08 Mar 1999 12:49:55 +0100

>Håkan Kvarnström:
>> Does any one know how to achieve automated brightness and
>> contrast correction for scans made using SANE?

Jiri Baum wrote:

>Well, ppmnorm / pgmnorm would probably do most of what you're after... They
>map the ligthest pixels to white, darkest to black and interpolate (you can
>also give it the values manually). Check also pnmgamma, ppmbrighten,
>ppmflash and probably some others I've missed.

Yes, the ppm tools can be used as you describe, but the problem is that the
quality of the images will not be optimal. For example if the scanned image
has gamma values between 67 and 136 per bitplane, almost half of contrast
is lost if one let "ppmnorm" recalculate the gamma-values. What I would like
to
to is to look at the gamma-values and try to provide optimal values for both
contrast and brightness such that the resulting scan always have gamma-values
ranging from 0 to 256. In this way, the full color-range of the scanners will
be
used.
This would of course require two scans, although the first could be a fast
preview
scan. In addition, it is not clear to me how one should calculate these
correction values
for brightness and contrast using the first scan. Somehow one must know
whether
the contrast and brightness controls are linear or if the follow some other
function.

I have been told that GIMP can perform automatic gamma-correction, but
I have not had time to test GIMP yet. Hopefully, GIMP can be scripted so
that I can use it in CGI-scripts.

/ Håkan

ness values have linar
>Håkan Kvarnström:
>> I have been experimenting with "ppmhist" to create histograms of images
>> which I used to calculate correction values for brightness and contrast.
>> The problem is that it requires me to scan the same image twice.

Jiri Baum wrote:

>If you want to set the brightness/contrast directly at the scanner, you'll
>naturally have to do two scans; the first one might be just a quick
>pre-scan. Even automatic photocopiers do a quick half-scan to set
>brightness.

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com