From Avisynth wiki
Jump to: navigation, search
Author tritical
Version v0.9
Download TEdgeMaskv09.zip
Category Edge Detection
License GPLv2



TEdgeMask creates an edgemask based off gradient vector magnitude. It includes some useful options such as luma to chroma linking of the edge map and seperate thresholds for each plane. It can output a binary mask or a magnitude mask scaled to a 0-255 range.


  • AviSynth 2.5.8 or greater
  • Supported color formats: YUY2, YV12

Syntax and Parameters

TEdgeMask (clip, int "Y", int "U", int "V", float "threshY", float "threshU", float "threshV", int "link", int "type", int "valOn", int "valOff", bool "preBlur")

clip  c =
Input clip; only YUY2 and YV12 are supported.

int  Y = 1
int  U = 1
int  V = 1
These control how each of the planes (Y, U, V) is processed.
Set to 1 to process the plane, set to 0 to not process (as in don't even memset, it will just be garbage), set to -x to have the plane be memset to abs(x) (must be in the range -1 to -255 and -256 = 0).

float  threshY = 8.0
float  threshU = 8.0
float  threshV = 8.0
These set the magnitude thresholds for each plane... if over this value then a pixel will be considered an edge.

int  link = 1
Specifies whether luma to chroma linking, no linking, or linking of every plane to every other plane is used.
  • 0 : no linking
  • 1 : luma to chroma linking
  • 2 : every plane to every other plane

int  type = 2
Sets the type of first order partial derivative approximation that is used.
Possible values:
  • 1 : 2 pixel
  • 2 : 4 pixel

int  valOn = 255
int  valOff = 0
Sets the values to use for the binary mask output. valOn = value for edge pixels, valOff = value for non-edge pixels.
Set valOn to a negative value and instead of creating a binary mask, TEdgeMask will output a mask with the actual edge magnitude values scaled onto a 0-255 range (with the max value 255 corresponding to a single edge gradient of 255).

bool  preblur = false
Indicates whether to apply a 3x3 guassian blur to the input image prior to generating the edge map.


TEdgeMask with default settings (binary mask output):

TEdgeMask (Y=1, U=1, V=1, threshY=8.0, threshU=8.0, threshV=8.0, link=1, type=2, valOn=255, valOff=0, preblur=false)

Magnitude mask output:

TEdgeMask (valOn=-1)


Version      Date            Changes
v0.9 01/20/2005 - Initial release

Archived Downloads

Version Download Mirror
v0.9 TEdgeMaskv09.zip TEdgeMaskv09.zip

External Links

Back to External Filters

Personal tools