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.
Type Aliases:
-
EdgeDetectLike–Type alias for anything that can resolve to a EdgeDetect.
-
RidgeDetectLike–Type alias for anything that can resolve to a RidgeDetect.
Classes:
-
ASobel–ASobel from the
AWarpSharp2VapourSynth plugin. -
Cross–"HotDoG" Operator from AVS ExTools by Dogway.
-
EdgeDetect–Abstract base class for edge detection operators.
-
EdgeMasksEdgeDetect–Edge detection using VapourSynth's
EdgeMasksplugin 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
-
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.
-
Kroon–Dirk-Jan Kroon 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.
-
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
-
SingleMatrix–Edge detector that uses a single convolution matrix.
-
Sobel–Sobel-Feldman operator.
-
TEdge–(TEdgeMasktype=2) Avisynth plugin.
-
TheToof–TheToof compass operator from SharpAAMCmod.
-
Tritical–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
EdgeDetectLike ¶
EdgeDetectLike = type[EdgeDetect] | EdgeDetect | str
Type alias for anything that can resolve to a EdgeDetect.
This includes
- A string identifier.
- A class type subclassing
EdgeDetect. - An instance of a
EdgeDetect.
RidgeDetectLike ¶
RidgeDetectLike = type[RidgeDetect] | RidgeDetect | str
Type alias for anything that can resolve to a RidgeDetect.
This includes
- A string identifier.
- A class type subclassing
RidgeDetect. - An instance of a
RidgeDetect.
ASobel ¶
Bases: Matrix3x3, EdgeDetect
ASobel from the AWarpSharp2 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
156 157 158 159 160 161 162 163 | |
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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–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
156 157 158 159 160 161 162 163 | |
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],
]
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
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | |
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
156 157 158 159 160 161 162 163 | |
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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–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
156 157 158 159 160 161 162 163 | |
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
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
156 157 158 159 160 161 162 163 | |
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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–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
448 449 450 451 452 453 454 455 456 457 458 | |
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,
],
]
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
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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]]) –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
156 157 158 159 160 161 162 163 | |
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,
]
]
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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]]) –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
156 157 158 159 160 161 162 163 | |
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,
]
]
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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]]) –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
156 157 158 159 160 161 162 163 | |
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,
]
]
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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]]) –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
156 157 158 159 160 161 162 163 | |
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,
]
]
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
ExPrewitt ¶
Bases: EdgeMasksEdgeDetect, RidgeDetect, EuclideanDistance, Matrix5x5
Extended Judith M. S. Prewitt 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]]) –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
156 157 158 159 160 161 162 163 | |
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,
],
]
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
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | |
ExSobel ¶
Bases: EdgeMasksEdgeDetect, RidgeDetect, EuclideanDistance, Matrix5x5
Extended Sobel-Feldman 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]]) –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
156 157 158 159 160 161 162 163 | |
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,
],
]
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
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | |
FDoG ¶
Bases: EdgeMasksEdgeDetect, RidgeDetect, EuclideanDistance, Matrix5x5
Flow-based Difference of Gaussian
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
156 157 158 159 160 161 162 163 | |
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,
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,
],
]
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
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | |
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]]) –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
156 157 158 159 160 161 162 163 | |
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,
],
]
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | |
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) –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'.
-
sqrt2–
Source code in vsmasktools/edge/_abstract.py
156 157 158 159 160 161 162 163 | |
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, 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],
]
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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) –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
156 157 158 159 160 161 162 163 | |
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]] = [
[-7, 0, 7, -10, 0, 10, -7, 0, 7],
[-7, -10, -7, 0, 0, 0, 7, 10, 7],
]
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | |
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]]) –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
156 157 158 159 160 161 162 163 | |
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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–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
448 449 450 451 452 453 454 455 456 457 458 | |
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],
]
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
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
Kroon ¶
Bases: EdgeMasksEdgeDetect, RidgeDetect, EuclideanDistance, Matrix3x3
Dirk-Jan Kroon 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]]) –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
156 157 158 159 160 161 162 163 | |
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]] = [
[-17, 0, 17, -61, 0, 61, -17, 0, 17],
[-17, -61, -17, 0, 0, 0, 17, 61, 17],
]
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
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | |
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]]) –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
156 157 158 159 160 161 162 163 | |
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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]]) –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
156 157 158 159 160 161 162 163 | |
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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]]) –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
156 157 158 159 160 161 162 163 | |
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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]]) –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
156 157 158 159 160 161 162 163 | |
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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]]) –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
156 157 158 159 160 161 162 163 | |
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,
]
]
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
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–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
448 449 450 451 452 453 454 455 456 457 458 | |
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
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
421 422 423 424 425 426 427 428 429 430 431 | |
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
156 157 158 159 160 161 162 163 | |
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
156 157 158 159 160 161 162 163 | |
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
156 157 158 159 160 161 162 163 | |
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
156 157 158 159 160 161 162 163 | |
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
156 157 158 159 160 161 162 163 | |
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
MinMax ¶
Bases: EdgeDetect
Min/max mask with separate luma/chroma radii.
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/_3x3.py
317 318 319 320 | |
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
Prewitt ¶
Bases: EdgeMasksEdgeDetect, RidgeDetect, EuclideanDistance, Matrix3x3
Judith M. S. Prewitt 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]]) –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
156 157 158 159 160 161 162 163 | |
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],
]
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
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | |
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–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
156 157 158 159 160 161 162 163 | |
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]] = [
[-47, 0, 47, -162, 0, 162, -47, 0, 47],
[-47, -162, -47, 0, 0, 0, 47, 162, 47],
]
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
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | |
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
156 157 158 159 160 161 162 163 | |
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | |
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–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
448 449 450 451 452 453 454 455 456 457 458 | |
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],
[],
[],
[],
[],
]
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
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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–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
448 449 450 451 452 453 454 455 456 457 458 | |
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],
[],
[],
[],
[],
]
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
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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–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
156 157 158 159 160 161 162 163 | |
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]] = [
[-3, 0, 3, -10, 0, 10, -3, 0, 3],
[-3, -10, -3, 0, 0, 0, 3, 10, 3],
]
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
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | |
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
156 157 158 159 160 161 162 163 | |
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
Sobel ¶
Bases: EdgeMasksEdgeDetect, RidgeDetect, EuclideanDistance, Matrix3x3
Sobel-Feldman 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]]) –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
156 157 158 159 160 161 162 163 | |
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],
]
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
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | |
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) –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) –
Source code in vsmasktools/edge/_abstract.py
156 157 158 159 160 161 162 163 | |
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.
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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) –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
421 422 423 424 425 426 427 428 429 430 431 | |
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, 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],
[],
[],
[],
[],
]
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
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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–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) –
Source code in vsmasktools/edge/_abstract.py
156 157 158 159 160 161 162 163 | |
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.
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
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | |
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
225 226 227 228 229 230 231 232 233 234 235 236 237 | |
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
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
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
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | |
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
671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | |
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
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 753 754 755 756 757 758 759 760 | |