This repository is a copy of OpenCV's contrib repository that includes our implementation of the CUDA denoiser for our research paper "Statistical Error Reduction for Monte Carlo Rendering" [Sakai et al. 2025].
We use this denoiser in our rendering implementation.
It is implemented in the cudaimgproc module (in modules/cudaimgproc/src/stat_denoiser.cpp and modules/cudaimgproc/src/cuda/stat_denoiser.cu).
With the focus on research, this code is not intended for production. We appreciate your feedback, questions, and reports of any issues you encounter; feel free to contact us!
We developed our denoiser using CUDA 12.3 and OpenCV 4.8.1. Note that later CUDA versions (>= 12.4) are incompatible with OpenCV 4.8.1. We highly recommend using OpenCV 4.8.1 to match the version of this repository.
For reproducing the results presented in our paper, we recommend using Clang 16.0.6 on Ubuntu 22.04 LTS or Linux Mint 20 (as used for the paper). While we have successfully tested GCC 11.4.0, it produces slightly different results.
-
Navigate to your OpenCV build directory.
-
Create the CMake buildsystem:
cmake \ -DCMAKE_C_COMPILER=clang \ -DCMAKE_CXX_COMPILER=clang++ \ -DCMAKE_C_STANDARD=17 \ -DCMAKE_CXX_STANDARD=17 \ -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -march=native" \ -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -march=native" \ -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc \ -DCMAKE_CUDA_HOST_COMPILER=/usr/bin/clang++ \ -DCMAKE_CUDA_ARCHITECTURES=<cuda_architecture_number> \ -DWITH_CUDA=ON \ -DWITH_CUBLAS=ON \ -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules \ -DBUILD_LIST=cudaarithm,cudev,cudaimgproc,highgui,ximgproc \ <opencv_source_directory>
Here,
<cuda_architecture_number>must match the architecture number of your graphics card. For example, for RTX 3080 Ti and A40 GPUs, the number is 86.<opencv_contrib>and<opencv_source_directory>must point to the directories containing theopencv_contribandopencvrepositories. Note that we only build the modules required for our denoiser. -
Build:
make -j 16
We thank Thomas Auzinger for providing LaTeX plugins, José Dias Curto for support with confidence intervals, and Markus Schütz for assistance with the CUDA implementation. We also thank the creators of the scenes we used: Benedikt Bitterli for "Veach, Bidir Room" (Figs. 1, S12), "Cornell Box" (Fig. 2), and "Fur Ball" (Fig. 12); Jay-Artist for "Country Kitchen" (Figs. 4, 5, 10, S2, S10, S16); Mareck for "Contemporary Bathroom" (Figs. 7, 14, S13); thecali for "4060.b Spaceship" (Fig. 9); piopis for "Old Vintage Car" (Fig. 13); Cem Yuksel for "Straight Hair" (Fig. S4) and "Curly Hair" (Fig. S5); UP3D for "Little Lamp" (Fig. S6); axel for "Glass of Water" (Fig. S7); MrChimp2313 for "Victorian Style House" (Fig. S8); NovaAshbell for "Japanese Classroom" (Fig. S9); and Beeple for "Zero-Day" (Fig. S11). Statistical simulation studies were conducted using the Austrian Scientific Computing (ASC) infrastructure. This work has been funded by the Vienna Science and Technology Fund (WWTF) [Grant ID: 1047379/ICT22028]. This research was funded in whole or in part by the Austrian Science Fund (FWF) [10.55776/F77]. For open-access purposes, the author has applied a CC BY public copyright license to any author-accepted manuscript version arising from this submission. The authors acknowledge TU Wien Bibliothek for financial support through its Open Access Funding Programme.