edge ¶
Masks derived from edge detectors.
Modules:
-
_1d
–1D matrices
-
_3x3
–2D matrices.
-
_5x5
–2D matrices.
-
_abstract
–This module defines core abstract classes for building edge detection and ridge detection operators.
Classes:
-
ASobel
–Modified Sobel-Feldman operator from AWarpSharp.
-
Cross
–"HotDoG" Operator from AVS ExTools by Dogway.
-
EdgeDetect
–Abstract base class for edge detection operators.
-
EdgeMasksEdgeDetect
–Edge detection using VapourSynth's
EdgeMasks
plugin with expression-based convolution fallback. -
EuclideanDistance
–Edge detector combining two matrices via Euclidean distance.
-
ExKirsch
–Extended Russell Kirsch compass operator. 5x5 matrices.
-
ExLaplacian1
–Extended Pierre-Simon de Laplace operator, 1st implementation.
-
ExLaplacian2
–Extended Pierre-Simon de Laplace operator, 2nd implementation.
-
ExLaplacian3
–Extended Pierre-Simon de Laplace operator, 3rd implementation.
-
ExLaplacian4
–Extended Pierre-Simon de Laplace operator, 4th implementation.
-
ExPrewitt
–Extended Judith M. S. Prewitt operator.
-
ExSobel
–Extended Sobel-Feldman operator.
-
FDoG
–Flow-based Difference of Gaussian
-
FDoGTCanny
–Flow-based Difference of Gaussian TCanny Vapoursynth plugin.
-
Farid
–Farid & Simoncelli operator.
-
FreyChen
–Chen Frei operator. 3x3 matrices properly implemented.
-
FreyChenG41
–"Chen Frei" operator. 3x3 matrices from G41Fun.
-
Kayyali
–Kayyali operator.
-
Kirsch
–Russell Kirsch compass operator.
-
KirschTCanny
–Russell Kirsch compass TCanny Vapoursynth plugin operator.
-
Kroon
–Dirk-Jan Kroon operator.
-
KroonTCanny
–Dirk-Jan Kroon TCanny Vapoursynth plugin operator.
-
Laplacian1
–Pierre-Simon de Laplace operator 1st implementation.
-
Laplacian2
–Pierre-Simon de Laplace operator 2nd implementation.
-
Laplacian3
–Pierre-Simon de Laplace operator 3rd implementation.
-
Laplacian4
–Pierre-Simon de Laplace operator 4th implementation.
-
LoG
–Laplacian of Gaussian operator.
-
MagDirection
–Direction flags for magnitude calculations.
-
MagnitudeEdgeMasks
–Edge detector using a subset of convolution matrices.
-
MagnitudeMatrix
–Edge detector using a subset of convolution matrices.
-
Matrix1D
–Abstract base class for one-dimensional convolution-based edge detectors.
-
Matrix3x3
–Abstract base class for 3x3 convolution-based edge detectors.
-
Matrix5x5
–Abstract base class for 5x5 convolution-based edge detectors.
-
MatrixEdgeDetect
–Edge detection based on convolution matrices.
-
Max
–Edge detector combining multiple matrices by maximum response.
-
MinMax
–Min/max mask with separate luma/chroma radii.
-
Prewitt
–Judith M. S. Prewitt operator.
-
PrewittStd
–Judith M. S. Prewitt Vapoursynth plugin operator.
-
PrewittTCanny
–Judith M. S. Prewitt TCanny plugin operator.
-
RScharr
–Refined H. Scharr operator to more accurately calculate
-
RidgeDetect
–Edge detector specialized for ridge detection.
-
Robinson3
–Robinson compass operator level 3.
-
Robinson5
–Robinson compass operator level 5.
-
Scharr
–Original H. Scharr optimised operator which attempts
-
ScharrTCanny
–H. Scharr optimised TCanny Vapoursynth plugin operator.
-
SingleMatrix
–Edge detector that uses a single convolution matrix.
-
Sobel
–Sobel-Feldman operator.
-
SobelStd
–Sobel-Feldman Vapoursynth plugin operator.
-
SobelTCanny
–Sobel-Feldman Vapoursynth plugin operator.
-
TEdge
–(TEdgeMasktype=2) Avisynth plugin.
-
TEdgeTedgemask
–(tedgemask.TEdgeMask(threshold=0.0, type=2)) Vapoursynth plugin.
-
TheToof
–TheToof compass operator from SharpAAMCmod.
-
Tritical
–Operator used in Tritical's original TCanny filter.
-
TriticalTCanny
–Operator used in Tritical's original TCanny filter.
Functions:
-
get_all_edge_detects
–Returns all the EdgeDetect subclasses
-
get_all_ridge_detect
–Returns all the RidgeDetect subclasses
Attributes:
-
EdgeDetectT
–Deprecated alias of EdgeDetectLike.
-
RidgeDetectT
–Deprecated alias of RidgeDetectLike.
ASobel ¶
Bases: Matrix3x3
, EdgeDetect
Modified Sobel-Feldman operator from AWarpSharp.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
Cross ¶
Bases: EdgeMasksEdgeDetect
, RidgeDetect
, EuclideanDistance
, Matrix3x3
"HotDoG" Operator from AVS ExTools by Dogway. Plain and simple cross first order derivative.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
– -
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
-
ridgemask
–Makes ridge mask based on convolution kernel.
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[1, 0, 0, 0, 0, 0, 0, 0, -1],
[0, 0, -1, 0, 0, 0, 1, 0, 0],
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Source code in vsmasktools/edge/_abstract.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
ridgemask ¶
ridgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes ridge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi. Using a 32-bit float clip is recommended.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –clamp: Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 |
|
EdgeDetect ¶
Bases: ABC
Abstract base class for edge detection operators.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
EdgeMasksEdgeDetect ¶
Bases: MatrixEdgeDetect
Edge detection using VapourSynth's EdgeMasks
plugin with expression-based convolution fallback.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
– -
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) –Convolution kernels used for edge detection.
-
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
Convolution kernels used for edge detection.
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Source code in vsmasktools/edge/_abstract.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
EuclideanDistance ¶
Bases: MatrixEdgeDetect
, ABC
Edge detector combining two matrices via Euclidean distance.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) –Convolution kernels used for edge detection.
-
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
Convolution kernels used for edge detection.
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
ExKirsch ¶
ExKirsch(mag_directions: MagDirection = ALL, **kwargs: Any)
Bases: MagnitudeEdgeMasks
, Max
Extended Russell Kirsch compass operator. 5x5 matrices.
Initialize the MagnitudeEdgeMasks detector.
Parameters:
-
mag_directions
¶MagDirection
, default:ALL
) –Directional flags controlling which matrices are used. Defaults to all directions. If a subset is specified, the expression-based backend is used automatically to support custom directions.
-
**kwargs
¶Any
, default:{}
) –Additional parameters forwarded to the base EdgeMasksEdgeDetect class.
Methods:
-
edgemask
– -
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
mag_directions
– -
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
480 481 482 483 484 485 486 487 488 489 490 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[
9,
9,
9,
9,
9,
9,
5,
5,
5,
9,
-7,
-3,
0,
-3,
-7,
-7,
-3,
-3,
-3,
-7,
-7,
-7,
-7,
-7,
-7,
],
[
9,
9,
9,
9,
-7,
9,
5,
5,
-3,
-7,
9,
5,
0,
-3,
-7,
9,
-3,
-3,
-3,
-7,
-7,
-7,
-7,
-7,
-7,
],
[
9,
9,
-7,
-7,
-7,
9,
5,
-3,
-3,
-7,
9,
5,
0,
-3,
-7,
9,
5,
-3,
-3,
-7,
9,
9,
-7,
-7,
-7,
],
[
-7,
-7,
-7,
-7,
-7,
9,
-3,
-3,
-3,
-7,
9,
5,
0,
-3,
-7,
9,
5,
5,
-3,
-7,
9,
9,
9,
9,
-7,
],
[
-7,
-7,
-7,
-7,
-7,
-7,
-3,
-3,
-3,
-7,
-7,
-3,
0,
-3,
-7,
9,
5,
5,
5,
9,
9,
9,
9,
9,
9,
],
[
-7,
-7,
-7,
-7,
-7,
-7,
-3,
-3,
-3,
9,
-7,
-3,
0,
5,
9,
-7,
-3,
5,
5,
9,
-7,
9,
9,
9,
9,
],
[
-7,
-7,
-7,
9,
9,
-7,
-3,
-3,
5,
9,
-7,
-3,
0,
5,
9,
-7,
-3,
-3,
5,
9,
-7,
-7,
-7,
9,
9,
],
[
-7,
9,
9,
9,
9,
-7,
-3,
5,
5,
9,
-7,
-3,
0,
5,
9,
-7,
-3,
-3,
-3,
9,
-7,
-7,
-7,
-7,
-7,
],
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Source code in vsmasktools/edge/_abstract.py
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
ExLaplacian1 ¶
Bases: SingleMatrix
, Matrix5x5
Extended Pierre-Simon de Laplace operator, 1st implementation.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[
0,
0,
-1,
0,
0,
0,
0,
-1,
0,
0,
-1,
-1,
8,
-1,
-1,
0,
0,
-1,
0,
0,
0,
0,
-1,
0,
0,
]
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
ExLaplacian2 ¶
Bases: SingleMatrix
, Matrix5x5
Extended Pierre-Simon de Laplace operator, 2nd implementation.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[
0,
1,
-1,
1,
0,
1,
1,
-4,
1,
1,
-1,
-4,
8,
-4,
-1,
1,
1,
-4,
1,
1,
0,
1,
-1,
1,
0,
]
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
ExLaplacian3 ¶
Bases: SingleMatrix
, Matrix5x5
Extended Pierre-Simon de Laplace operator, 3rd implementation.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[
-1,
1,
-1,
1,
-1,
1,
2,
-4,
2,
1,
-1,
-4,
8,
-4,
-1,
1,
2,
-4,
2,
1,
-1,
1,
-1,
1,
-1,
]
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
ExLaplacian4 ¶
Bases: SingleMatrix
, Matrix5x5
Extended Pierre-Simon de Laplace operator, 4th implementation.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
24,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
]
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
ExPrewitt ¶
Bases: EdgeMasksEdgeDetect
, RidgeDetect
, EuclideanDistance
, Matrix5x5
Extended Judith M. S. Prewitt operator.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
– -
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
-
ridgemask
–Makes ridge mask based on convolution kernel.
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[
2,
1,
0,
-1,
-2,
2,
1,
0,
-1,
-2,
2,
1,
0,
-1,
-2,
2,
1,
0,
-1,
-2,
2,
1,
0,
-1,
-2,
],
[
2,
2,
2,
2,
2,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
-1,
-1,
-1,
-1,
-1,
-2,
-2,
-2,
-2,
-2,
],
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Source code in vsmasktools/edge/_abstract.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
ridgemask ¶
ridgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes ridge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi. Using a 32-bit float clip is recommended.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –clamp: Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 |
|
ExSobel ¶
Bases: EdgeMasksEdgeDetect
, RidgeDetect
, EuclideanDistance
, Matrix5x5
Extended Sobel-Feldman operator.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
– -
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
-
ridgemask
–Makes ridge mask based on convolution kernel.
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[
2,
1,
0,
-1,
-2,
2,
1,
0,
-1,
-2,
4,
2,
0,
-2,
-4,
2,
1,
0,
-1,
-2,
2,
1,
0,
-1,
-2,
],
[
2,
2,
4,
2,
2,
1,
1,
2,
1,
1,
0,
0,
0,
0,
0,
-1,
-1,
-2,
-1,
-1,
-2,
-2,
-4,
-2,
-2,
],
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Source code in vsmasktools/edge/_abstract.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
ridgemask ¶
ridgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes ridge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi. Using a 32-bit float clip is recommended.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –clamp: Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 |
|
FDoG ¶
Bases: EdgeMasksEdgeDetect
, RidgeDetect
, EuclideanDistance
, Matrix5x5
Flow-based Difference of Gaussian
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
– -
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
-
ridgemask
–Makes ridge mask based on convolution kernel.
Attributes:
-
divisors
(Sequence[float] | None
) – -
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[
1,
1,
0,
-1,
-1,
2,
2,
0,
-2,
-2,
3,
3,
0,
-3,
-3,
2,
2,
0,
-2,
-2,
1,
1,
0,
-1,
-1,
],
[
1,
2,
3,
2,
1,
1,
2,
3,
2,
1,
0,
0,
0,
0,
0,
-1,
-2,
-3,
-2,
-1,
-1,
-2,
-3,
-2,
-1,
],
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Source code in vsmasktools/edge/_abstract.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
ridgemask ¶
ridgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes ridge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi. Using a 32-bit float clip is recommended.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –clamp: Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 |
|
FDoGTCanny ¶
Bases: TCannyEdgeDetect
, Matrix5x5
Flow-based Difference of Gaussian TCanny Vapoursynth plugin.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
Farid ¶
Bases: NormalizeProcessor
, RidgeDetect
, EuclideanDistance
, Matrix5x5
Farid & Simoncelli operator.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
-
ridgemask
–Makes ridge mask based on convolution kernel.
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[
0.004127602875174862,
0.027308149775363867,
0.04673225765917656,
0.027308149775363867,
0.004127602875174862,
0.010419993699470744,
0.06893849946536831,
0.11797400212587895,
0.06893849946536831,
0.010419993699470744,
0.0,
0.0,
0.0,
0.0,
0.0,
-0.010419993699470744,
-0.06893849946536831,
-0.11797400212587895,
-0.06893849946536831,
-0.010419993699470744,
-0.004127602875174862,
-0.027308149775363867,
-0.04673225765917656,
-0.027308149775363867,
-0.004127602875174862,
],
[
0.004127602875174862,
0.010419993699470744,
0.0,
-0.010419993699470744,
-0.004127602875174862,
0.027308149775363867,
0.06893849946536831,
0.0,
-0.06893849946536831,
-0.027308149775363867,
0.04673225765917656,
0.11797400212587895,
0.0,
-0.11797400212587895,
-0.04673225765917656,
0.027308149775363867,
0.06893849946536831,
0.0,
-0.06893849946536831,
-0.027308149775363867,
0.004127602875174862,
0.010419993699470744,
0.0,
-0.010419993699470744,
-0.004127602875174862,
],
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
ridgemask ¶
ridgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes ridge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi. Using a 32-bit float clip is recommended.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –clamp: Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 |
|
FreyChen ¶
Bases: NormalizeProcessor
, MatrixEdgeDetect
Chen Frei operator. 3x3 matrices properly implemented.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) – -
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
-
sqrt2
–
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[1, sqrt2, 1, 0, 0, 0, -1, -sqrt2, -1],
[1, 0, -1, sqrt2, 0, -sqrt2, 1, 0, -1],
[0, -1, sqrt2, 1, 0, -1, -sqrt2, 1, 0],
[sqrt2, -1, 0, -1, 0, 1, 0, 1, -sqrt2],
[0, 1, 0, -1, 0, -1, 0, 1, 0],
[-1, 0, 1, 0, 0, 0, 1, 0, -1],
[1, -2, 1, -2, 4, -2, 1, -2, 1],
[-2, 1, -2, 1, 4, 1, -2, 1, -2],
[1, 1, 1, 1, 1, 1, 1, 1, 1],
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
FreyChenG41 ¶
Bases: RidgeDetect
, EuclideanDistance
, Matrix3x3
"Chen Frei" operator. 3x3 matrices from G41Fun.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
-
ridgemask
–Makes ridge mask based on convolution kernel.
Attributes:
-
divisors
(Sequence[float] | None
) – -
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[-7, 0, 7, -10, 0, 10, -7, 0, 7],
[-7, -10, -7, 0, 0, 0, 7, 10, 7],
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
ridgemask ¶
ridgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes ridge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi. Using a 32-bit float clip is recommended.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –clamp: Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 |
|
Kayyali ¶
Bases: SingleMatrix
, Matrix3x3
Kayyali operator.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
Kirsch ¶
Kirsch(mag_directions: MagDirection = ALL, **kwargs: Any)
Bases: MagnitudeEdgeMasks
, Max
, Matrix3x3
Russell Kirsch compass operator.
Initialize the MagnitudeEdgeMasks detector.
Parameters:
-
mag_directions
¶MagDirection
, default:ALL
) –Directional flags controlling which matrices are used. Defaults to all directions. If a subset is specified, the expression-based backend is used automatically to support custom directions.
-
**kwargs
¶Any
, default:{}
) –Additional parameters forwarded to the base EdgeMasksEdgeDetect class.
Methods:
-
edgemask
– -
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
mag_directions
– -
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
480 481 482 483 484 485 486 487 488 489 490 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[5, 5, 5, -3, 0, -3, -3, -3, -3],
[5, 5, -3, 5, 0, -3, -3, -3, -3],
[5, -3, -3, 5, 0, -3, 5, -3, -3],
[-3, -3, -3, 5, 0, -3, 5, 5, -3],
[-3, -3, -3, -3, 0, -3, 5, 5, 5],
[-3, -3, -3, -3, 0, 5, -3, 5, 5],
[-3, -3, 5, -3, 0, 5, -3, -3, 5],
[-3, 5, 5, -3, 0, 5, -3, -3, -3],
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Source code in vsmasktools/edge/_abstract.py
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
KirschTCanny ¶
Bases: TCannyEdgeDetect
, Matrix3x3
Russell Kirsch compass TCanny Vapoursynth plugin operator.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
Kroon ¶
Bases: EdgeMasksEdgeDetect
, RidgeDetect
, EuclideanDistance
, Matrix3x3
Dirk-Jan Kroon operator.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
– -
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
-
ridgemask
–Makes ridge mask based on convolution kernel.
Attributes:
-
divisors
(Sequence[float] | None
) – -
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[-17, 0, 17, -61, 0, 61, -17, 0, 17],
[-17, -61, -17, 0, 0, 0, 17, 61, 17],
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Source code in vsmasktools/edge/_abstract.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
ridgemask ¶
ridgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes ridge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi. Using a 32-bit float clip is recommended.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –clamp: Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 |
|
KroonTCanny ¶
Bases: TCannyEdgeDetect
, Matrix3x3
Dirk-Jan Kroon TCanny Vapoursynth plugin operator.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
Laplacian1 ¶
Bases: SingleMatrix
, Matrix3x3
Pierre-Simon de Laplace operator 1st implementation.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
Laplacian2 ¶
Bases: SingleMatrix
, Matrix3x3
Pierre-Simon de Laplace operator 2nd implementation.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
Laplacian3 ¶
Bases: SingleMatrix
, Matrix3x3
Pierre-Simon de Laplace operator 3rd implementation.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
Laplacian4 ¶
Bases: SingleMatrix
, Matrix3x3
Pierre-Simon de Laplace operator 4th implementation.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
LoG ¶
Bases: SingleMatrix
, Matrix5x5
Laplacian of Gaussian operator.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[
0,
0,
-1,
0,
0,
0,
-1,
-2,
-1,
0,
-1,
-2,
16,
-2,
-1,
0,
-1,
-2,
-1,
0,
0,
0,
-1,
0,
0,
]
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
MagDirection ¶
Bases: IntFlag
Direction flags for magnitude calculations.
Includes 8 primary compass directions (N, NE, E, SE, S, SW, W, NW) and composite groups (e.g., ALL, AXIS, CORNERS). Supports bitwise operations.
Methods:
-
select_matrices
–Return matrices matching the active directions in
self
.
Attributes:
-
ALL
–All eight directions combined.
-
AXIS
–The four cardinal directions: North, West, South, East.
-
CORNERS
–The four intercardinal (diagonal) directions.
-
E
– -
EAST
–All eastern directions (East, Northeast, Southeast).
-
N
– -
NE
– -
NORTH
–All northern directions (North, Northwest, Northeast).
-
NW
– -
S
– -
SE
– -
SOUTH
–All southern directions (South, Southwest, Southeast).
-
SW
– -
W
– -
WEST
–All western directions (West, Northwest, Southwest).
ALL class-attribute
instance-attribute
¶
All eight directions combined.
AXIS class-attribute
instance-attribute
¶
The four cardinal directions: North, West, South, East.
CORNERS class-attribute
instance-attribute
¶
The four intercardinal (diagonal) directions.
EAST class-attribute
instance-attribute
¶
All eastern directions (East, Northeast, Southeast).
NORTH class-attribute
instance-attribute
¶
All northern directions (North, Northwest, Northeast).
SOUTH class-attribute
instance-attribute
¶
All southern directions (South, Southwest, Southeast).
WEST class-attribute
instance-attribute
¶
All western directions (West, Northwest, Southwest).
select_matrices ¶
Return matrices matching the active directions in self
.
Parameters:
Returns:
-
Sequence[T]
–The subset of matrices for directions enabled in
self
.
Source code in vsmasktools/edge/_abstract.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
MagnitudeEdgeMasks ¶
MagnitudeEdgeMasks(mag_directions: MagDirection = ALL, **kwargs: Any)
Bases: EdgeMasksEdgeDetect
, MagnitudeMatrix
Edge detector using a subset of convolution matrices.
Allows selecting which matrices to apply based on directional flags. By default, all directions are used.
If a subset of directions is selected, the computation automatically switches to the expression-based backend.
Initialize the MagnitudeEdgeMasks detector.
Parameters:
-
mag_directions
¶MagDirection
, default:ALL
) –Directional flags controlling which matrices are used. Defaults to all directions. If a subset is specified, the expression-based backend is used automatically to support custom directions.
-
**kwargs
¶Any
, default:{}
) –Additional parameters forwarded to the base EdgeMasksEdgeDetect class.
Methods:
-
edgemask
– -
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
mag_directions
– -
matrices
(Sequence[Sequence[float]]
) –Convolution kernels used for edge detection.
-
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
480 481 482 483 484 485 486 487 488 489 490 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
Convolution kernels used for edge detection.
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Source code in vsmasktools/edge/_abstract.py
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
MagnitudeMatrix ¶
MagnitudeMatrix(mag_directions: MagDirection = ALL, **kwargs: Any)
Bases: MatrixEdgeDetect
Edge detector using a subset of convolution matrices.
Allows selecting which matrices to apply based on directional flags. By default, all directions are used.
Initialize with a set of magnitude directions.
Parameters:
-
mag_directions
¶MagDirection
, default:ALL
) –Directional flags controlling which matrices are used. Defaults to all directions.
-
**kwargs
¶Any
, default:{}
) –Additional parameters passed to the base class.
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
mag_directions
– -
matrices
(Sequence[Sequence[float]]
) –Convolution kernels used for edge detection.
-
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
453 454 455 456 457 458 459 460 461 462 463 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
Convolution kernels used for edge detection.
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
Matrix1D ¶
Bases: EdgeDetect
, ABC
Abstract base class for one-dimensional convolution-based edge detectors.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
mode_types
(Sequence[str] | None
) –
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
Matrix3x3 ¶
Bases: EdgeDetect
, ABC
Abstract base class for 3x3 convolution-based edge detectors.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
Matrix5x5 ¶
Bases: EdgeDetect
, ABC
Abstract base class for 5x5 convolution-based edge detectors.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
MatrixEdgeDetect ¶
Bases: EdgeDetect
Edge detection based on convolution matrices.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) –Convolution kernels used for edge detection.
-
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
Convolution kernels used for edge detection.
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
Max ¶
Bases: MatrixEdgeDetect
, ABC
Edge detector combining multiple matrices by maximum response.
Produces the edge mask by selecting the maximum value across all convolution results.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) –Convolution kernels used for edge detection.
-
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
Convolution kernels used for edge detection.
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
MinMax ¶
Bases: EdgeDetect
Min/max mask with separate luma/chroma radii.
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
Source code in vsmasktools/edge/_3x3.py
417 418 419 420 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
Prewitt ¶
Bases: EdgeMasksEdgeDetect
, RidgeDetect
, EuclideanDistance
, Matrix3x3
Judith M. S. Prewitt operator.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
– -
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
-
ridgemask
–Makes ridge mask based on convolution kernel.
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[1, 0, -1, 1, 0, -1, 1, 0, -1],
[1, 1, 1, 0, 0, 0, -1, -1, -1],
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Source code in vsmasktools/edge/_abstract.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
ridgemask ¶
ridgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes ridge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi. Using a 32-bit float clip is recommended.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –clamp: Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 |
|
PrewittStd ¶
Bases: Matrix3x3
Judith M. S. Prewitt Vapoursynth plugin operator.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
PrewittTCanny ¶
Bases: TCannyEdgeDetect
, Matrix3x3
Judith M. S. Prewitt TCanny plugin operator.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
RScharr ¶
Bases: EdgeMasksEdgeDetect
, RidgeDetect
, EuclideanDistance
, Matrix3x3
Refined H. Scharr operator to more accurately calculate 1st derivatives for a 3x3 kernel with coeffs 47 and 162.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
– -
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
-
ridgemask
–Makes ridge mask based on convolution kernel.
Attributes:
-
divisors
(Sequence[float] | None
) – -
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[-47, 0, 47, -162, 0, 162, -47, 0, 47],
[-47, -162, -47, 0, 0, 0, 47, 162, 47],
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Source code in vsmasktools/edge/_abstract.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
ridgemask ¶
ridgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes ridge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi. Using a 32-bit float clip is recommended.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –clamp: Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 |
|
RidgeDetect ¶
Bases: MatrixEdgeDetect
Edge detector specialized for ridge detection.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
-
ridgemask
–Makes ridge mask based on convolution kernel.
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) –Convolution kernels used for edge detection.
-
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
Convolution kernels used for edge detection.
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
ridgemask ¶
ridgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes ridge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi. Using a 32-bit float clip is recommended.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –clamp: Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 |
|
Robinson3 ¶
Robinson3(mag_directions: MagDirection = ALL, **kwargs: Any)
Bases: MagnitudeEdgeMasks
, Max
, Matrix3x3
Robinson compass operator level 3.
Initialize the MagnitudeEdgeMasks detector.
Parameters:
-
mag_directions
¶MagDirection
, default:ALL
) –Directional flags controlling which matrices are used. Defaults to all directions. If a subset is specified, the expression-based backend is used automatically to support custom directions.
-
**kwargs
¶Any
, default:{}
) –Additional parameters forwarded to the base EdgeMasksEdgeDetect class.
Methods:
-
edgemask
– -
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
mag_directions
– -
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
480 481 482 483 484 485 486 487 488 489 490 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[1, 1, 1, 0, 0, 0, -1, -1, -1],
[1, 1, 0, 1, 0, -1, 0, -1, -1],
[1, 0, -1, 1, 0, -1, 1, 0, -1],
[0, -1, -1, 1, 0, -1, 1, 1, 0],
[],
[],
[],
[],
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Source code in vsmasktools/edge/_abstract.py
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
Robinson5 ¶
Robinson5(mag_directions: MagDirection = ALL, **kwargs: Any)
Bases: MagnitudeEdgeMasks
, Max
, Matrix3x3
Robinson compass operator level 5.
Initialize the MagnitudeEdgeMasks detector.
Parameters:
-
mag_directions
¶MagDirection
, default:ALL
) –Directional flags controlling which matrices are used. Defaults to all directions. If a subset is specified, the expression-based backend is used automatically to support custom directions.
-
**kwargs
¶Any
, default:{}
) –Additional parameters forwarded to the base EdgeMasksEdgeDetect class.
Methods:
-
edgemask
– -
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
mag_directions
– -
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
480 481 482 483 484 485 486 487 488 489 490 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[1, 2, 1, 0, 0, 0, -1, -2, -1],
[2, 1, 0, 1, 0, -1, 0, -1, -2],
[1, 0, -1, 2, 0, -2, 1, 0, -1],
[0, -1, -2, 1, 0, -1, 2, 1, 0],
[],
[],
[],
[],
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Source code in vsmasktools/edge/_abstract.py
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
Scharr ¶
Bases: EdgeMasksEdgeDetect
, RidgeDetect
, EuclideanDistance
, Matrix3x3
Original H. Scharr optimised operator which attempts to achieve the perfect rotational symmetry with coefficients 3 and 10.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
– -
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
-
ridgemask
–Makes ridge mask based on convolution kernel.
Attributes:
-
divisors
(Sequence[float] | None
) – -
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[-3, 0, 3, -10, 0, 10, -3, 0, 3],
[-3, -10, -3, 0, 0, 0, 3, 10, 3],
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Source code in vsmasktools/edge/_abstract.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
ridgemask ¶
ridgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes ridge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi. Using a 32-bit float clip is recommended.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –clamp: Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 |
|
ScharrTCanny ¶
Bases: TCannyEdgeDetect
, Matrix3x3
H. Scharr optimised TCanny Vapoursynth plugin operator.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
SingleMatrix ¶
Bases: MatrixEdgeDetect
, ABC
Edge detector that uses a single convolution matrix.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) –Convolution kernels used for edge detection.
-
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
Convolution kernels used for edge detection.
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
Sobel ¶
Bases: EdgeMasksEdgeDetect
, RidgeDetect
, EuclideanDistance
, Matrix3x3
Sobel-Feldman operator.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
– -
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
-
ridgemask
–Makes ridge mask based on convolution kernel.
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[1, 0, -1, 2, 0, -2, 1, 0, -1],
[1, 2, 1, 0, 0, 0, -1, -2, -1],
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Source code in vsmasktools/edge/_abstract.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
ridgemask ¶
ridgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes ridge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi. Using a 32-bit float clip is recommended.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –clamp: Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 |
|
SobelStd ¶
Bases: Matrix3x3
Sobel-Feldman Vapoursynth plugin operator.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
SobelTCanny ¶
Bases: TCannyEdgeDetect
, Matrix3x3
Sobel-Feldman Vapoursynth plugin operator.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
TEdge ¶
Bases: Matrix1D
, EuclideanDistance
(TEdgeMasktype=2) Avisynth plugin.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) – -
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
TEdgeTedgemask ¶
Bases: Matrix1D
(tedgemask.TEdgeMask(threshold=0.0, type=2)) Vapoursynth plugin.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
mode_types
(Sequence[str] | None
) –
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
TheToof ¶
TheToof(mag_directions: MagDirection = ALL, **kwargs: Any)
Bases: MagnitudeMatrix
, Max
, Matrix3x3
TheToof compass operator from SharpAAMCmod.
Initialize with a set of magnitude directions.
Parameters:
-
mag_directions
¶MagDirection
, default:ALL
) –Directional flags controlling which matrices are used. Defaults to all directions.
-
**kwargs
¶Any
, default:{}
) –Additional parameters passed to the base class.
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
divisors
(Sequence[float] | None
) – -
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
mag_directions
– -
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –Optional convolution modes (e.g. 's' for square). Defaults to 's'.
Source code in vsmasktools/edge/_abstract.py
453 454 455 456 457 458 459 460 461 462 463 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
matrices class-attribute
¶
matrices: Sequence[Sequence[float]] = [
[5, 10, 5, 0, 0, 0, -5, -10, -5],
[10, 5, 0, 5, 0, -5, 0, -5, -10],
[5, 0, -5, 10, 0, -10, 5, 0, -5],
[0, -5, -10, 5, 0, -5, 10, 5, 0],
[],
[],
[],
[],
]
mode_types class-attribute
¶
Optional convolution modes (e.g. 's' for square). Defaults to 's'.
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
Tritical ¶
Bases: Matrix1D
, EdgeMasksEdgeDetect
, RidgeDetect
, EuclideanDistance
Operator used in Tritical's original TCanny filter. Plain and simple orthogonal first order derivative.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
– -
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
-
ridgemask
–Makes ridge mask based on convolution kernel.
Attributes:
-
divisors
(Sequence[float] | None
) –Optional divisors applied to each kernel. Defaults to zeros (no division).
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
matrices
(Sequence[Sequence[float]]
) – -
mode_types
(Sequence[str] | None
) –
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
divisors class-attribute
¶
Optional divisors applied to each kernel. Defaults to zeros (no division).
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Source code in vsmasktools/edge/_abstract.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
ridgemask ¶
ridgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes ridge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi. Using a 32-bit float clip is recommended.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –clamp: Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 |
|
TriticalTCanny ¶
Bases: Matrix1D
, TCannyEdgeDetect
Operator used in Tritical's original TCanny filter. Plain and simple orthogonal first order derivative.
Initialize the scaler with optional keyword arguments.
Parameters:
Methods:
-
edgemask
–Makes edge mask based on convolution kernel.
-
ensure_obj
–Ensure that the input is an edgemask instance, resolving it if necessary.
-
from_param
–Resolve and return an edgemask type from a given input (string, type, or instance).
Attributes:
-
kwargs
(dict[str, Any]
) –Arguments passed to the edgemask function(s).
-
mode_types
(Sequence[str] | None
) –
Source code in vsmasktools/edge/_abstract.py
158 159 160 161 162 163 164 165 |
|
kwargs instance-attribute
¶
Arguments passed to the edgemask function(s).
edgemask ¶
edgemask(
clip: VideoNode,
lthr: float | Sequence[float] | None = None,
hthr: float | Sequence[float] | None = None,
multi: float | Sequence[float] = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> VideoNode
Makes edge mask based on convolution kernel.
The resulting mask can be thresholded with lthr, hthr and multiplied with multi.
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float | Sequence[float] | None
, default:None
) –Low threshold. Anything below lthr will be set to 0
-
hthr
¶float | Sequence[float] | None
, default:None
) –High threshold. Anything above hthr will be set to the range max
-
multi
¶float | Sequence[float]
, default:1.0
) –Multiply all pixels by this before thresholding
-
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
VideoNode
–Mask clip
Source code in vsmasktools/edge/_abstract.py
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 |
|
ensure_obj classmethod
¶
ensure_obj(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> Self
Ensure that the input is an edgemask instance, resolving it if necessary.
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Edgemask instance.
Source code in vsmasktools/edge/_abstract.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
from_param classmethod
¶
from_param(
value: type[Self] | Self | str | None = None,
/,
func_except: FuncExcept | None = None,
) -> type[Self]
Resolve and return an edgemask type from a given input (string, type, or instance).
Parameters:
-
value
¶type[Self] | Self | str | None
, default:None
) –Edgemask identifier (string, class, or instance).
-
func_except
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Returns:
Source code in vsmasktools/edge/_abstract.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
get_all_edge_detects ¶
get_all_edge_detects(
clip: VideoNode,
lthr: float = 0.0,
hthr: float | None = None,
multi: float = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> list[VideoNode]
Returns all the EdgeDetect subclasses
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float
, default:0.0
) – -
hthr
¶float | None
, default:None
) – -
multi
¶float
, default:1.0
) – -
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
list[VideoNode]
–A list of edge masks
Source code in vsmasktools/edge/_abstract.py
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 |
|
get_all_ridge_detect ¶
get_all_ridge_detect(
clip: VideoNode,
lthr: float = 0.0,
hthr: float | None = None,
multi: float = 1.0,
clamp: bool | tuple[float, float] | list[tuple[float, float]] = False,
planes: Planes = None,
**kwargs: Any
) -> list[VideoNode]
Returns all the RidgeDetect subclasses
Parameters:
-
clip
¶VideoNode
) –Source clip
-
lthr
¶float
, default:0.0
) – -
hthr
¶float | None
, default:None
) – -
multi
¶float
, default:1.0
) – -
clamp
¶bool | tuple[float, float] | list[tuple[float, float]]
, default:False
) –Clamp to legal values if True or specified range
(low, high)
-
planes
¶Planes
, default:None
) –Which planes to process.
Returns:
-
list[VideoNode]
–A list edge masks
Source code in vsmasktools/edge/_abstract.py
755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 |
|