This algorithm is used to reduce both spatial and temporal noise in video sequences. Noise levels can vary significantly depending on lighting conditions, camera sensor sensibility and quality, etc. VPI's temporal noise reduction is more suited to handle thermal and shot noise, which follow gaussian and poisson distributions respectively.
There are currently 3 versions of the algorithm, with varying degrees of speed, configurability and quality. Not all always available in a given backend and platform combination.
Noise reduction factor can be customized by means of two parameters: scene lighting condition and strength (a value between 0 and 1). Setting it to low light scenes results in increased reduction strength, but might result in loss of detail in highly textured regions or even some ghosting effect. Using bright light mode does the opposite: less ghosting and mode details preserved, but reduced noise reduction factor.
The example below shows the temporal noise reduction in action. Hover the mouse pointer over the video and click the maximize button to see more details.
Noisy input
Parameters
De-noised output
scene: outdoor medium light strength: 1.0 version: 3
Note
Video output requires HTML5-capable browser that supports mp4 video decoding.
Implementation
Depending on the chosen algorithm version, the algorithm employs different techniques such as bilateral filtering for handling spatial noise and/or a temporal IIR filter associated with a motion detector.
Algorithm Version
There are 3 versions of the algorithm, each one with different speed/configurability/quality trade-offs:
VPI_TNR_V1 - Offers basic noise reduction that works well when noise levels aren't too high. Lighting conditions and noise reduction strength are fixed and can't be configured, but in general it provides good speed.
VPI_TNR_V2 - Offers improved noise reduction, and can be configured for a particular lighting condition. Still provides good speed.
VPI_TNR_V3 - Offers best noise reduction quality and configurability, in exchange of some performance decrease.
Availability of each version depends on backend and device, see VPITNRVersion. To pick the best available version, just use VPI_TNR_DEFAULT when specifying algorithm version.
Scene Lighting Condition
Versions 2 and 3 allow the user to specify of scene's lighting condition, which in turn controls the noise reduction strength for a particular scene. Higher strength will lead to less noise, but sometimes loss of detail in highly textured regions and some ghosting, especially around fast moving objects. If input noise is high, due to poor lighting and/or higher sensor sensibility, this might be a suitable trade-off.
For each VPITNRPreset, user can define a strength factor, basically a floating point number from 0 (least amount of noise reduction) and 1 (maximum amount). 0.5 is a good default to be chosen in most cases.
C API functions
For list of limitations, constraints and backends that implements the algorithm, consult reference documentation of the following functions:
Declares functions that implement the Temporal Noise Reduction algorithm.
Create the image that will store each frame fetched from the video source. Frames are to be fetched directly as NV12. If instead they are in a format not supported by the algorithm, Convert Image Format can be used to implement the required conversions.
Fetch a new frame from input video sequence and write it into input.
while (FetchFrame(vid, &input))
{
Submit it to the stream for processing. If it's the first frame, 2nd parameter, prevFrame must be NULL, or else the output of previous iteration must be passed.
Blocks the calling thread until all submitted commands in this stream queue are done (queue is empty)...
Swap output and prevOutput. In next iteration, output will be input as prevOutput, and current prevOutput buffer will receive the next de-noised frame.