Re: Adjusting contrast and brightness

Matthias Fleischer (FLEISCHER@ito311.ito.uni-stuttgart.de)
Fri, 4 Dec 1998 10:39:54 CET

> Well, then I suppose we can begin to make a few conjectures. One
> approach would be to interactively modify the appearance of the
> preview image based on the current settings of the controls. This
> could be done based on a calibration run performed on a test image
> which would record the behavior of the scanner at various settings.

Or by scanning the preview with a linear lookup-table that stretches
over the whole dynamic range of the scanner. Modifications could then
be applied to this image with the same LUT that is sent to the scanner
for normal scans. Scanners that don't use a LUT (do they exist?) will
be more difficult, though.

> A real-time display of the brightness histogram of the preview image
> might be a useful stopgap measure.

Indeed. A combined RGB histogram might be useful, too. Keep in mind
that a LUT (i.e. any operation applied on a per-pixel basis) does not
produce intermediate color values but just reorders the buckets that
are already there. So a little lowpass-filter should be applied to
the histogram curves to make them look fine. A binomial-filter might
be a good one.

> Having the software actually select the contrast and brightness and
> gamma is a lot trickier, with subjective elements. Its one of those
> problems, like the travelling salesman problem, that are impossible in
> theory but solved in practice every day. Are the algorithms for doing
> this proprietary, or are there no image processing experts here? I
> know about image synthesis, but not much about image processing.

Not that I'm an expert, but from my experience simply stretching the
histogram so that the darkest and brightest color become black and
white gives excellent results for greyscale images. Noise can
be ignored if you drop the lower and upper 0.5% of the histogram.
Gamma should be used with care since it often increases noise.
This doesn't work for all pictures, but if there are any secret
algorithms out there (used in photo labs) they show their flaws for
difficult pictures, too.
(Ever tried to have some fireworks pictures developed in a cheap photo
lab?)

Matthias

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