Modern digital SLR cameras are as much computer as anything else. With the large multi-megapixel images that they generate, they use a great deal of processing power to turn their sensor's data into a photograph file. Modern SLRs also use algorithms to help them both set correct exposure and to automatically focus the lens.
Colorization Algorithms
- Believe it or not, just about every SLR sold uses a black-and-white sensor. A Bayer filter is placed over the sensor to make each pixel sensitive to either red, blue or green light with twice as many pixels sensitive to green light as to red or blue light. In other words, a 10-megapixel camera shoots an image consisting of 5 million pixels of green light, 2.5 megapixels of red light and 2.5 megapixels of blue light. The camera then uses a dematrixing algorithm to create the missing data to generate a file which contains 10 million pixels of full-color data.
File Compression Algorithms
- After the camera generates the image, it comes out as a very large file. A 10-megapixel image would be 30 megabytes large, assuming 24 bits of color data per pixel. To generate files of a more reasonable size, the camera's image processor passes the file through a compression algorithm. This algorithm eliminates unnecessary data and, at times, even some fine visual detail to generate a compact JPEG file. While compression levels vary, a 30-megabyte file could easily be reduced to 1.5 megabytes -- 5 percent of its original size.
Autofocus Algorithms
- SLR cameras typically use a complicated phase-detection system to determine if a given point in an image is in focus. Choosing what parts of an image should be in focus, though, is done by an algorithm. The simplest autofocus systems just focus on whatever is in the center of the image. This requires an algorithm to measure when the image reaches its sharpest point. Advanced cameras use algorithms to analyze multiple focal points to focus on such things as the largest item in the frame, an item in motion or even a face.
Exposure Algorithms
- Setting correct exposure requires a number of algorithms. The simplest autoexposure algorithm, spot metering, simply sets a small point in the center of the image to expose as a medium-gray tone. Matrix exposure algorithms compare the entire image to a database of images to try to find an exposure setting that can reflect the whole scene's light profile.