[sane-devel] gain/offset tables

Matthew Duggan stauff@guarana.org
Tue, 6 Nov 2001 10:23:48 +1100


Gday,

>
> Anyone's scanner do something similar?  Got code or math I can steal?
>

The FB330P/FB630P behave the same way, and probably have the same CCD
sensor.  If you can understand Simon's code, then feel free to use it.  The
adjust_output() method in canon_pp-dev.c is probably most useful for your
purposes.  It takes an RGB-ified image block and applies the calibration
data to bring the colours to the correct levels.

The basic maths that we use is to subtract off the "black" level (since it's
considered 0) then scale the value so that the "white" level is the maximum
(1024 in this case since it's got 10 bit colour depth).  Graphically, if lo
is the black level and hi is the white level:

0 ... lo .......... hi ......... 1024
             ^- raw sample point

lo.................................hi
                 ^- scaled sample point


For the code, grab the "sane" module out of cvs on our sourceforge site:
https://sourceforge.net/projects/canon-fb330p


Cheers,

Matthew Duggan
http://canon-fb330p.sourceforge.net