OpenCine.SHOODAK2
This algorithm tackles demosaicing with an entirely different approach. It tries to keep the image as natural as possible, without oversharpening the image. For the desired effect, it uses a random generator for the Green channel. To attenuate the excessive artifacts at the edges, SHOODAK2 was modified with a new edge sensing system that can be adjusted.
Overall, SHOODAK2 provides a sharper and rougher image than Green Edge Directed Interpolation, while having slightly more artifacts and a even higher processing time.
Associated Files |
---|
SHOODAKDebayer.cpp |
SHOODAKDebayer.h |
1 Constructor
SHOODAK2 shares the same constructor code as [1] and Green Edge Directed Interpolation.
2 Pattern Offsets
The algorithm uses the index of the four sensels in the first 2x2 image block as the pattern offsets.
Illustration of the chosen pattern offsets for a RGGB pattern image |
---|
|
Those pattern offsets are useful for choosing the desired pixel inside each 2x2 pixel block in the demosaicing methods.
3 SHOODAK2
The Process method executes the SHOODAK2 Interpolation. It starts by running the following methods for demosaicing: DebayerRed, DebayerGreen, and DebayerBlue, while taking in account the image’s Bayer pattern. Those methods are used to demosaic the Red, Green, and Blue channels of the image.
SHOODAK2 approach to demosaicing differs regarding the position of the reference point. While in the other algorithms the reference point is in the center of a pixel, in this case, the reference point is in the center of a 2x2 pixel block. This approach causes a horizontally and vertically shift of half pixel in the output image.
The demosaicing methods for the Red and Blue channels are very similar - For each new pixel, the value will be the value of the nearest sensel relative to the reference point.
Red and Blue channels demosaicing |
---|
For each block of 2x2 reference points, the algorithm will set the value of the four new pixels. As such, there is a simple calculation involved: |
For the Green channel, however, there are some differences due to the existence of two near sensels for each reference point. The algorithm randomly chooses one of the sensels as the new value. By choosing directly a sensel instead of averaging the sensels’ values, it achieves a rougher and sharper image. However, this causes a lot of issues on edges (artifacts), which are solved with an edge sensing algorithm.
Green channel demosaicing |
---|
In the case of Green channel, the simple calculation is different: |
Finally, the last step is to demosaic the borders, using DemosaicBorders for each color channel. This method simply copies the nearest pixel that is not in the image border.