nomacs – Puzzle for GSoC


check out the code from our SVN repository:
or download the source from sourceforge.
Here are two test images for your loader.


Your task is to implement a Bayer pattern filter:

  • use LibRaw to get the RAW Data (and the metadata)
  • implement a simplified demosaicing algorithm

Using LibRaw you get the raw Bayer pattern. Your task is to compute the missing color values at each pixel to produce a full RGB image (3 values per pixel). Do this by a linear interpolation of values from adjacent pixels, as depicted below.

You should implement the Bayer filter in DkImage.cpp -> bool DkImageLoader::loadRawFile(QFileInfo file); in line 535. The current method simply loads the RAW data and displays the picture as is. The pixel interpolation should be implemented without using a function from an external library (e.g. cvtColor(img, img, CV_BayerRG2BGR)). The loops in line 558 manipulate the image buffers. Adopt these lines for your bayer implementation. We have added a simple OpenCV bayer implementation (starting in line 570). Use this method to visually compare your implementation.

Averaging over the 4 or 2 nearest neighbors for image demosaicing (please note that this figure is intended to illustrate the demosaicing principle; it does not reflect the actual Bayer pattern of the digital camera used).

Pick an interesting patch of the image and show the image before and after de-mosaicing. See if you can find artifacts that can be corrected if a “better” algorithm is applied and explain the reasons compared to state of the art methods.


Please send your solution to (you just need to attach DkImage.cpp).


If you have any questions concerning the puzzle itself, compiling or anything else don’t hesitate to contact us:

Leave a Reply

Your email address will not be published.