[sane-devel] "gamma" and "bayer" ? What are they?
Fri, 13 Jun 2003 00:47:24 +0200
Theodore Kilgore wrote:
> Matter of fact, I did do soem searching about "gamma" and I did come up
> with an impression, at least: It seems to be a correction for
> non-linearity of gain in the hardware (i.e. hardware does not respond in
> linear fashion to a certain kind of stimulus, so we do something to fix
Right, that's probably the most common description. Often an arbitrary
table or function is used for gamma correction, sometimes a function
like out = pow(in, x) is called "gamme correction" and x is called the
"gamma value". Occasionally, one can find 1/x being called the gamma value.
> The raw downloaded data for one 352x288 picture is exactly 352x128=101376
> bytes. If you put this directly into a file, you get a file of exactly
> 101376 bytes. If you stick a ppm header on it you have a file with a ppm
> header on it, and you get an error message if you try to view it.
For a PPM file of 352x288 pxiels you'll need 352x288x3 bytes. (1 byte
for red, one for green, one for blue)
> If I am not mistaken, this is 8-bit color, since I recall somewhere seeing
> that the camera gives 256 colors. Also this would fundamentally make sense
> to me because the actual data gives exactly one pixel per byte. So I
> guess a natural question might be, that how many "standard" ways are there
> by which 8-bit color at one pixel can be represented by one byte?
As far as i know, most if not all CCD sensors have a color filter in
front of each sensor element, so that one element "sees" only red light,
and another one only green or blue light. A camera with better firmware
will build some interpolated values for the "missing colors" of a pixel,
or the data from three sensor elements may be merged into one pixle
value. I would that your camera simply delivers the raw data.
> And as to this particular instance, I suspect the order RGB is the one
> being used, not GRB or GBR or such.
Peter already mentioned that the best way to get a clue about the color
representation within the scan data is to make photos of pure
red/green/blue areas. This should show data with repeate sequences of
two bytes with smaller values and one byte with a larger value, if my
guess is right. And if data for all colors is stored in one byte, you'll
also quickly get a clue, which bits represents which colors. But I wold
bet a few virtual beers that the camera delivers one color channel per byte.