alpha ¶
This module implements functions based on the famous dehalo_alpha.
Classes:
-
AlphaBlur
–A Gaussian blur approximation inspired by Dehalo_Alpha.
Functions:
-
dehalo_alpha
–Reduce halo artifacts by aggressively processing the edges and their surroundings.
VSFunctionPlanesArgs module-attribute
¶
VSFunctionPlanesArgs: TypeAlias = VSFunctionPlanesArgs[VideoNode, VideoNode]
AlphaBlur ¶
AlphaBlur(
rx: float | Sequence[float] = 2.0,
ry: float | Sequence[float] | None = None,
func: FuncExceptT | None = None,
**kwargs: Any
)
A Gaussian blur approximation inspired by Dehalo_Alpha.
The blur radius roughly corresponds to a Gaussian sigma as follows
- Radius 1.5 ≈ sigma 1.0
- Radius 2.0 ≈ sigma 1.4
- Radius 3.0 ≈ sigma 2.0
- Radius 4.0 ≈ sigma 2.75
Initializes an AlphaBlur instance.
Parameters:
-
rx
¶float | Sequence[float]
, default:2.0
) –Horizontal radius for halo removal.
-
ry
¶float | Sequence[float] | None
, default:None
) –Vertical radius for halo removal. Defaults to
rx
if not set. -
func
¶FuncExceptT | None
, default:None
) –An optional function to use for error handling.
-
**kwargs
¶Any
, default:{}
) –Optional keyword arguments:
- downscaler: Custom downscaler Scaler object.
- upscaler: Custom upscaler Scaler object.
Methods:
-
__call__
–Applies the Gaussian blur approximation to the input clip.
Attributes:
-
downscaler
– -
func
– -
rx
– -
ry
– -
upscaler
–
Source code in vsdehalo/alpha.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
|
__call__ ¶
Applies the Gaussian blur approximation to the input clip.
Parameters:
-
clip
¶VideoNode
) –Source clip.
-
planes
¶PlanesT
, default:None
) –Which planes to process. Default to all.
Raises:
-
CustomIndexError
–If any of the radius values (
rx
orry
) are less than 1.0.
Returns:
-
Any
–Blurred clip.
Source code in vsdehalo/alpha.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
|
dehalo_alpha ¶
dehalo_alpha(
clip: VideoNode,
blur: (
IterArr[float]
| VSFunctionPlanesArgs
| tuple[float | list[float] | VSFunctionPlanesArgs, ...]
) = GAUSS(sigma=1.4),
lowsens: IterArr[float] = 50.0,
highsens: IterArr[float] = 50.0,
ss: float | tuple[float, ...] = 1.5,
darkstr: IterArr[float] = 0.0,
brightstr: IterArr[float] = 1.0,
planes: PlanesT = 0,
attach_masks: bool = False,
func: FuncExceptT | None = None,
**kwargs: Any
) -> VideoNode
Reduce halo artifacts by aggressively processing the edges and their surroundings.
The parameter ss
can be configured per iteration while blur
, lowsens
, highsens
, darkstr
and brightstr
can be configured per plane and per iteration. You can specify:
- A single value: applies to all iterations and all planes.
- A tuple of values: interpreted as iteration-wise.
- A list inside the tuple: interpreted as per-plane for a specific iteration.
For example
blur=(1.4, [1.4, 1.65], [1.5, 1.4, 1.45])
implies 3 iterations: - 1st: 1.4 for all planes - 2nd: 1.4 for luma, 1.65 for both chroma planes - 3rd: 1.5 for luma, 1.4 for U, 1.45 for V
Parameters:
-
clip
¶VideoNode
) –Source clip.
-
blur
¶IterArr[float] | VSFunctionPlanesArgs | tuple[float | list[float] | VSFunctionPlanesArgs, ...]
, default:GAUSS(sigma=1.4)
) –Standard deviation of the Gaussian kernel if float or custom blurring function to use in place of the default implementation.
-
lowsens
¶IterArr[float]
, default:50.0
) –Lower sensitivity threshold — dehalo is fully applied below this value. Setting both
lowsens
andhighsens
to-1
disables mask-based processing entirely. -
highsens
¶IterArr[float]
, default:50.0
) –Upper sensitivity threshold — dehalo is completely skipped above this value. Setting both
lowsens
andhighsens
to-1
disables mask-based processing entirely. -
ss
¶float | tuple[float, ...]
, default:1.5
) –Supersampling factor to reduce aliasing artifacts.
-
darkstr
¶IterArr[float]
, default:0.0
) –Strength factor for suppressing dark halos.
-
brightstr
¶IterArr[float]
, default:1.0
) –Strength factor for suppressing bright halos.
-
planes
¶PlanesT
, default:0
) –Planes to process. Default to 0.
-
attach_masks
¶bool
, default:False
) –Stores generated masks as frame properties in the output clip. The prop name is
DehaloAlphaMask_{i}
, wherei
is the iteration index. -
func
¶FuncExceptT | None
, default:None
) –An optional function to use for error handling.
-
**kwargs
¶Any
, default:{}
) –Additionnal advanced parameters.
Raises:
-
CustomIndexError
–If
lowsens
orhighsens
are not beween 0 and 100 (inclusive).
Returns:
-
VideoNode
–Dehaloed clip.
Source code in vsdehalo/alpha.py
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 136 137 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 |
|