VsTCanny

From Avisynth wiki
Jump to: navigation, search
Abstract
Author Asd-g
Version v1.1.8
Download vsTCanny
Category Edge Detection
License GPLv2
Discussion

Contents

Description

Builds an edge map using canny edge detection.

vsTCanny is a port of the VapourSynth plugin TCanny.


Requirements


Syntax and Parameters

vsTCanny (clip, float "sigmaY", float "sigmaU", float "sigmaV", float sigma_vY", float "sigma_vU", float "sigma_vV", float "t_h", float "t_l", int "mode", int "op", float "scale", int "y", int "u", int "v", int "opt")


clip   =
A clip to process. All planar formats are supported.


float  sigmaY = 1.5
float  sigmaU =
float  sigmaV =
Standard deviation of horizontal gaussian blur.
Must be positive value.
Setting to 0 disables gaussian blur.
Default:
sigmaY = 1.5
sigmaU = sigmaY / horizontal_chroma_subsampling_factor
sigmaV = sigmaU


float  sigma_vY = sigmaY
float  sigma_vU =
float  sigma_vV =
Standard deviation of vertical gaussian blur.
Must be positive value.
Setting to 0 disables gaussian blur.
Default:
sigma_vY = sigmaY
if sigma_vY not defined: if horizontal and vertical subsampling factors are equal sigma_vU = sigmaU else sigma_vU = sigmaU * horizontal_chroma_subsampling_factor
if sigma_vY defined: sigma_vU = sigma_vY / vertical_chroma_subsampling_factor
sigma_vV = sigma_vU


float  t_h = 8.0
High gradient magnitude threshold for hysteresis.


float  t_l = 1.0
Low gradient magnitude threshold for hysteresis.
Must be lower than t_h.


int  mode = 0
Sets the output format:
  • -1 : Gaussian blur only.
  • 0 : Thresholded edge map (2^bitdepth-1 for edge, 0 for non-edge).
  • 1 : Gradient magnitude map.


int  op = 1
Sets the operator for edge detection:
  • 0 : The operator used in tritical's original filter.
  • 1 : The operator proposed by P. Zhou et al.
  • 2 : The Sobel operator.
  • 3 : The Scharr operator.
  • 4 : The Kroon operator.
  • 5 : The Kirsch operator.
  • 6 : The FDoG operator.


float  scale = 1.0
Multiplies the gradient.
This can be used to increase or decrease the intensity of edges in the output.
Must be greater than 0.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 the clip is RGB.


int  opt = -1
Sets which cpu optimizations to use.
  • -1 : Auto-detect.
  • 0 : Use C++ code.
  • 1 : Use SSE2 code.
  • 2 : Use AVX2 code.
  • 3 : Use AVX512 code.


Examples

vsTCanny with default settings (for YUV420):

AviSource("blah.avi")
vsTCanny(sigmaY=1.50, sigmaU=0.75, sigmaV=0.75, sigma_vY=1.50, sigma_vU=0.75, sigma_vV=0.75, \
          t_h=8.0, t_l=1.0, mode=0, op=1, scale=1.0, Y=3, U=3, V=3, opt=-1)

vsTCanny with default settings (for YUV444):

AviSource("blah.avi")
vsTCanny(sigmaY=1.50, sigmaU=1.50, sigmaV=1.50, sigma_vY=1.50, sigma_vU=1.50, sigma_vV=1.50, \
          t_h=8.0, t_l=1.0, mode=0, op=1, scale=1.0, Y=3, U=3, V=3, opt=-1)


Changelog

Version      Date            Changes
v1.1.8 2022/03/27 - Fixed default sigma_vY when the clip has only one plane. (regression from 1.1.7)
v1.1.7 2022/03/10 - Changed the behavior of default sigma_vU.
v1.1.6 2022/03/07 - Fixed default sigma_U/V/vU/vV for RGB formats. - Changed default sigma_vU/vV. Now they are inherited from sigmaU/V.
v1.1.5 2022/01/25 - Fixed the processing of planes for RGB formats. - Properly clamped float mask to 0-1 range in mode=1. (VS plugin r14)
v1.1.4 2022/01/03 - Fixed the behavior when y/u/v=1
v1.1.3 2021/12/28 - Fixed the uninitialized variables when the clip has only one plane
v1.1.2 2021/12/28 - Fixed a bug when sigma=0 and the plane is not processed
v1.1.1 2021/12/26 - Fixed the processing of clips with one plane
v1.1.0 2021/12/17 - Changed chroma planes range from -0.5..0.5 to 0.0..1.0 (float clips). (VS plugin r13) - Added AVX512 code. (VS plugin r13) - Added Kroon, Kirsch and FDoG operatos. (VS plugin r13) - Renamed gmmax parameter to scale and changed its default to 1.0. (VS plugin r13) - Changed default sigma_vY from 1.5 to sigmaY
v1.0.1 2021/08/25 - Fixed sigma for RGB clips
v1.0.0 2020/09/15 - Initial release; port of the VapourSynth plugin

External Links

GitHub - Source code repository.


Back to External Filters

Personal tools