Friday, May 28, 2010

6.Demosaicing Algorithms: Color Filtering


A more economical and practical way to record the primary colors is to permanently place a filter called a color filter array over each individual photosite. By breaking up the sensor into a variety of red, blue and green pixels, it is possible to get enough information in the general vicinity of each sensor to make very accurate guesses about the true color at that location. This process of looking at the other pixels in the neighborhood of a sensor and making an educated guess is called interpolation.

The most common pattern of filters is the Bayer filter pattern. This pattern alternates a row of red and green filters with a row of blue and green filters. The pixels are not evenly divided -- there are as many green pixels as there are blue and red combined. This is because the human eye is not equally sensitive to all three colors. It's necessary to include more information from the green pixels in order to create an image that the eye will perceive as a "true color."

The advantages of this method are that only one sensor is required, and all the color information (red, green and blue) is recorded at the same moment. That means the camera can be smaller, cheaper, and useful in a wider variety of situations. The raw output from a sensor with a Bayer filter is a mosaic of red, green and blue pixels of different intensity.

Digital cameras use specialized demosaicing algorithms to convert this mosaic into an equally sized mosaic of true colors. The key is that each colored pixel can be used more than once. The true color of a single pixel can be determined by averaging the values from the closest surrounding pixels.


Some single-sensor cameras use alternatives to the Bayer filter pattern. X3 technology, for example, embeds red, green and blue photodetectors in silicon. Some of the more advanced cameras subtract values using the typesetting colors cyan, yellow, green and magenta instead of blending red, green and blue. There is even a method that uses two sensors. However, most consumer cameras on the market today use a single sensor with alternating rows of green/red and green/blue filters.

5.Capturing Color


Unfortunately, each photosite is colorblind. It only keeps track of the total intensity of the light that strikes its surface. In order to get a full color image, most sensors use filtering to look at the light in its three primary colors. Once the camera records all three colors, it combines them to create the full spectrum.



How the three colors mix to form many colors

There are several ways of recording the three colors in a digital camera. The highest quality cameras use three separate sensors, each with a different filter. A beam splitter directs light to the different sensors. Think of the light entering the camera as water flowing through a pipe. Using a beam splitter would be like dividing an identical amount of water into three different pipes. Each sensor gets an identical look at the image; but because of the filters, each sensor only responds to one of the primary colors.


The advantage of this method is that the camera records each of the three colors at each pixel location. Unfortunately, cameras that use this method tend to be bulky and expensive.

Another method is to rotate a series of red, blue and green filters in front of a single sensor. The sensor records three separate images in rapid succession. This method also provides information on all three colors at each pixel location; but since the three images aren't taken at precisely the same moment, both the camera and the target of the photo must remain stationary for all three readings. This isn't practical for candid photography or handheld cameras.


Both of these methods work well for professional studio cameras, but they're not necessarily practical for casual snapshots. Next, we'll look at filtering methods that are more suited to small, efficient cameras.

4.Digital Camera Resolution


Digital Camera Resolution
How Many Pixels?
You may have noticed that the number of pixels and the maximum resolution don't quite compute. For example, a 2.1-megapixel camera can produce images with a resolution of 1600x1200, or 1,920,000 pixels. But "2.1 megapixel" means there should be at least 2,100,000 pixels.

This isn't an error from rounding off or binary mathematical trickery. There is a real discrepancy between these numbers because the CCD has to include circuitry for the ADC to measure the charge. This circuitry is dyed black so that it doesn't absorb light and distort the image.

The amount of detail that the camera can capture is called the resolution, and it is measured in pixels. The more pixels a camera has, the more detail it can capture and the larger pictures can be without becoming blurry or "grainy."

Some typical resolutions include:

•256x256 - Found on very cheap cameras, this resolution is so low that the picture quality is almost always unacceptable. This is 65,000 total pixels.
•640x480 - This is the low end on most "real" cameras. This resolution is ideal for e-mailing pictures or posting pictures on a Web site.
•1216x912 - This is a "megapixel" image size -- 1,109,000 total pixels -- good for printing pictures.
•1600x1200 - With almost 2 million total pixels, this is "high resolution." You can print a 4x5 inch print taken at this resolution with the same quality that you would get from a photo lab.
•2240x1680 - Found on 4 megapixel cameras -- the current standard -- this allows even larger printed photos, with good quality for prints up to 16x20 inches.
•4064x2704 - A top-of-the-line digital camera with 11.1 megapixels takes pictures at this resolution. At this setting, you can create 13.5x9 inch prints with no loss of picture quality

High-end consumer cameras can capture over 12 million pixels. Some professional cameras support over 16 million pixels, or 20 million pixels for large-format cameras. For comparison, Hewlett Packard estimates that the quality of 35mm film is about 20 million pixels [ref].

Next, we'll look at how the camera adds color to these images.

2.Digital Camera Basics

Let's say you want to take a picture and e-mail it to a friend. To do this, you need the image to be represented in the language that computers recognize -- bits and bytes. Essentially, a digital image is just a long string of 1s and 0s that represent all the tiny colored dots -- or pixels -- that collectively make up the image. (For information on sampling and digital representations of data, see this explanation of the digitization of sound waves. Digitizing light waves works in a similar way.)

If you want to get a picture into this form, you have two options:

•You can take a photograph using a conventional film camera, process the film chemically, print it onto photographic paper and then use a digital scanner to sample the print (record the pattern of light as a series of pixel values).

•You can directly sample the original light that bounces off your subject, immediately breaking that light pattern down into a series of pixel values -- in other words, you can use a digital camera.
At its most basic level, this is all there is to a digital camera. Just like a conventional camera, it has a series of lenses that focus light to create an image of a scene. But instead of focusing this light onto a piece of film, it focuses it onto a semiconductor device that records light electronically. A computer then breaks this electronic information down into digital data. All the fun and interesting features of digital cameras come as a direct result of this process.

In the next few sections, we'll find out exactly how the camera does all this.

1.Introduction to How Digital Cameras Work


In the past twenty years, most of the major technological breakthroughs in consumer electronics have really been part of one larger breakthrough. When you get down to it, CDs, DVDs, HDTV, MP3s and DVRs are all built around the same basic process: converting conventional analog information (represented by a fluctuating wave) into digital information (represented by ones and zeros, or bits). This fundamental shift in technology totally changed how we handle visual and audio information -- it completely redefined what is possible.

The digital camera is one of ­the most remarkable instances of this shift because it is so truly different from its predecessor. Conventional cameras depend entirely on chemical and mechanical processes -- you don't even need electricity to operate them. On the other h­and, all digital cameras have a built-in computer, and all of them record images electronically.


The new approach has been enormously successful. Since film still provides better picture quality, digital cameras have not completely replaced conventional cameras. But, as digital imaging technology has improved, digital cameras have rapidly become more popular.

In this article, we'll find out exactly what's going on inside these amazing digital-age devices.­