VsTCanny
From Avisynth wiki
(Difference between revisions)
(vsTCanny) |
m (→Syntax and Parameters: typo) |
||
(4 intermediate revisions by one user not shown) | |||
Line 2: | Line 2: | ||
{{Filter3 | {{Filter3 | ||
|1={{Author/Asd-g}} | |1={{Author/Asd-g}} | ||
− | |2=v1. | + | |2=v1.1.8 |
− | |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 | + | :::Setting to 0 disables gaussian blur. |
+ | :::Default: | ||
+ | :::: sigmaY = 1.5 | ||
+ | :::: sigmaU = sigmaY / horizontal_chroma_subsampling_factor | ||
+ | :::: sigmaV = sigmaU | ||
<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 | ||
+ | :::: if sigma_vY not defined: if horizontal and vertical subsampling factors are equal <code>sigma_vU = sigmaU</code> else <code>sigma_vU = sigmaU * horizontal_chroma_subsampling_factor</code> | ||
+ | :::: if sigma_vY defined: sigma_vU = sigma_vY / vertical_chroma_subsampling_factor | ||
+ | :::: sigma_vV = sigma_vU | ||
<br> | <br> | ||
::{{Par2|t_h|float|8.0}} | ::{{Par2|t_h|float|8.0}} | ||
Line 47: | Line 56: | ||
::{{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 63: | ||
:::*-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 : The 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 95: | ||
:::*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.8 2022/03/27 - Fixed default sigma_vY when the clip has only one plane. (regression from 1.1.7)<br> |
− | + | v1.1.7 2022/03/10 - Changed the behavior of default sigma_vU.<br> | |
− | <br> | + | 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.<br> | ||
+ | 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)<br> | ||
+ | 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> | ||
+ | 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 == |
Latest revision as of 23:54, 5 November 2022
Abstract | |
---|---|
Author | Asd-g |
Version | v1.1.8 |
Download | vsTCanny |
Category | Edge Detection |
License | GPLv2 |
Discussion |
Contents |
[edit] Description
Builds an edge map using canny edge detection.
vsTCanny is a port of the VapourSynth plugin TCanny.
[edit] 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.
[edit] 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.
- 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 = sigmaY / horizontal_chroma_subsampling_factor
- sigmaV = sigmaU
- 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
- if sigma_vY not defined: if horizontal and vertical subsampling factors are equal
sigma_vU = sigmaU
elsesigma_vU = sigmaU * horizontal_chroma_subsampling_factor
- if sigma_vY defined: sigma_vU = sigma_vY / vertical_chroma_subsampling_factor
- sigma_vV = sigma_vU
- 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 : 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.
- 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
[edit] 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)
[edit] 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
[edit] External Links
GitHub - Source code repository.
Back to External Filters ←