Debayer comparison: NPP vs CUVI

Comparison performed using CUDA toolkit version 9.1 and CUVI release 1.55 on an underlying core i3-6100, GTX 1080 system and benched with NVIDIA Nsight.

CUVI and NPP both have been in market for almost a decade now. NVIDIA’s own performance primitive library (NPP), which started as a CUDA-alternative to IPP, now has hundreds of functions over its decade long releases. These functions provide a quick way to prototype applications on massively parallel GPUs without much of a learning curve. CUVI (CUda Vision and Imaging) SDK, on the other hand, with its limited functionality, provides the most cutting edge computer vision solutions and offers production quality verticals for various domains.

In this post, I will be comparing one of CUVI’s most popular feature; debayer with its counterpart in NPP. It’s fair to mention that NPP’s debayer offers only bi-linear approach: “Missing pixel colors are generated using bi-linear interpolation with chroma correlation of generated green values“. This is the most basic approach to regenerate a colored image from CFA and is prone to artifacts at high feature regions. For a much better regeneration, CUVI offers the newer, much improved DFPD approach to debayering.

Continue reading “Debayer comparison: NPP vs CUVI”

Robust DFPD debayer algorithm now in CUVI

Continuing the legacy to provide the best imaging algorithm at lightning fast speed, we are proud to announce the addition of DFPD debayer algorithm in CUVI which is more robust than the existing demosaic and shows no artifacts at high feature areas. The previous implementation of demosaic algorithm (which uses bilinear interpolation) is super fast giving a throughput of more than 500 fps on full HD image on a common GPU yet it has its downside.

Since color planes have severe aliasing, a simple interpolation (or HQ bilinear interpolation for that matter) of the individual planes has little effect in removing the artifacts that appear at high feature regions. Hence we need a a better reconstruction approach:


Not only the new algorithm removes artifacts at high-feature regions, the colors get more natural and crisp. This is due to the fact that DFPD (directional filtering with posteriori decision) algorithm better estimates the green plane taking into account the natural edges of the image and then reconstruct the missing red/blue pixels based on that reconstructed green image instead of calculating all values directly.

This huge improvement over the existing implementation comes at a price: more computational cost. The DFPD algorithm is almost half as slow as the previous one, however, it still gives a whopping 263 fps on a full HD image. Note this time excludes the memory transfers. And as always as in CUVI you can use this GPU accelerated DFPD debayer with just three lines of code:

CuviImage input("D:/bayer.tif", CUVI_LOAD_IMAGE_GRAYSCALE_KEEP_DEPTH), output;
cuvi::colorOperations::demosaic_DFPD(input, output, CUVI_BAYER_RGGB);
cuvi::io::saveImage(output, "D:/debayered.png");

There’s an additional refinement step (optional) that comes with DFPD to further refine the pixels values and cut down the unnatural high frequencies. By default, it’s set to false but you can enable it with a flag:

// Further refine the results
cuvi::colorOperations::demosaic_DFPD(input, output, CUVI_BAYER_RGGB, true);

Download the latest cuvi from here or get more information on the features at our wiki.

CUVIlib - CUDA Vision & Imaging Library - is a simple to use, GPU accelerated computer vision SDK. The library is available for download for free for personal unlimited use. For more information, visit our website at