[sane-devel] any drivers do software calibration?

Henning Meier-Geinitz henning@meier-geinitz.de
Thu, 5 Jun 2003 22:35:43 +0200


Hi,

On Thu, Jun 05, 2003 at 02:59:04PM -0400, m. allan noah wrote:
> with the adf fujitsu scanners, in grayscale or color, we get fine, lightly 
> colored lines as a part of the scanned image,

Vertical lines?

> and the 'background' behind the document when the scan window
> exceeeds the size of the paper looks mottled gray, as reported on
> this list.

That may be the result of the selected gamma, brightness and contrast.

> i can find no way in the interface manual to prevent this in hardware, 
> though it has been reported that the same scanners under twain do not 
> display these problems.
> 
> hence, i assume that this can be corrected in software. are any of the 
> existing sane backends doing this internally? i would like to do something 
> similar as an option in the fujitsu backend...

The gt68xx backend does calibration completely in software. I think
mustek_usb does this also, other backends of the more low-level
scanner may use the same scheme.  All scanners supported by the gt68xx
backend have a white calibration strip at the top of the scanning
area. It's visible if you open these scanners.

Calibration works about like this:

a) Coarse calibration: The scan bar moves to the calibration strip.
   The gain and offset values of the analog frontend are setup so the
   brightest white of the calibration strip is defined as white (255)
   and the darkest black is 0. You get black by either turning offf
   the lamp or by scanning a small black mark on the strip.
b) Fine calibration: The scan bar scans some milimeters of the white
   strip in full width. Once with the lamp turned on and once with the
   lamp turned off. So you get two values per pixel per color, one for
   max white and one for min black.

If you do a real scan you can calculate the resulting pixel color like
this (from my memory, untested):

real_color = 255 * (scanned_color - min_black) / (max_white - min_black)

Bye,
  Henning