lvsfunc.noise

Warning

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

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

A wrapper function for the BM3D denoiser.

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

A wrapper around the graining plugin, chickendream, a plug-in that implements a realistic film grain generator.

This submodule 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={})

A wrapper function for the BM3D denoiser.

Dependencies:

  • VapourSynth-BM3D

Parameters
  • clip (vs.VideoNode) – Input clip

  • 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 input clip

  • 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

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

A wrapper around the graining plugin, chickendream, a plug-in that implements a realistic film grain generator.

Warning

This function is _incredibly_ slow! It may take multiple minutes to render your clip!

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 (VideoNode) – Input clip.

  • 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 (Union[Matrix, int, None]) – Enum for the matrix of the input clip. See 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) – Kernel object used for conversions between YUV <-> RGB.

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

Return type

VideoNode

Returns

Grained clip in the given clip’s format.