ggcr / demosaicing

Going from a CFA RAW format image to a full-color RGB image through the process of applying the Bayer filter and Demosaicing by interpolating the missing parts of the channels with different algorithms, in the frequency and spatial domains.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Demosaicing

Digital cameras use pixel sensors that capture the amount of light is being percieved in a certain pixel. More precisely, when the camera's shutter button is pressed, light particles or photons enter the photosite cavities, our pixel cells.

This photosite cavities or pixel cells are monochromatic, or in other words, they are not able to detect colors by itself. The resulting RAW image will be a 2-dimensional array of the light values for each photosite cavities. In order to detect color a demosaicing process is done, this process consists in placing a color filter upon the monochromatic RAW image to generate the corresponding 3 channels of Red, Blue and Green and interpolate the resting colours.

Color filters

Each digital camera brands has its own color filters but the most common known is the Bayer Filter or palette. This filter is placed at the top of our photosites cavities and they will only let in the corresponding color.

Name Pattern Size Image
Bayern Filter 2x2

As we can see, we will capture twice as green. This is because the way the human see colors, we are much more sensitive to green than to red or blue. And thus, we are capturing the best representation of an image so that we can see it sharpen and detailed later on.

Demosaicing

For the process of interpolating the missing channels a bilinear process has been implemented with convolutions operations. Another advanced interpolation method has been implemented, Gradient Correction Interpolation.

References

H. S. Malvar, L. He, R. Cutler, "High Quality linear interpolation for Demosaicing of Bayer-patterned color images". 11, Dec. 2015

About

Going from a CFA RAW format image to a full-color RGB image through the process of applying the Bayer filter and Demosaicing by interpolating the missing parts of the channels with different algorithms, in the frequency and spatial domains.


Languages

Language:Python 100.0%