Graphics

Published on January 31st, 2019 | by Sunit Nandi

0

A Guide to Understanding Image Demosaic Algorithms

What is Demosaicing?

Demosaicing is an algorithm that a digital image processor uses to reconstruct a full-color image from the color samples output from an image sensor that’s overlaid with a color fill array.

From your smartphone camera to high-end DSLR cameras, all of them use a demosaicing algorithm to convert a captured sensor information to a color image. So what is this algorithm and why do we need it?

Why Do We Use Demosaicing?

Modern imaging sensors are made out of semiconductors which have a high number of photo-sensitive sensor elements, called sensels. When a ray of light hits a sensel, it makes an electric charge.

The amount of charge that’s created depends on the energy of the photon that depends on the wavelength of incident light. However, it modern imaging sensors, once the electric charge is made it’s no longer possible to deduce the color of light.

To create color images, current sensors don’t record all wavelengths equally at every sensor element. Instead, each element has their own color filter.

Your usual modern sensor has three distinct filler types: abbreviated red, green, and blue. In reality, all of these filler types are sensitive to all of the wavelengths.

Every sensor element records in one measurement: the charge related to a certain range of wavelengths. To reproduce an image that’s easy for consumption, we’ll need three specific measurements such as the red/green/blue values. (It’s a simplification, and in real systems, the color systems concept is used; a camera records in a camera specific color space and is then transformed to perceptual color space like Adobe sRGB).

Challenges for Demosaicing Algorithms

This description is correct for that all demosaicing algorithms use correlations among close sensels to restore missing information. However, there are about three dozen publically available proprietary and demosaicing algorithms.

Besides differences in resource complexity and requirements, these algorithms change widely in their demosaicing performance.

Without thinking about implementation concerns for a minute. What makes a good image demosaic algorithm? It has the following desirable properties.

• No visible color artifacts
• Applicable to other color filter array layouts
• Robustness to noise in the input
• No aesthetically pleasing demosaiced output images

To achieve this, the algorithm has to be adapted to the statistics of natural images. That is to have an understanding of usual image components such as edges, smooth surfaces, textures, etcetera.

Conclusion

Image demosaic algorithms for the Bayer layout is solved. But for color filter array layouts, there is no all-around efficient method. While the machine learning approach is feasible and leads to high-quality results, the current functions used aren’t sufficiently aligned with user perception to measure image quality.

Whatever algorithm is adopted, it’s beneficial to perform both denoising and demosaicing, because either task is more difficult when its done in isolation. Use this algorithm to improve the quality of your images and make your the photographic process easier.

Do you have any questions about using image demosaic algorithms?

Share in the comments below and tell us what you think!