blockmatch ¶
Functions:
-
bmdegrain
–BM3D and mvtools inspired denoiser.
-
wnnm
–Weighted Nuclear Norm Minimization Denoise algorithm.
bmdegrain ¶
bmdegrain(
clip: VideoNode,
sigma: float | list[float] = 3.0,
refine: int = 0,
tr: int = 0,
ref: VideoNode | Prefilter | None = None,
block_size: int = 8,
block_step: int = 8,
group_size: int = 8,
bm_range: int = 7,
ps_num: int = 2,
ps_range: int = 4,
merge_factor: float = 0.1,
self_refine: bool = False,
planes: PlanesT = None,
) -> VideoNode
BM3D and mvtools inspired denoiser.
Parameters:
-
clip
¶VideoNode
) –Clip to process.
-
sigma
¶float | list[float]
, default:3.0
) –Strength of denoising, valid range is [0, +inf]. If a float is passed, this strength will be applied to every plane. Values higher than 4.0 are not recommended. Recommended values are [0.35, 1.0]. Default: 3.0.
-
refine
¶int
, default:0
) –The amount of iterations for iterative regularization. Default: 0.
-
ref
¶VideoNode | Prefilter | None
, default:None
) –Reference clip. Must be the same dimensions and format as input clip. Alternatively, a :py:class:
Prefilter
can be passed. Default: None. -
block_size
¶int
, default:8
) –The size of a block. Blocks are basic processing units. Larger blocks will take more time to process, but combined with
block_step
, may result in fewer blocks being processed overall. Valid ranges are [1, 64]. Default: 8. -
block_step
¶int
, default:8
) –Sliding step to process every next reference block. The total amount of blocks to process can be calculated with the following equation:
(width / block_step) * (height / block_step)
. Smaller values results in more reference blocks being processed. Default: 8. -
group_size
¶int
, default:8
) –Maximum number of similar blocks allowed per group (the 3rd dimension). Valid range is [1, 256]. By allowing more similar blocks to be grouped together, fewer blocks will be given to a transformed group, increasing the denoising strength. Setting this to 1 means no block matching will be performed. Default: 8.
-
bm_range
¶int
, default:7
) –Length of the side of the searching neighborhood. Valid range is [0, +inf]. The size of the search window is
(bm_range * 2 + 1) x (bm_range * 2 + 1)
. Larger values take more time to process, but increases the likelihood of finding similar patches. Default: 7. -
ps_num
¶int
, default:2
) –The number of matched locations used for the predictive search. Valid ranges are [1,
group_size
]. Larger values increases the possibility to match similar blocks, at the cost of taking more processing power. Default: 2. -
ps_range
¶int
, default:4
) –Length of the side of the search neighborhood for
pd_num
. Valid range is [1, +inf]. Default: 4. -
merge_factor
¶float
, default:0.1
) –Merge amount of the last recalculation into the new one when performing iterative regularization.
-
self_refine
¶bool
, default:False
) –If True, in the iterative recalculation step it will pass the last recalculation as ref clip instead of the original
ref
. -
planes
¶PlanesT
, default:None
) –Planes to process. If None, all planes. Default: None.
Returns:
-
VideoNode
–Denoised clip.
Source code
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
|
wnnm ¶
wnnm(
clip: VideoNode,
sigma: float | list[float] = 3.0,
refine: int = 0,
tr: int = 0,
ref: VideoNode | Prefilter | None = None,
block_size: int = 8,
block_step: int = 8,
group_size: int = 8,
bm_range: int = 7,
ps_num: int = 2,
ps_range: int = 4,
residual: bool = False,
adaptive_aggregation: bool = True,
merge_factor: float = 0.1,
self_refine: bool = False,
planes: PlanesT = None,
) -> VideoNode
Weighted Nuclear Norm Minimization Denoise algorithm.
Block matching, which is popularized by BM3D, finds similar blocks and then stacks together in a 3-D group. The similarity between these blocks allows details to be preserved during denoising.
In contrast to BM3D, which denoises the 3-D group based on frequency domain filtering, WNNM utilizes weighted nuclear norm minimization, a kind of low rank matrix approximation. Because of this, WNNM exhibits less blocking and ringing artifact compared to BM3D, but the computational complexity is much higher. This stage is called collaborative filtering in BM3D.
For more information, see the WNNM README <https://github.com/WolframRhodium/VapourSynth-WNNM>
_.
Parameters:
-
clip
¶VideoNode
) –Clip to process.
-
sigma
¶float | list[float]
, default:3.0
) –Strength of denoising, valid range is [0, +inf]. If a float is passed, this strength will be applied to every plane. Values higher than 4.0 are not recommended. Recommended values are [0.35, 1.0]. Default: 3.0.
-
refine
¶int
, default:0
) –The amount of iterations for iterative regularization. Default: 0.
-
tr
¶int
, default:0
) –Temporal radius. To enable spatial-only denoising, set this to 0. Higher values will rapidly increase filtering time and RAM usage. Default: 0.
-
ref
¶VideoNode | Prefilter | None
, default:None
) –Reference clip. Must be the same dimensions and format as input clip. Alternatively, a :py:class:
Prefilter
can be passed. Default: None. -
block_size
¶int
, default:8
) –The size of a block. Blocks are basic processing units. Larger blocks will take more time to process, but combined with
block_step
, may result in fewer blocks being processed overall. Valid ranges are [1, 64]. Default: 8. -
block_step
¶int
, default:8
) –Sliding step to process every next reference block. The total amount of blocks to process can be calculated with the following equation:
(width / block_step) * (height / block_step)
. Smaller values results in more reference blocks being processed. Default: 8. -
group_size
¶int
, default:8
) –Maximum number of similar blocks allowed per group (the 3rd dimension). Valid range is [1, 256]. By allowing more similar blocks to be grouped together, fewer blocks will be given to a transformed group, increasing the denoising strength. Setting this to 1 means no block matching will be performed. Default: 8.
-
bm_range
¶int
, default:7
) –Length of the side of the searching neighborhood. Valid range is [0, +inf]. The size of the search window is
(bm_range * 2 + 1) x (bm_range * 2 + 1)
. Larger values take more time to process, but increases the likelihood of finding similar patches. Default: 7. -
ps_num
¶int
, default:2
) –The number of matched locations used for the predictive search. Valid ranges are [1,
group_size
]. Larger values increases the possibility to match similar blocks, at the cost of taking more processing power. Default: 2. -
ps_range
¶int
, default:4
) –Length of the side of the search neighborhood for
pd_num
. Valid range is [1, +inf]. Default: 4. -
residual
¶bool
, default:False
) –Whether to center blocks before performing collaborative filtering. Default: False.
-
adaptive_aggregation
¶bool
, default:True
) –Whether to aggregate similar blocks weighted by the inverse of the number of non-zero singular values after WNNM. Default: True.
-
merge_factor
¶float
, default:0.1
) –Merge amount of the last recalculation into the new one when performing iterative regularization.
-
self_refine
¶bool
, default:False
) –If True, in the iterative recalculation step it will pass the last recalculation as ref clip instead of the original
ref
. -
planes
¶PlanesT
, default:None
) –Planes to process. If None, all planes. Default: None.
Returns:
-
VideoNode
–Denoised clip.
Source code
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
|