Demosaicing quality check on your own images
Updated:
Before a demosaicing algorithm goes into a working pipeline it is worth seeing what it does to your own frames. This command-line tool converts raw Bayer data into full-colour RGB on the GPU and measures the result. It runs several demosaicing algorithms of different quality and speed on NVIDIA CUDA, measures PSNR/MSE against reference images and reports timing for every algorithm — so you can choose the right quality-vs-speed trade-off before building a production pipeline.
Why run demosaicing on the GPU
- Converts 8/16-bit Bayer data into 24/48-bit RGB much faster than any CPU implementation
- High image quality with strong colour moire suppression
- Instant per-algorithm timing and performance figures
- Built-in quality check: PSNR and MSE against an etalon image
- Simple command-line workflow, easy to script and to benchmark
Demosaicing algorithms: quality and speed
All four Bayer patterns are supported (RGGB, BGGR, GBRG, GRBG). Image quality is measured on the Kodak data set; peak speed is GPU computation only for a 65 MPix, 16-bit image (no batch, no streaming) on an NVIDIA GeForce RTX 4090.
| Algorithm | Window | Avg PSNR, Kodak | SSIM | Peak speed, RTX 4090 |
|---|---|---|---|---|
| HQLI — High Quality Linear Interpolation | 5×5 | ~ 36 dB | ~ 0.965 | up to 69 GPix/s |
| L7 | 7×7 | ~ 37.1 dB | ~ 0.971 | up to 62 GPix/s |
| DFPD — Directional Filtering and a Posteriori Decision | 11×11 | ~ 39 dB | ~ 0.978 | up to 48 GPix/s |
| MG — Multiple Gradients (highest quality) | 23×23 | ~ 40.5 dB | — | up to 20 GPix/s |
Input, output and limits
- Input: 8/16-bit CFA images in PGM format from HDD/SSD/RAID; a built-in mosaic tool can also build a CFA image from any 24/48-bit PPM
- Output: 24/48-bit PPM
- Resolution from 128×128 up to 16,000×16,000 pixels and beyond
- Optional enhance mode for improved debayering
- Batch mode, pyramid images and tiling for multi-camera systems with real-time debayering
- Command-line demo application for Windows and Linux
How it fits the Fastvideo ecosystem
These demosaicing algorithms are the same ones used inside the Fast CinemaDNG Processor and the Fastvideo SDK, where debayer is a single stage of a full GPU pipeline — dark-frame subtraction, flat-field correction, white balance, denoising, colour correction, tone mapping, resizing, sharpening and JPEG/JPEG2000/H.264 encoding. The standalone debayer application is a convenient way to evaluate demosaicing quality and speed before committing to a heavier service.
Roadmap
- High-quality MG debayer (Kodak average PSNR ~ 40.5 dB) – done
- 16-bit MG debayer integrated into Fast CinemaDNG Processor – done