Skip to content

Denoise Shaders

bloc97 edited this page May 30, 2020 · 3 revisions

Example (Degraded / Processed)

Files

Anime4K_Denoise_Bilateral_Mode.glsl
Anime4K_Denoise_Bilateral_Median.glsl
Anime4K_Denoise_Bilateral_Mean.glsl

Description

Performs denoising. Decrease the noise level in an image. Different shaders have different expectation of the noise distribution.

The recommended version to use is Anime4K_Denoise_Bilateral_Mode.glsl.

Related shaders

Upscale+Denoise Shaders

Settings

#define INTENSITY_SIGMA 0.1 //Intensity window size, higher is stronger denoise, must be a positive real number
#define SPATIAL_SIGMA 1.0 //Spatial window size, higher is stronger denoise, must be a positive real number.
#define HISTOGRAM_REGULARIZATION 0.2 //Histogram regularization window size, higher values approximate a bilateral "closest-to-mean" filter.
#define INTENSITY_POWER_CURVE 1.0 //Intensity window power curve. Setting it to 0 will make the intensity window treat all intensities equally, while increasing it will make the window narrower in darker intensities and wider in brighter intensities.

Special considerations

Bilateral filters preserve edges, but when the strength values are increased (INTENSITY_SIGMA and SPATIAL_SIGMA), the three variants behave differently.

The bilateral mean filter seeks the mean as the central tendency. It is the softest and fastest of the three variants, but introduces blur when set to a high strength.

The bilateral median filter seeks the median as the central tendency. It is the slowest of the three variants, since the median is the hardest central tendency to find. At high strengths it does not blur edges, but might cause quantization-like artifacts such as banding.

The bilateral mode filter seeks the mode as the central tendency. It is faster than the median, and does not introduce blur to edges at high strengths. However it does tend to introduce some aliasing, but it is unnoticeable at higher resolutions.

Increasing INTENSITY_SIGMA in the settings will make the denoise stronger without any performance cost, but will introduce artifacts as mentioned above depending on the variant.

Increasing SPATIAL_SIGMA in the settings will make the denoise stronger and make the algorithm run slower, as it will need to look at pixels further away (larger receptive field).

Clone this wiki locally