[sane-devel] "gamma" and "bayer" ? What are they?

Theodore Kilgore kilgota@banach.math.auburn.edu
Thu, 12 Jun 2003 10:58:39 -0500 (CDT)


Well, it seems that my inquiry got some interest, for which I thank
everyone who responded. I will try to follow down some of the leads, after
writing the Calculus III test I have to give tomorrow. Meanwhile, a
couple more comments/questions/responses:

On Thu, 12 Jun 2003, Henning Meier-Geinitz wrote:

> On Wed, Jun 11, 2003 at 07:51:40PM -0500, Theodore Kilgore wrote:
> > What are "gamma"
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

> > and "bayer"
> I don't really understand what you mean by "whitespace".

What I meant by "whitespace" is the blank spots between bytes in a file.
For example,

bc 3f

and what is between the c and the 3 I am calling "whitespace."

> Interpolation is usually used to create resolutions higher than
> supported by hardware. It's just a marketing gag, you don't get better
> images, just bigger ones.

Maybe so, but:

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.

However, if you take the log data output containing the same 101376
bytes, then you have the bytes represented in the form of text as two
characters each, with a space between each two successive bytes.

So when you remove all material from the log file except the actual
data downloaded for a picture you have 101376 bytes of data, which
now get saved as a file. The actual size of the file thus created is
3x101376 = 304128 bytes, which presumably happens because now each byte is
represented by two characters (requiring one byte each) plus one empty
space (the third byte).

Addition of a ppm header to the edited log output then creates a .ppm file
of size 304143 bytes, which is then a viewable picture. Just not a very
good one.

Addition of a bmp header instead of a ppm header produces ( after
adjustment by, for example, removing the last byte of empty space) a file
of size 304182 bytes, which is the size identical to the file size
produced by the Windows driver software. Again, it is a viewable picture,
which looks the same as the ppm file but with some colors switched seems
that ppm and bmp handle endian-ness differently; the colors come out
closer to right in the ppm version).

Whether the bmp file is viewed with the Windows software or with Linux
software is also immaterial. Also it does not matter whether the bytes
from the log file were downloaded with the stock driver or with my own
programming. I have checked this.

> Example:

(Example was clear, thanks)

> The scanners return image data in lots of differnt formats. E.g. 8,
> 10, 12, 16 bits/color, all the pixels of one color after each other,
> or all the colors of one pixel after each other and so on.

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?

And as to this particular instance, I suspect the order RGB is the one
being used, not GRB or GBR or such.

> Maybe your data is also compressed?

Possibly, but the way it is compressed it is exactly 1/3 the size and it
is also possible to get a picture resembling the original out of the log
output, so my instincts would be against this. Of course, I have been
wrong on occasions.

> Or it's transferred as a jpeg?

I really don't expect this. The camera is really an el cheapo. If I told
you how it downloads data you would probably not believe me. Thomas, my
13-year-old, says it is "brain dead." So I don't think it knows how to
pronounce "jpeg." Besides, exactly one byte per pixel ???

Thanks for the help.

Ted Kilgore