|
A $55 Webcam
by Steve
Freyder, David Helland,
& Bruce LIghtner
Start
Hardware Design Picking
a Camera Cheap CMOS Cameras
PicoWeb Server Hardware Firmware
Functions Software Design
PicoWeb Firmware Java
Applet Smile Source
and PDF
Java Applet
A Java applet was necessary for this
project because the image data returned from the Barbie Photo Designer
camera needs to be processed before it can be displayed. The camera
does not store images in a format that can be directly displayed by
a web browser (e.g., JPEG or GIF images). Instead, the camera sends
raw image data to the computer in the form of a Bayer color pattern.
The Java code causes a TCP/IP socket to be opened by the web browserıs
computer to transfer the raw picture data from the PicoWeb server,
and then to process the data as necessary into a viewable image.
|
|
| Figure 5ıThis is the pattern
of colored filters that covers the image sensor chipıs 160 ı
120 array of light sensors (pixels). The "missing"
red, green, and blue pixel values must be interpolated from
neighboring pixels of like color. |
The raw pixels from the camera come from
a 2 ı 2 red-green-blue-green Bayer array as shown in Figure 5.
Each pixel in the image sensor chip is covered by a colored filter
according to the Bayer pattern shown. There are two green pixels for
every red and every blue pixel. We need to supply a red, green, and
blue pixel for every possible pixel location in order to derive a
real image. If we donıt do this, we get a low-resolution greenish
image, as shown in Photo 3a. We do this by looking at like-colored
pixels in the neighborhood and making an intelligent guess about the
probable color and intensity of the light that struck each pixel when
the photo was snapped. (Next time you read about the latest full-color
digital camera with 2.1 million pixels, remember that in some sense,
two-thirds of the pixel data is made up!)
a) |
b) |
c) |
| Photo 3ıThe first image (a)
shows the raw pixel data from the camera (Bayer color pattern).
This image is processed by the PicoWebCam-supplied Java applet
to supply the "missing" pixels (b), then it is sharpened
(c). Believe it or not, when not enlarged, the sharpened image
looks better to most people. |
We have lots of pixel interpolation algorithms
to choose from, of varying complexity, and with a wide range of computational
requirements. Our Java applet executes a simple, fast nearest-neighbor
bilinear interpolation algorithm to quickly provide a full-color image
from the raw pixel array. The resulting image is then sharpened using
a convolution function before display. This is something that Mattelıs
PC software does in order to make their cameraıs otherwise tiny fuzzy
photos look better. Photo 3b and 3c show an enlargement of a sample
camera image after processing by the PicoWebCamıs Java applet.
An excellent discussion of Bayer color
pattern processing algorithms is titled "A Study of Spatial
Color Interpolation Algorithms for Single-Detector Digital Cameras",
by Ting Chen. [1] The basic algorithm for the image sharpening was
inspired by an article titled "Image Processing with Java 2D",
by Bill Day and Jonathan Knudsen. [2] The Java compiler used for this
project was provided by Sun Microsystems. A complete, free Java program
development kit (JAVATM 2 SDK, Standard Edition Version 1.3) is available
for downloading from Sun.
PREVIOUS
NEXT
Circuit Cellar provides up-to-date information for engineers. Visit
www.circuitcellar.com for
more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com
or subscribe online.
ıCircuit Cellar, the Magazine for Computer Applications. Posted with
permission. |