Bilateral Denoiser Filter
Filter
RIF_IMAGE_FILTER_BILATERAL_DENOISE
Description
A bilateral filter is a non-linear, edge-preserving, and noise-reducing smoothing filter for images. It replaces the intensity of each pixel with a weighted average of intensity values from nearby pixels. The filter is constructed on the basis of a Gaussian blur, but the weights depend not only on the Euclidean distance of pixels. The weighting function of pixels is also affected by the difference in the values of the auxiliary buffers (depth, normal, mesh IDs etc.) at this point and at the center. This preserves sharp edges.
The filter can use an arbitrary number of images. A Gaussian function is used as the similarity function.
Parameters
Parameter |
Type |
Input/Output |
Description |
---|---|---|---|
inputs |
array of images |
input |
The array of ancillary images. |
sigmas |
array of floats |
input |
The array of coefficients of the similarity function. This coefficient can be considered as a threshold for border detection. The smaller the coefficient, the better the borders are preserved, but the noise level increases. |
radius |
uint |
input |
The radius of the region that is used for output color computation. |
inputsNum |
uint |
input |
The number of images (images arrays size). |
Usage Example
std::vector<rif_image> inputs;
std::vector<float>sigmas;
inputs.push_back(img0);
inputs.push_back(img1);
//.......................
inputs.push_back(imgN);
sigmas.push_back(0.1);
sigmas.push_back(0.3);
//.......................
sigmas.push_back(0.25);
rifContextCreateImageFilter(context, RIF_IMAGE_FILTER_BILATERAL_DENOISE, &filter);
rifImageFilterSetParameterImageArray(filter, "inputs", &inputs[0], inputs.size());
rifImageFilterSetParameterFloatArray(filter, "sigmas", &sigmas[0], sigmas.size());
rifImageFilterSetParameter1u(filter, "inputsNum", inputs.size());
rifCommandQueueAttachImageFilter(queue, filter, inputs[0], outputImage);
rifContextExecuteCommandQueue(context, queue, nullptr, nullptr, nullptr);
Results
Input image |
Normals |
Diffuse |
Output image |