Demosaicing explained
and how DxO does it better

DxO’s 20 years at the forefront of RAW image processing means that we can produce better results than other RAW conversion software. Here’s why.

Demosaicing: Fundamental to RAW conversion

When you trigger your camera’s shutter, all the light that strikes the sensor is recorded as RAW data, but this needs to be converted into a different format before it can be displayed on a screen. This conversion can happen inside the camera, creating output files like JPEGs or TIFFs on the memory card, or the camera can be set to record exposures as RAW files for conversion later on using software like DxO PhotoLab or DxO PureRAW.

Whatever the process, for photographers who want to reproduce the highest quality and most lifelike rendering of a scene, the standard of this RAW conversion process can be crucial.

Demosaicing is one of the essential steps in this RAW conversion. It is an objective process that is fundamental to the faithful rendering of the recorded image and should deliver the optimum basis for any subsequent, more subjective, photo editing. In this article, we’ll explain what demosaicing entails as well as reveal how the approach used by DxO can be superior to the methods employed by other software.


What is demosaicing?

When you expose your camera’s sensor to light and look at the resulting image on the camera’s screen, or your computer monitor, it’s easy to forget that the photo is not recorded in full color. In fact, the sensor records a series of values that indicate the intensity of light at each of its photosites.

These photosites are intrinsically sensitive to all light without any ability to perceive individual colors, so manufacturers overlay color filters on top of the sensor. As such, only intensity data for red, green, or blue light is recorded at each photosite — similar to the cones in the human eye. In most camera sensors, these photosites are laid out in an alternating pattern of two green photosites for each pair of red and blue ones, so the distribution is half green, one-quarter red, and one-quarter blue.

Most commonly used is the Bayer filter, shown above, but there are other designs. Fujifilm’s X-Trans cameras use a slightly different pattern that brings a few advantages and disadvantages. You can see how the pattern differs in the illustration below and you can read more about the implications here.

What this pattern of light receptors delivers is a mosaic of data that needs converting to reveal the original colors.

Without this demosaicing, all you would get is an image made up of red, green, and blue pixels of varying intensity.

However, as mentioned previously, it’s not just a question of applying demosaicing, but rather how it’s applied that leads to the most faithful rendering of detail. Bad demosaicing can cause all sorts of visual errors at the pixel level. These include color artifacts, such as fringes on sharp edges and moiré effects on some high frequency patterns, all of which look unnatural. For example, fine textures like fur or feathers can lose proper definition and see maze-like or random pixels generated within them.

genericdemosaicing_horse1@2x.jpggenericdemosaicing_horse2@2x.jpg
horses_before@2x.jpghorses_after@2x.jpg
Close up Full image

Poor demosaicing is a particular problem for photographers who are attempting to produce large scale prints with fine detail and for those who are cropping to magnify the subject, such as when enlarging a wildlife photo. Conversely, for those who are using their camera’s output at low resolution, for example for Instagram, the quality of demosaicing has less of an impact.

genericdemosaicing_good1@2x.jpggenericdemosaicing_good2@2x.jpg

The image on the left was processed using software that uses inferior demosaicing.

Good demosaicing can also be said to increase the effective resolution of the camera.

For example, even though it does not increase the pixel dimensions of an image, a camera with a 20Mp sensor and good demosaicing could still produce more detailed images than a camera with a 40Mp sensor and bad demosaicing. So with optimal processing, photographers can ensure they are maximizing the performance of their camera’s sensor.


How does it work?

Because only one-third of the actual color information in the scene has been observed, the rest needs to be extrapolated by an algorithm. There are many different demosaicing algorithms, but they all share the same objective – to take the recorded data and develop something that’s plausible to our eyes.

In its most basic form, for each pixel, those around it are sampled to predict the color. If one pixel shows a high level of green light and those around it have very low intensities of blue and red, it can be assumed that the correct color is a strong, though not pure, shade of green. But this simple algorithm assumes that each pixel has the same color as its neighbors, and while that might be true for the majority of pixels, it can be very wrong in many instances, for example where there is a sudden color variation, such as at an edge or on a texture.

To reach plausible results, the algorithm needs to make assumptions about the underlying scene. But these assumptions have to come from somewhere, so it needs to be trained.

The mosaic that makes up this tiny part of the image could have multiple interpretations. The trick is to create algorithms that can make intelligent assumptions about what the original information was and to reproduce it as accurately as possible.

What DxO does better than the rest?

Having been at the forefront of RAW image processing for 20 years, DxO’s algorithms have always been excellent. Today, we are even able to read out more pixels than the camera manufacturers themselves. That’s right — DxO might give you more pixels than what your Canon, Sony, or Leica gives you.

In addition, machine learning has given us the opportunity to push technology further. For DeepPRIME, we fed a neural network with billions of example images during its training phase, so that it could learn which structures and patterns occur most frequently in the real world, and how to recognize them in mosaiced images. The resulting algorithm, thus built on empirical knowledge, has been proven to yield better results than anything that humans alone have come up with throughout previous decades.

DeepPRIME’s great advantage is that demosaicing and denoising are not run as separate processes, with the efficacy of one potentially undermining the other. Instead, the neural network resolves both holistically and simultaneously.

Conclusion

At DxO, we’ve led the research on how to denoise and demosaic RAW files, guaranteeing photographers the best possible results. If you’re using DxO PhotoLab 7 or DxO PureRAW  4, you can be certain to get perfectly processed images thanks to cutting-edge science.

Try DxO’s software for free

Find out why photographers are switching to DxO with a free trial.

Onboarding tutorials

Access to all features

No payment details required

Discover camera and lens corrections with DxO PhotoLab 7 with DxO PureRAW  4

Try premium technical and creative software that will revolutionize your workflow.

The most advanced, end-to-end, RAW photo editing software

Learn More

Supercharge all your cameras and lenses

Learn More