TCannyMod

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (Requirements: AviSynth 2.6)
(TCannyMod: cosmetics and add s bit more info)
Line 35: Line 35:
 
:::Sets the output format:
 
:::Sets the output format:
  
::::*0 : thresholded edge map (255 for edge, 0 for non-edge)
+
:::*0 : thresholded edge map (255 for edge, 0 for non-edge)
::::*1 : gradient magnitude map.
+
:::*1 : gradient magnitude map.
::::*2 : edge pixel only gradient direction map (non-edge pixels set to 0)
+
:::*2 : edge pixel only gradient direction map (non-edge pixels set to 0)
::::*3 : gradient direction map
+
:::*3 : gradient direction map
:::::Gradient direction are normalized to 1, 3, 7 and 15.
+
::::Gradient direction are normalized to 1, 3, 7 and 15.
::::::1 = horizontal
+
:::::1 = horizontal
::::::3 = 45' up
+
:::::3 = 45' up
::::::7 = vertical
+
:::::7 = vertical
::::::15 = 45' down
+
:::::15 = 45' down
::::*4 : Gaussian blurred frame.
+
:::*4 : Gaussian blurred frame.
 
<br>
 
<br>
 
::{{Par2|sigma|float|1.5}}
 
::{{Par2|sigma|float|1.5}}
Line 51: Line 51:
 
<br>
 
<br>
 
::{{Par2|t_h|float|8.0}}
 
::{{Par2|t_h|float|8.0}}
:::High gradient magnitude threshold for hysteresis.
 
<br>
 
 
::{{Par2|t_l|float|1.0}}
 
::{{Par2|t_l|float|1.0}}
:::Low gradient magnitude threshold for hysteresis.
+
:::High and low gradient magnitude threshold for hysteresis; {{Template:FuncDef3|t_h}} must be greater than {{Template:FuncDef3|t_l}}.
 
<br>
 
<br>
 
::{{Par2|sobel|bool|false}}
 
::{{Par2|sobel|bool|false}}
Line 62: Line 60:
 
:::Chroma processing:
 
:::Chroma processing:
  
::::*0 : do not process
+
:::*0 : do not process
::::*1 : process
+
:::*1 : process
::::*2 : copy from input clip.
+
:::*2 : copy from input clip.
::::*3 : fill with 0x80(128), output is grayscale.
+
:::*3 : fill with 0x80(128), output is grayscale.
 
<br>
 
<br>
 
-------------
 
-------------
 
<br>
 
<br>
 +
 
=== GBlur ===
 
=== GBlur ===
 
Gaussian blur filter. Just an alias for {{Template:FuncDef3|TCannyMod}}<tt>(mode=4)</tt>.
 
Gaussian blur filter. Just an alias for {{Template:FuncDef3|TCannyMod}}<tt>(mode=4)</tt>.

Revision as of 20:16, 12 September 2015


Abstract
Author Chikuzen
Version v0.1.1
Download tcannymod-0.1.1.zip
Category Edge Detection
License GPLv2
Discussion Doom9 Thread


Contents

Description

TCannyMod is a Canny edge detection filter. It's based on tcanny written by Kevin Stone (a.k.a. tritical) but rewritten from scratch exclusively for AviSynth 2.6.

Requirements



Syntax and Parameters


TCannyMod

Builds an edge map using Canny edge detection.

TCannyMod (clip, int "mode", float "sigma", float "t_h", float "t_l", bool "sobel", int "chroma")


clip   =
Input clip; only planar formats are supported.


int  mode = 0
Sets the output format:
  • 0 : thresholded edge map (255 for edge, 0 for non-edge)
  • 1 : gradient magnitude map.
  • 2 : edge pixel only gradient direction map (non-edge pixels set to 0)
  • 3 : gradient direction map
Gradient direction are normalized to 1, 3, 7 and 15.
1 = horizontal
3 = 45' up
7 = vertical
15 = 45' down
  • 4 : Gaussian blurred frame.


float  sigma = 1.5
Standard deviation of Gaussian blur. 0 means no blurring before edge detection.
(0 <= sigma <= 2.83, default = 1.5)


float  t_h = 8.0
float  t_l = 1.0
High and low gradient magnitude threshold for hysteresis; t_h must be greater than t_l.


bool  sobel = false
If set to true, edge detection will use a Sobel operator instead of [1, 0, -1].


int  chroma = 0
Chroma processing:
  • 0 : do not process
  • 1 : process
  • 2 : copy from input clip.
  • 3 : fill with 0x80(128), output is grayscale.




GBlur

Gaussian blur filter. Just an alias for TCannyMod(mode=4).

GBlur (clip, float "sigma", int "chroma")


clip   =
Input clip; only planar formats are supported.


float  sigma = 0.5
Standard deviation of Gaussian blur. 0 means no blurring before edge detection.
(0 <= sigma <= 2.83, default = 0.5)


int  chroma = 1
Chroma processing:
  • 0 : do not process
  • 1 : process
  • 2 : copy from input clip.
  • 3 : fill with 0x80(128), output is grayscale.


Examples

TCannyMod with default settings:

AviSource("blah.avi")
TCannyMod (mode=0, sigma=1.5, t_h=8.0, t_l=1.0, sobel=false, chroma=0)


GBlur with default settings:

AviSource("blah.avi")
GBlur (sigma=0.5, chroma=1)


Changelog

Version      Date            Changes
v0.1.1 08/21/2013 - fix crash when sigma is too large - add new argument 'sobel' - add new function 'GBlur'
v0.1.0 08/017/2013 - Initial release


Archived Downloads

Version Download Source code Mirror
v0.1.1 tcannymod-0.1.1.zip TCannyMod-master.zip


External Links




Back to External Filters

Personal tools