MaskTools2/mt hysteresis

From Avisynth wiki
Jump to: navigation, search



Back to MaskTools2



Description

mt_hysteresis combines masks by growing the small mask into the big mask by connecting components. This makes it possible to build more robust edge masks.

Syntax and Parameters

mt_hysteresis (clip, clip, float "Y", float "U", float "V", string "chroma", int "offX", int "offY", int "w", int "h", int "sse2", bool "sse3", bool "ssse3", bool "sse4", bool "avx", bool "avx2", float "A", string "alpha")


clip   =
Input clip one.


clip   =
Input clip two.


float  Y = 3
float  U = 1
float  V = 1
float  A = 1
These three values describe the actual processing mode that is to be used on each plane / channel. Here is how the modes are coded :
  • x = -255...0 : all the pixels of the plane will be set to -x.
  • x = 1 : the plane will not be processed. That means the content of the plane after the filter is pure garbage.
  • x = 2 : the plane of the first input clip will be copied.
  • x = 3 : the plane will be processed with the processing the filter is designed to do.
  • x = 4 : the plane of the second input clip will be copied.


string  chroma = ""
string  alpha = ""
When defined, the value contained in this string will overwrite the U and V processing modes.
This is a nice addition proposed by mg262 that makes the filter more user friendly. Allowed values for chroma are:
  • "process" : set u = v = 3.
  • "copy" or "copy first" : set u = v = 2.
  • "copy second" : set u = v = 4.
  • "xxx", where xxx is a number : set u = v = -xxx.


int  offX = 0
int  offY = 0
offX and offY are the top left coordinates of the box where the actual processing shall occur. Everything outside that box will be garbage.


int  w = -1
int  h = -1
w and h are the width and height of the processed box. -1 means that the box extends to the lower right corner of the video. That also means that default settings are meant to process the whole picture.


Examples

mt_hysteresis with default settings:

mask1 = last.mt_edge(thY1=30, thY2=30)
mask2 = last.mt_edge(thY1=5, thY2=5)
mt_hysteresis(mask1, mask2, Y=3, U=1, V=1, chroma="", w=-1, h=-1)

See these threads for more examples:




Back to MaskTools2


Personal tools