]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/vf_edgedetect: properly implement double_threshold()
authorValery Kot <valery.kot@gmail.com>
Mon, 22 Jun 2020 15:29:21 +0000 (17:29 +0200)
committerAndriy Gelman <andriy.gelman@gmail.com>
Tue, 7 Jul 2020 03:20:53 +0000 (23:20 -0400)
Important part of this algorithm is the double threshold step: pixels
above "high" threshold being kept, pixels below "low" threshold dropped,
pixels in between (weak edges) are kept if they are neighboring "high"
pixels.

The weak edge check uses a neighboring context and should not be applied
on the plane's border. The condition was incorrect and has been fixed in
the commit.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com>
libavfilter/vf_edgedetect.c
tests/ref/fate/filter-edgedetect
tests/ref/fate/filter-edgedetect-colormix

index a5614ea63bba86ad0f478182b9fbaf0ca675680d..df8afbd53296c6a327e91787c476c95e7430e718 100644 (file)
@@ -294,7 +294,7 @@ static void double_threshold(int low, int high, int w, int h,
                 continue;
             }
 
-            if ((!i || i == w - 1 || !j || j == h - 1) &&
+            if (!(!i || i == w - 1 || !j || j == h - 1) &&
                 src[i] > low &&
                 (src[-src_linesize + i-1] > high ||
                  src[-src_linesize + i  ] > high ||
index 23c9953e61ebaae846891f5039682197987a83d7..e49639afac5efaaf6c592fc73354350160f9ec1d 100644 (file)
@@ -1 +1 @@
-edgedetect          93ceace33f6636bcdbeb037317c65745
+edgedetect          04ff46bb35edff3dbad4102391516d25
index e828c6bd19561193d1e4479ef9956d97428aef2c..0df17344bc5c5878bde0df648fa17179f719db7d 100644 (file)
@@ -1 +1 @@
-edgedetect-colormix 1b8658252e2f03fbae30e6d63dd24c7c
+edgedetect-colormix 9f50c5586f899a8f5a10059154d64bde