TNLMeans
m |
(v1.1 update) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{FilterCat6|External_filters|Plugins|Plugins_x64|Denoisers|Spatial-Temporal Denoisers|Deep_color_tools}} |
{{Filter3 | {{Filter3 | ||
− | |{{Author/tritical}} | + | |1={{Author/tritical}}, {{Author/pinterf}} |
− | |1. | + | |2=1.1 |
− | | | + | |3=[https://github.com/pinterf/TNLMeans/releases TNLMeans_v1.1.7z] |
− | 3=[ | + | |
− | + | ||
|4=Spatial-Temporal Denoisers | |4=Spatial-Temporal Denoisers | ||
|5=[http://www.gnu.org/licenses/gpl-2.0.txt GPLv2] | |5=[http://www.gnu.org/licenses/gpl-2.0.txt GPLv2] | ||
Line 15: | Line 13: | ||
[[TNLMeans]] is an implementation of the [http://en.wikipedia.org/wiki/Non-local_means NL-means denoising algorithm]. Aside from the original method, [[TNLMeans]] also supports extension into 3D, a faster, block based approach, and a multiscale version. | [[TNLMeans]] is an implementation of the [http://en.wikipedia.org/wiki/Non-local_means NL-means denoising algorithm]. Aside from the original method, [[TNLMeans]] also supports extension into 3D, a faster, block based approach, and a multiscale version. | ||
− | * | + | * Filter reports itself as [[MT_MULTI_INSTANCE]] under AviSynth+. |
<br> | <br> | ||
== Requirements == | == Requirements == | ||
− | * AviSynth | + | * [x86]: [[AviSynth+]] or [https://sourceforge.net/projects/avisynth2/ AviSynth 2.6.0] |
− | * [[ | + | * [x64]: [[AviSynth+]] |
− | * Supported color formats: [[ | + | * Supported color formats: [[Y8]], [[YV12]], [[YV16]], [[YV24]], [[YV411]], [[YUY2]] |
+ | ** AviSynth+: All [[planar]] formats (8/10/12/14/16-bit, Y, YUV(A), and RGB(A) with or without alpha) are supported. | ||
<br> | <br> | ||
Line 53: | Line 52: | ||
<br> | <br> | ||
::{{Par2| |clip| }} | ::{{Par2| |clip| }} | ||
− | :::Input clip. | + | :::Input clip; filter works all 8-16 bits Y and planar YUV/RGB color spaces and YUY2. |
+ | :::Alpha channel - if exists - is simply copied. | ||
<br> | <br> | ||
::{{Par2|Ax|int|4}} | ::{{Par2|Ax|int|4}} | ||
Line 104: | Line 104: | ||
== Changelog == | == Changelog == | ||
Version Date(D/M/Y) Changes<br> | Version Date(D/M/Y) Changes<br> | ||
+ | v1.1.0 04/10/2021 - Changes by pinterf | ||
+ | - project moved to github: https://github.com/pinterf/TNLMeans | ||
+ | - project update to Visual Studio 2019 | ||
+ | - Change to Avisynth v2.6 interface (from 2.5) | ||
+ | - pass frame properties for AviSynth+ interface version >= 8 | ||
+ | - Source code syntax updates: gcc, clang | ||
+ | - Add planar Y, YUV and RGB formats (but kept YUY2 by on-the-fly pre-post conversion) | ||
+ | - Add x64 config | ||
+ | - linux/gcc build, CMake build environment | ||
+ | - 10-16 bit support<br> | ||
v1.0.3 08/28/2007 - Removed fast exp() approximation that was used for sse=false. Turns out it was | v1.0.3 08/28/2007 - Removed fast exp() approximation that was used for sse=false. Turns out it was | ||
quite inaccurate and had overflow problems resulting in artifacts.<br> | quite inaccurate and had overflow problems resulting in artifacts.<br> | ||
Line 126: | Line 136: | ||
!!width="150px"| Download | !!width="150px"| Download | ||
!!width="150px"| Mirror | !!width="150px"| Mirror | ||
+ | |- | ||
+ | !v1.0.3 (x86/x64) | ||
+ | |[https://web.archive.org/web/20200522181545if_/https://files.videohelp.com/u/223002/TNLMeans103_ICL.7z TNLMeans103_ICL.7z] | ||
+ | |[https://web.archive.org/web/20191106173119if_/http://www.iol.ie/%7Eschubert/gas/TNLMeans103_ICL.7z TNLMeans103_ICL.7z] /// [https://www.mediafire.com/file/5p4qp3qy6mjchno/TNLMeans103_ICL.7z/file MediaFire] | ||
|- | |- | ||
!v1.0.3 | !v1.0.3 | ||
− | |||
|[http://web.archive.org/web/20140420182218/http://bengal.missouri.edu/~kes25c/TNLMeansv103.zip TNLMeansv103.zip] | |[http://web.archive.org/web/20140420182218/http://bengal.missouri.edu/~kes25c/TNLMeansv103.zip TNLMeansv103.zip] | ||
+ | | | ||
|} | |} | ||
− | + | * x86/x64 version compiled by [https://forum.doom9.org/showthread.php?t=173259 Groucho2004]. | |
<br> | <br> | ||
== External Links == | == External Links == | ||
− | *[ | + | *[https://github.com/pinterf/TNLMeans GitHub] - Source code repository. |
*[http://github.com/VFR-maniac/VapourSynth-TNLMeans GitHub] - VapourSynth port of TNLMeans. | *[http://github.com/VFR-maniac/VapourSynth-TNLMeans GitHub] - VapourSynth port of TNLMeans. | ||
− | |||
<br> | <br> | ||
----------------------------------------------- | ----------------------------------------------- | ||
'''Back to [[External_filters#Spatio-Temporal_Denoisers| External Filters]] ←''' | '''Back to [[External_filters#Spatio-Temporal_Denoisers| External Filters]] ←''' |
Latest revision as of 10:07, 11 April 2021
Abstract | |
---|---|
Author | tritical, pinterf |
Version | 1.1 |
Download | TNLMeans_v1.1.7z |
Category | Spatial-Temporal Denoisers |
License | GPLv2 |
Discussion | Doom9 Thread |
Contents |
[edit] Description
TNLMeans is an implementation of the NL-means denoising algorithm. Aside from the original method, TNLMeans also supports extension into 3D, a faster, block based approach, and a multiscale version.
- Filter reports itself as MT_MULTI_INSTANCE under AviSynth+.
[edit] Requirements
- [x86]: AviSynth+ or AviSynth 2.6.0
- [x64]: AviSynth+
- Supported color formats: Y8, YV12, YV16, YV24, YV411, YUY2
- AviSynth+: All planar formats (8/10/12/14/16-bit, Y, YUV(A), and RGB(A) with or without alpha) are supported.
[edit] Theory Of Operation:
The NL-means algorithm works in the following manner. For each pixel in the image define a search window in which to look for similar pixels. The search window is defined by the parameters Ax and Ay, which set the x-axis radius and y-axis radius. For each pixel in the window determine a weight based on the similarity of that pixel's gray level neighborhood to the center pixel's gray level neighborhood. The neighborhood is defined by the Sx and Sy parameters, which set the x-axis radius and y-axis radius. The similarity between two neighborhoods is measured using gaussian weighted (as a function of distance, the standard deviation is set by the "a" parameter) sum of squared differences. The final weight for a pixel is computed as:
exp(-(total_sse_difference/sum_of_gaussian_weights)/(h*h));
If the parameter 'sse' is set to false, then sum of absolute differences is used instead of sum of squared differences. In that case, the final weight for a pixel is computed as:
exp(-(total_sad_difference/sum_of_gaussian_weights)/h);
Once a weight for each pixel in the window is acquired, the final pixel value is simply the weighted average of all the pixels. In order for the center pixel to not be too heavily weighted, it is assigned a weight equal to the largest weight given to another pixel in the search window.
The block based modification changes the base step (or base window) from 1 pixel to blocks with size Bx and By where Bx and By set the x-axis radius and y-axis radius. The support and search windows still work the same way, but now whole blocks are computed/averaged at once instead of individual pixels. This modification cuts the computation time down by Bx*2+1)*(By*2+1) times.
The 3D extension allows extending the search window into neighbor frames. The parameter Az sets the temporal (z-axis) radius. With Az=1 frames n-1 and n+1 would be included.
The multiscale version works by running the normal algorithm with Ax/Ay = 2 on the original image, and then running the algorithm again on a downsampled (width/2,height/2) version of the original image with Ax/Ay/Bx/By/Sx/Sy all divided by 2. The weights from the two scales are then combined to form the final image. This process can greatly speed up processing for large search windows but sacrifices quality (especially around edges/lines/fine details). The type of downsampling that is used is set by the 'rm' parameter.
For more information see the following papers:
- A Review of Image Denoising Algorithms, with a New One
- A non-local algorithm for image denoising
- Denosing image sequences does not require motion estimation
[edit] Syntax and Parameters
- TNLMeans (clip, int "Ax", int "Ay", int "Az", int "Sx", int "Sy", int "Bx", int "By", bool "ms", int "rm", float "a", float "h", bool "sse")
- clip =
- Input clip; filter works all 8-16 bits Y and planar YUV/RGB color spaces and YUY2.
- Alpha channel - if exists - is simply copied.
- clip =
- int Ax = 4
- int Ay = 4
- int Az = 0
- These set the x-axis, y-axis, and z-axis radii of the search window. These must be greater than or equal to 0. The full window size will be:
(Ax*2+1) x (Ay*2+1) x (Az*2+1)
- Generally, the larger the search window the better the result of the denoising. Of course, the larger the search window the longer the denoising takes.
- These set the x-axis, y-axis, and z-axis radii of the search window. These must be greater than or equal to 0. The full window size will be:
- int Ax = 4
- int Sx = 2
- int Sy = 2
- These set the x-axis and y-axis radii of the support (similarity neighborhood) window. These must be greater than or equal to 0. A larger similarity window will retain more detail/texture but will also cause less noise removal. Typical values for Sx/Sy are 2 or 3. The full window size will be:
(Sx*2+1) x (Sy*2+1)
- These set the x-axis and y-axis radii of the support (similarity neighborhood) window. These must be greater than or equal to 0. A larger similarity window will retain more detail/texture but will also cause less noise removal. Typical values for Sx/Sy are 2 or 3. The full window size will be:
- int Sx = 2
- int Bx = 1
- int By = 1
- These set the x-axis and y-axis radii of the base window. In the original NL-means algorithm the base was a single pixel (Bx=0 and By=0). Using blocks larger than a single pixel will sacrifice some quality for speed. Note that Sx must be greater than or equal to Bx and Sy must be greater than or equal to By. It is recommended that Sx/Sy be larger than Bx/By.
- int Bx = 1
- bool ms = false
- Controls whether or not the multiscale version is used. The multiscale version is faster but lower quality. The larger ax/ay are the greater the speed increase from using the multiscale version will be. If Ax/Ay are less than or equal to 2 then the multiscale version will not give any speed up and will make things slower. The multiscale version requires mod 8 input (width divisible by 8).
- bool ms = false
- int rm = 4
- If ms = true, then rm sets the type of resizing used for downsampling. Possible options:
- 0 - Point
- 1 - Bilinear
- 2 - Bicubic
- 3 - Lanczos3
- 4 - Spline16
- 5 - Spline36
- If ms = true, then rm sets the type of resizing used for downsampling. Possible options:
- int rm = 4
- float a = 1.0
- Sets the standard deviation of the Gaussian used for weighting the difference calculation used for computing neighborhood similarity. Smaller values will result in less noise removal but will retain more detail/texture.
- float a = 1.0
- float h = 1.8
- Controls the strength of the filtering (blurring). Larger values will remove more noise but will also destroy more detail. 'h' should typically be set equal to the standard deviation of the noise in the image when using sse=true and assuming the noise fits the zero mean, Gaussian model.
- float h = 1.8
- h defaults to 0.5 when sse=false
- bool sse = true
- Controls whether sum of squared differences or sum of absolute differences is used when computing neighborhood similarity. sse is slightly slower but retains fine detail/texture better. sad typically works better for cartoons/anime. The 'h' parameter usually needs to be set about 4 times lower when using sad than when using sse.
- true - use sse
- false - use sad
- Controls whether sum of squared differences or sum of absolute differences is used when computing neighborhood similarity. sse is slightly slower but retains fine detail/texture better. sad typically works better for cartoons/anime. The 'h' parameter usually needs to be set about 4 times lower when using sad than when using sse.
- bool sse = true
[edit] Examples
TNLMeans with all default settings:
AviSource("Blah.avi") TNLMeans(Ax=4, Ay=4, Az=0, Sx=2, Sy=2, Bx=1, By=1, ms=false, rm=4, a=1.0, h=1.8, sse=true)
[edit] Changelog
Version Date(D/M/Y) Changes
v1.1.0 04/10/2021 - Changes by pinterf - project moved to github: https://github.com/pinterf/TNLMeans - project update to Visual Studio 2019 - Change to Avisynth v2.6 interface (from 2.5) - pass frame properties for AviSynth+ interface version >= 8 - Source code syntax updates: gcc, clang - Add planar Y, YUV and RGB formats (but kept YUY2 by on-the-fly pre-post conversion) - Add x64 config - linux/gcc build, CMake build environment - 10-16 bit support
v1.0.3 08/28/2007 - Removed fast exp() approximation that was used for sse=false. Turns out it was quite inaccurate and had overflow problems resulting in artifacts.
v1.0.2 07/30/2006 - Fixed a problem with small weights causing artifacts
v1.0.1 06/19/2006 - Fixed a bug that caused a crash when ms=true was used with yuy2 input
v1.0 Final 05/31/2006 - Fixed always creating the downsampled clip unless ms=false was explicitly specified
v1.0 Beta 2 05/25/2006 + Added multiscale version (parameters ms/rm) + Added sse parameter + Optimized non-block based routines by buffering (100% speed increase) - Removed b parameter - Fixed a bug in the block based routines that caused some blocks in the search window not to be tested - Changed defaults for ax/ay/sx/sy/h
v1.0 Beta 1 05/17/2006 - Initial Release
[edit] Archived Downloads
Version | Download | Mirror |
---|---|---|
v1.0.3 (x86/x64) | TNLMeans103_ICL.7z | TNLMeans103_ICL.7z /// MediaFire |
v1.0.3 | TNLMeansv103.zip |
- x86/x64 version compiled by Groucho2004.
[edit] External Links
Back to External Filters ←