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.
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 email@example.com (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: firstname.lastname@example.org.