lvsfunc.noise

Warning

Parts of this sub-module will soon be deprecated in favor of vapoursynth-denoise!

lvsfunc.noise.bm3d(clip[, sigma, radius, ...])

BM3D denoising filter using the CPU.

lvsfunc.noise.chickendream(clip[, sigma, ...])

Realistic film grain generator.

This sub-module is aliased as denoise for backwards compatibility.

lvsfunc.noise.bm3d(clip, sigma=0.75, radius=None, ref=None, pre=None, refine=1, matrix_s='709', basic_args={}, final_args={})

BM3D denoising filter using the CPU.

Warning

This function has been deprecated! It will be removed in a future commit.

Dependencies:

Parameters
  • clip (vs.VideoNode) – Clip to process.

  • sigma (float | list[float]) – Denoising strength for both basic and final estimations.

  • radius (int | list[int] | None) – Temporal radius for both basic and final estimations.

  • ref (vs.VideoNode | None) – Reference clip for the final estimation.

  • pre (vs.VideoNode | None) – Prefiltered clip for the basic estimation.

  • refine (int) – Iteration of the final clip. 0 = basic estimation only 1 = basic + final estimation n = basic + n final estimations

  • matrix_s (str) – Color matrix of the Clip to process.

  • basic_args (dict[str, Any]) – Args to pass to the basic estimation.

  • final_args (dict[str, Any]) – Args to pass to the final estimation.

Return type

vs.VideoNode

Returns

Denoised clip.

Raises
  • ValueError – Invalid number of sigma parameters were passed.

  • ValueError – Invalid number of radii parameters were passed.

lvsfunc.noise.chickendream(clip, sigma=0.35, rad=0.025, res=1024, chroma=False, seed=42069, matrix=None, kernel=vskernels.Bicubic, **chkdr_args)

Realistic film grain generator.

Warning

This function is _incredibly_ slow! It may take multiple minutes to render your clip!
If you still want to use it, I highly recommend setting draft=True!

The generated grain is quite significant, but you can blend the output with the input to attenuate the effect. For this function to work at its best, the image must be in linear light and MUST be an SRGB or GRAY clip.

Please check the chickendream GitHub page for a full list of parameters and additional information.

Parameters
  • clip (vs.VideoNode) – Clip to process.

  • sigma (float) – Radius of the gaussian kernel for the vision filter. The larger the radius, the smoother the picture. Smallest values are more prone to aliasing. 0 is a special value indicating that a single-pixel rectangular filter should be used instead of a gaussian. For grains with a small radius (standard use), this should be the fastest option, visually equivalent to sigma = 0.3, offering an excellent quality (minimum leaking between adjascent pixels). Valid ranges are between 0 and 1.

  • rad (float) – Average grain radius, in pixels. The smaller the grains, the higher the picture fidelity (given a high enough res), and the slower the processing. Must be greater than 0.

  • res (int) – Filter resolution, directly translating into output data bitdepth. Must be greater than 0. 1024 is equivalent to a 10-bit output. Keep in mind that the pixel values are linear. The higher the resolution, the slower the algorithm. Large grains require a smaller res.

  • chroma (bool) – Whether to process chroma or not. If you pass a GRAY clip yourself, this parameter will be ignored.

  • seed (int) – Seed for the random generator. Defaults to 42069.

  • matrix (Matrix | int | None) – Enum for the matrix of the Clip to process. See lvsfunc.types.Matrix for more info. If not specified, gets matrix from the “_Matrix” prop of the clip unless it’s an RGB clip, in which case it stays as None.

  • kernel (Kernel | str) – py:class:vskernels.Kernel object used for conversions between YUV <-> RGB. This can also be the string name of the kernel (Default: py:class:vskernels.Bicubic(b=0, c=1/2)).

  • chkdr_args (Any) – Additional args to pass to chickendream.

Return type

vs.VideoNode

Returns

Grained clip in the given clip’s format.