VsTCanny: Difference between revisions
From Avisynth wiki
Jump to navigationJump to search
vsTCanny |
Update to the latest version |
||
| Line 2: | Line 2: | ||
{{Filter3 | {{Filter3 | ||
|1={{Author/Asd-g}} | |1={{Author/Asd-g}} | ||
|2=v1. | |2=v1.1.4 | ||
|3=[https://github.com/Asd-g/AviSynth-vsTCanny/releases/ | |3=[https://github.com/Asd-g/AviSynth-vsTCanny/releases/ vsTCanny] | ||
|4=Edge Detection | |4=Edge Detection | ||
|5=[http://www.gnu.org/licenses/gpl-2.0.txt GPLv2] | |5=[http://www.gnu.org/licenses/gpl-2.0.txt GPLv2] | ||
|6= | |6= | ||
| Line 23: | Line 23: | ||
== [[Script variables|Syntax and Parameters]] == | == [[Script variables|Syntax and Parameters]] == | ||
:{{Template:FuncDef|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 " | :{{Template:FuncDef|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")}} | ||
<br> | <br> | ||
::{{Par2| |clip| }} | ::{{Par2| |clip| }} | ||
| Line 32: | Line 32: | ||
::{{Par2|sigmaV|float|}} | ::{{Par2|sigmaV|float|}} | ||
:::Standard deviation of horizontal gaussian blur. | :::Standard deviation of horizontal gaussian blur. | ||
:::Must be | :::Must be positive value. | ||
:::Default: sigmaY = 1.5; sigmaU = sigmaV = | :::Setting to 0 disables gaussian blur. | ||
:::Default: sigmaY = 1.5; sigmaU = sigmaV = sigmaY/2 for half resolution chroma and sigmaU = sigmaV = sigmaY for full resolution chroma. | |||
<br> | <br> | ||
::{{Par2|sigma_vY|float| | ::{{Par2|sigma_vY|float|sigmaY}} | ||
::{{Par2|sigma_vU|float|}} | ::{{Par2|sigma_vU|float|}} | ||
::{{Par2|sigma_vV|float|}} | ::{{Par2|sigma_vV|float|}} | ||
:::Standard deviation of vertical gaussian blur. | :::Standard deviation of vertical gaussian blur. | ||
:::Must be | :::Must be positive value. | ||
:::Default: sigma_vY = | :::Setting to 0 disables gaussian blur. | ||
:::Default: sigma_vY = sigmaY; sigma_vU = sigma_vV = sigma_vY/2 for half resolution chroma and sigma_vU = sigma_vV = sigma_vY for full resolution chroma. | |||
<br> | <br> | ||
::{{Par2|t_h|float|8.0}} | ::{{Par2|t_h|float|8.0}} | ||
| Line 47: | Line 49: | ||
::{{Par2|t_l|float|1.0}} | ::{{Par2|t_l|float|1.0}} | ||
:::Low gradient magnitude threshold for hysteresis. | :::Low gradient magnitude threshold for hysteresis. | ||
:::Must be lower than t_h. | |||
<br> | <br> | ||
::{{Par2|mode|int|0}} | ::{{Par2|mode|int|0}} | ||
| Line 53: | Line 56: | ||
:::*-1 : Gaussian blur only. | :::*-1 : Gaussian blur only. | ||
:::*0 : Thresholded edge map (2^bitdepth-1 for edge, 0 for non-edge). | :::*0 : Thresholded edge map (2^bitdepth-1 for edge, 0 for non-edge). | ||
:::* 1: Gradient magnitude map. | :::*1 : Gradient magnitude map. | ||
<br> | <br> | ||
::{{Par2|op|int|1}} | ::{{Par2|op|int|1}} | ||
:::Sets the operator for edge detection: | :::Sets the operator for edge detection: | ||
:::*0: The operator used in tritical's original filter. | :::*0 : The operator used in tritical's original filter. | ||
:::*1: The operator proposed by P. Zhou et al. | :::*1 : The operator proposed by P. Zhou et al. | ||
:::*2: The Sobel operator. | :::*2 : The Sobel operator. | ||
:::*3: The Scharr operator. | :::*3 : The Scharr operator. | ||
:::*4 : The Kroon operator. | |||
:::*5 : The Kirsch operator. | |||
:::*6 : he FDoG operator. | |||
<br> | <br> | ||
::{{Par2| | ::{{Par2|scale|float|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. | |||
<br> | <br> | ||
::{{Par2|y|int|3}} | ::{{Par2|y|int|3}} | ||
| Line 81: | Line 88: | ||
:::*1 : Use SSE2 code. | :::*1 : Use SSE2 code. | ||
:::*2 : Use AVX2 code. | :::*2 : Use AVX2 code. | ||
:::*3 : Use AVX512 code. | |||
<br> | <br> | ||
== Examples == | == Examples == | ||
{{Template:FuncDef3|vsTCanny}} with default settings (for YUV420): | {{Template:FuncDef3|vsTCanny}} with default settings (for YUV420): | ||
[[AviSource]]("blah.avi") | [[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, | t_h=8.0, t_l=1.0, mode=0, op=1, scale=1.0, Y=3, U=3, V=3, opt=-1) | ||
{{Template:FuncDef3|vsTCanny}} with default settings (for YUV444): | {{Template:FuncDef3|vsTCanny}} with default settings (for YUV444): | ||
[[AviSource]]("blah.avi") | [[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, | t_h=8.0, t_l=1.0, mode=0, op=1, scale=1.0, Y=3, U=3, V=3, opt=-1) | ||
<br> | <br> | ||
== Changelog == | == Changelog == | ||
Version Date Changes<br> | Version Date Changes<br> | ||
v1.0.0 2020/09/15 - Initial release; port of the VapourSynth plugin | v1.1.4 2022/01/03 - Fixed the behavior when y/u/v=1<br> | ||
v1.1.3 2021/12/28 - Fixed the uninitialized variables when the clip has only one plane<br> | |||
<br> | v1.1.2 2021/12/28 - Fixed a bug when sigma=0 and the plane is not processed<br> | ||
v1.1.1 2021/12/26 - Fixed the processing of clips with one plane<br> | |||
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<br> | |||
v1.0.1 2021/08/25 - Fixed sigma for RGB clips<br> | |||
v1.0.0 2020/09/15 - Initial release; port of the VapourSynth plugin<br> | |||
== External Links == | == External Links == | ||
Revision as of 23:58, 11 January 2022
| Abstract | |
|---|---|
| Author | Asd-g |
| Version | v1.1.4 |
| Download | vsTCanny |
| Category | Edge Detection |
| License | GPLv2 |
| Discussion | |
Description
Builds an edge map using canny edge detection.
vsTCanny is a port of the VapourSynth plugin TCanny.
Requirements
- [x86]: AviSynth+ or AviSynth 2.6
- [x64]: AviSynth+
- Supported color formats: Y8, YV12, YV16, YV24, YV411
- AviSynth+: all planar formats (8/10/12/14/16/32-bit, Y, YUV(A), and RGB(A) with or without alpha) are supported.
- 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.
- clip =
- 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 = sigmaV = sigmaY/2 for half resolution chroma and sigmaU = sigmaV = sigmaY for full resolution chroma.
- float sigmaY = 1.5
- 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; sigma_vU = sigma_vV = sigma_vY/2 for half resolution chroma and sigma_vU = sigma_vV = sigma_vY for full resolution chroma.
- float sigma_vY = sigmaY
- 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.
- Must be lower than t_h.
- float t_l = 1.0
- int mode = 0
- Sets the output format:
- int mode = 0
- -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:
- int op = 1
- 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 : he 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.
- float scale = 1.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.
- Planes to process.
- int y = 3
- 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.
- Sets which cpu optimizations to use.
- int opt = -1
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.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 ←