What
color are pixels captured by a digital
cameras CCD?
Oct
18, 1999
|
|
Q:
A lengthy discussion has ensued on one of the
forums concerning the color of pixels in a raw
digicam photo when enlarged on a computer so that
individual pixels can be clearly seen. There seems
to be two points of view:
1.
The digicam attempts to show color as accurately
as possible by inserting various colors into an
area as close as possible to the color of the
original scene. That is, an enlarged area of a
blue sky may show green, gray, pink or other color
pixels.
2.
Since the digicam reads a single primary color for
each pixel and then interpolates the other two
primaries and combines all into a single color
reading, each pixel in an enlarged photo should be
a replica of the original scene. That is, an
enlarged view of a blue sky should have only blue
pixels of the appropriate color.
Which
of the above two alternatives views is correct (or
is there a more correct answer)?
Rodger
C.
A:
I guess the question is interesting from an
academic point of view, but very few cameras will
let you see the original data that comes from the
CCD. I think some of Canon's cameras output a file
that is supposed to be the original unaltered CCD
data, but I don't know how unaltered that
is.
Anyway,
imagining that you could get that data, and the
camera was a single chip CCD (which most digital
cameras are) then this is what you should
see:
A
CCD is not sensitive to color; only to brightness.
To make it sensitive to color, a color filter is
placed in front of the CCD(s.) With a single CCD,
each individual element of the CCD (called a
photosite) has it's own colored filter placed in
front of it. This is typically in a Red/Green/Blue
pattern, though at least one manufacturer has used
a CMY pattern.
Continuing
with the RGB cameras, most of these use the Bayer
pattern for the filter, which actually complicates
the RGB pattern by adding twice as many green
pixels than blue and red pixels. If you search on
the web you can probably find a graphic that shows
what this looks like. This pattern was developed by
a guy at Kodak (Bayer) because the human eye is
more sensitive to green than the other colors, so
he wanted to increase the accuracy of the sampling
for greens. So for every 100 pixels, 50 will be
detecting green, 25 will measure Blue and 25 will
measure Red.
So
you point your camera at a blue sky and take a
picture. The blue light travels through the lens,
then through either a red, green or blue filter,
and then hits the CCD photosite. If you could see
the data coming from the CCD, then what you should
see is that the photosites with blue filters would
receive a lot of light, so the voltage they would
return would be high. The Red and Green photosites
would receive a lot less, so the voltage they
return would be much lower.
This
voltage is then converted into a digital value,
which represents the level of light hitting the
photosite. So the first photosite might have a high
level (because it had a blue filter), while the
second would have a very low level because it had a
green filter.
If
you had the file and could open it, the pixels
would not appear to be blue, green or red, since
the file would just contain a single value for each
pixel representing the value coming from each
photosite. In other words, the file wouldn't be in
RGB format with the Red pixel values placed in the
Red Channel, etc. Instead it would probably look
like a grayscale file that was strangely dithered,
and you'd have to know which pixel had which kind
of filter associated with it. But you would see a
widely variable brightness level from pixel to
pixel.
It
might be possible to translate that into an RGB
format to "see" the pixels as the blue, red or
green data. But no one would bother doing that.
Instead, the camera attempts to average the colors
by taking the values from surrounding pixels and
averaging them, and then saves an RGB data
file.
Got
a question? Send them to "Ask
the Guru"
|