From Avisynth wiki
Jump to: navigation, search
Author Asd-g
Version v1.0.0
Download vsTEdgeMask-
Category Edge Detection
License GPLv2



vsTEdgeMask builds an edge map using canny edge detection.

This is a port of the VapourSynth plugin TEdgeMask, which in turn is a port of both TEdgeMask/TEMmod AviSynth plugins.


Syntax and Parameters

vsTEdgeMask (clip, float "threshY", float "threshU", float "threshV", int "type", int "link", float "scale", int "y", int "u", int "v", int "opt")

clip   =
A clip to process. It must have planar format, 8..16 bit integer sample type, and subsampling ratios of at most 2.

float  threshY = 8.0
float  threshU = 8.0
float  threshV = 8.0
Sets the magnitude thresholds.
If over this value then a sample will be considered an edge, and the output pixel will be set to the maximum value allowed by the format. Otherwise the output pixel will be set to 0.
Set this to 0 to output a magnitude mask instead of a binary mask.
Default: threshY = threshU = threshV = 8.0

int  type = 2
Sets the type of first order partial derivative approximation that is used.
  • 1: 2 pixel.
  • 2: 4 pixel.
  • 3: Same as type = 1.
  • 4: Same as type = 2.
  • 5: 6 pixel (Sobel operator).
Default: 2

int  link =
Specifies whether luma to chroma linking, no linking, or linking of every plane to every other plane is used.
  • 0: No linking. The three edge masks are completely independent.
  • 1: Luma to chroma linking. If a luma pixel is considered an edge, the corresponding chroma pixel is also marked as an edge.
  • 2: Every plane to every other plane. If a pixel is considered an edge in any plane, the corresponding pixels in all the other planes are also marked as edges.
This parameter has no effect when clip has only one plane, when any plane's threshold is 0, or when some planes are not processed.
This parameter can only be 0 or 2 when clip is RGB.
Default: 2 when clip is RGB, otherwise 1.

float  scale = 1.0
If the output is a magnitude mask (threshold is 0), it is scaled by this value.
Note that in TEMmod this parameter had three different, undocumented default values for the different mask types, which made it difficult to use the parameter without reading the source code.
Default: 1.0

int  Y = 3
int  U = 3
int  V = 3
  • Planes to process.
  • 1: Return garbage.
  • 2: Copy plane.
  • 3: Process plane. Always process planes when clip is RGB.
Default: y = u = v = 3.

int  opt = false
Sets which cpu optimizations to use.
  • -1: Auto-detect.
  • 0: Use C++ code.
  • 1: Use SSE2 code.
Default: -1.


vsTEdgeMask with default settings:

AviSource("blah.avi") # YUV input
vsTEdgeMask (threshY=8.0, threshU=8.0, threshV=8.0, type=2, link=1, scale=1.0, Y=1, U=1, V=1, opt=-1)


Version      Date            Changes
v1.0.0 2021/03/11 - Initial release; port of the VapourSynth plugin

Archived Downloads

See GitHub releases page.

External Links

  • GitHub - Source code repository.
  • GitHub - Source code repository (VapourSynth).

Back to External Filters

Personal tools