lvsfunc.dehalo

Warning

This sub-module will soon be deprecated in favor of vs-dehalo!

Dehaloing functions and wrappers.

lvsfunc.dehalo.bidehalo(clip[, ref, sigmaS, ...])

Dehaloing function that uses bilateral and BM3D to remove bright haloing around edges.

lvsfunc.dehalo.fine_dehalo(clip[, ref, rx, ...])

Light's rewrite of fine_dehalo.py.

lvsfunc.dehalo.masked_dha(clip[, ref, rx, ...])

Bombines the best of DeHalo_alpha and BlindDeHalo3, and adds some tweaks to the masking.

lvsfunc.dehalo.bidehalo(clip, ref=None, sigmaS=1.5, sigmaR=0.0196078431372549, sigmaS_final=None, sigmaR_final=None, planes=None, bilateral_args={}, bm3d_args={})

Dehaloing function that uses bilateral and BM3D to remove bright haloing around edges.

Warning

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

If a ref clip is passed, that will be masked onto the clip instead of a blurred clip.

Parameters
  • clip (vs.VideoNode) – Source clip.

  • ref (vs.VideoNode | None) – Ref clip.

  • sigmaS (float) – Bilateral’s spatial weight sigma.

  • sigmaR (float) – Bilateral’s range weight sigma.

  • sigmaS_final (float | None) – Final bilateral call’s spatial weight sigma. You’ll want this to be much weaker than the initial sigmaS. If None, 1/3rd of sigmaS.

  • sigmaR_final (float | None) – Bilateral’s range weight sigma. if None, same as sigmaR

  • bilateral_args (dict[str, Any]) – Additional parameters to pass to bilateral.

  • bm3d_args (dict[str, Any]) – Additional parameters to pass to lvsfunc.noise.bm3d().

  • planes (int | Sequence[int] | None) – Specifies which planes will be processed. Any unprocessed planes will be simply copied.

Return type

vs.VideoNode

Returns

Dehalo’d clip.

lvsfunc.dehalo.fine_dehalo(clip, ref=None, rx=1.8, ry=1.8, brightstr=1.0, darkstr=0.0, thmi=80, thma=128, thlimi=50, thlima=100, lowsens=50, highsens=50, rfactor=1.25, show_mask=False, planes=None)

Light’s rewrite of fine_dehalo.py.

Warning

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

This is a slight rewrite of the standalone script that has been floating around with support for a ref clip. Original can be found in havsfunc if requested.

There have been changes made to the way the masks are expanded/inpanded, as well as strengths. This isn’t strictly better or worse than the original version, just different.

This function is rather sensitive to the rx and ry settings. Set them as low as possible! If the radii are set too high, it will start missing small spots.

darkstr is set to 0 by default in this function. This is because more often than not, it simply does more damage than people will likely want.

The sensitivity settings are rather difficult to define. In essence, they define the window between how weak an effect is for it to be processed, and how strong it has to be before it’s fully discarded.

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

  • ref (vs.VideoNode | None) – Reference clip. Will replace regular dehaloing.

  • rx (float) – Horizontal radius for halo removal. Must be greater than 1. Will be rounded up.

  • ry (float) – Vertical radius for halo removal. Must be greater than 1. Will be rounded up.

  • brightstr (float) – Strength for bright halo removal.

  • darkstr (float) – Strength for dark halo removal. Must be between 0 and 1.

  • thmi (float) – Minimum threshold for sharp edges. Keep only the sharpest edges (line edges). To see the effects of this setting take a look at the strong mask (show_mask=4).

  • thma (float) – Maximum threshold for sharp edges. Keep only the sharpest edges (line edges). To see the effects of this setting take a look at the strong mask (show_mask=4).

  • thlimi (float) – Minimum limiting threshold. Includes more edges than previously, but ignores simple details.

  • thlima (float) – Maximum limiting threshold. Includes more edges than previously, but ignores simple details.

  • lowsens (float) – Lower sensitivity range. The lower this is, the more it will process. Must be between 0 and 100.

  • highsens (float) – Upper sensitivity range. The higher this is, the more it will process. Must be between 0 and 100.

  • rfactor (float) – Image enlargement factor. Set to >1 to enable some form of aliasing-protection. Must be greater than 1.

  • show_mask (bool | int) – Return mask clip. Valid options are 1–7.

  • planes (int | Sequence[int] | None) – Specifies which planes will be processed. Any unprocessed planes will be simply copied.

Return type

vs.VideoNode

Returns

Dehalo’d clip or halo mask clip.

Raises

ModuleNotFoundError – Dependencies are missing.

lvsfunc.dehalo.masked_dha(clip, ref=None, rx=2.0, ry=2.0, brightstr=1.0, darkstr=0.0, lowsens=50, highsens=50, rfactor=1.0, maskpull=48, maskpush=192, show_mask=False)

Bombines the best of DeHalo_alpha and BlindDeHalo3, and adds some tweaks to the masking.

This function is rather sensitive to the rx and ry settings. Set them as low as possible! If the radii are set too high, it will start missing small spots.

darkstr is set to 0 by default in this function. This is because more often than not, it simply does more damage than people will likely want.

The sensitivity settings are rather difficult to define. In essence, they define the window between how weak an effect is for it to be processed, and how strong it has to be before it’s fully discarded.

Adopted from G41Fun, original by Orum <https://forum.doom9.org/showthread.php?t=148498>. Heavily modified by LightArrowsEXE.

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

  • ref (vs.VideoNode | None) – Reference clip. Will replace regular dehaloing with the given clip.

  • rx (float) – Horizontal radius for halo removal. Must be greater than 1.

  • ry (float) – Vertical radius for halo removal. Must be greater than 1.

  • brightstr (float) – Strength for bright halo removal.

  • darkstr (float) – Strength for dark halo removal. Must be between 0 and 1.

  • lowsens (float) – Lower sensitivity range. The lower this is, the more it will process. Must be between 0 and 100.

  • highsens (float) – Upper sensitivity range. The higher this is, the more it will process. Must be between 0 and 100.

  • rfactor (float) – Image enlargement factor. Set to >1 to enable some form of aliasing-protection. Must be greater than 1.

  • maskpull (float) – Mask pulling factor.

  • maskpush (float) – Mask pushing factor.

  • show_mask (bool) – Return mask clip.

Return type

vs.VideoNode

Returns

Dehalo’d clip or halo mask clip.

Raises
  • ValueErrorrfactor, rx, or ry is less than 1.0.

  • ValueErrordarkstr is not between 0.0–1.0.

  • ValueErrorlowsens or highsens is not between 0–100.