Tcanny
From Avisynth wiki
		
		
		
| Abstract | |
|---|---|
| Author | tritical | 
| Version | v1.0 | 
| Download | tcanny.zip | 
| Category | Edge Detection | 
| License | GPLv2 | 
| Discussion | |
| Contents | 
Description
tcanny contains a Canny edge detection filter and distance transform filter.
Requirements
Syntax and Parameters
tcanny
Builds an edge map using Canny edge detection.
- tcanny(clip, float "sigma", float "t_h", float "t_l", int "nms", int "mode", int "plane", float "gmmax")
- clip    =   
 - Input clip; only YUY2 and YV12 are supported.
 
 
- clip    =   
- float  sigma = 1.5 
 - Standard deviation of Gaussian blur. 0 means no blurring before edge detection.
 
 
- float  sigma = 1.5 
- float  t_h = 8.0 
 - High gradient magnitude threshold for hysteresis.
 
 
- float  t_h = 8.0 
- float  t_l = 1.0 
 - Low gradient magnitude threshold for hysteresis.
 
 
- float  t_l = 1.0 
- int  nms = 3 
 - Byte mask choosing non-maxima suppression method(s).
 
 
- int  nms = 3 
- If (nms&1) - if pixel is maxima along nearest integer direction then keep.
- If (nms&3) - if pixel is maxima along linearly interpolated direction then keep.
 
 
 
- int  mode = 0 
 - Sets the output format:
 
 
- int  mode = 0 
- 0 : thresholded edge map (255 for edge, 0 for non-edge)
- 1 : gradient magnitude map. Scaled to 0-255 range based on gmmax.
 - pixel_val = min(grad_mag*255/gmmax,255)
 
 - 2 : edge pixel only gradient direction map (non-edge pixels set to 0)
- 3 : gradient direction map
 
 
 
 
            Gradient direction maps discretize [0-180) degree range into 256 bins.
                 0 = [000.000-000.351}
                 1 = [000.351-001.054)
                 .
                 .
                 .
               255 = [179.648-180.000)
                        135   90  45
                           \  |  /
                       180 --   -- 0
                            / |  \
                          45  90  135
                * This is the gradient direction, so the line direction 
                  is orthogonal to it (90 degree rotation). It only goes 
                  through 180 because for this case:
                     180+n = n, 0 <= n < 180
- int  plane = 1 
 - Byte mask indicating which planes to process. If a plane isn't processed then it is copied through as is.
 
 
- int  plane = 1 
- if (plane&1) - process Y
- if (plane&2) - process U
- if (plane&4) - process V
 
 
 
- float  gmmax = 50.0 
 - Used for scaling gradient magnitude into [0,255] for mode=1.
- gmmax is internally set to 1.0 if you set it to < 1.0.
 
 
- float  gmmax = 50.0 
tdtrans
Performs a distance transformation on an edge map. This filter assumes the input image is 0 for non-edge pixels, and > 0 for edge pixels.
The distance transform sets each pixel equal to the distance from it to the nearest edge pixel.
- tdtrans (clip, int "mode", int "plane")
- clip    =   
 - Input clip; only YUY2 and YV12 are supported.
 
 
- clip    =   
- int  mode = 1 
 - Sets distance type.
 
 
- int  mode = 1 
- 0 - city block
- 1 - euclidean
 
 
 
 
- * For the euclidean case the distance is rounded to the nearest integer.
- * For both cases distances greater than 255 are set to 255.
 
 
 
 
- int  plane = 1 
 - Byte mask indicating which planes to process. Same as in tcanny.
 
 
- int  plane = 1 
Examples
tcanny with default settings:
AviSource("blah.avi") TCannyMod(sigma=1.5, t_h=8.0, t_l=1.0, nms=3, mode=0, plane=1, gmmax=50.0)
tdtrans  with default settings:
AviSource("blah.avi") tdtrans(mode=1, plane=1)
Changelog
Version Date Changes
v1.0 06/03/2009 - Initial release
Archived Downloads
| Version | Download | Mirror | 
|---|---|---|
| v1.0 | tcanny.zip | 
External Links
Back to External Filters ←
