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.
Showing the changes to libavfilter (1 of 3 files). Show all
Unified · Split
| @@ -294,7 +294,7 @@ static void double_threshold(int low, int high, int w, int h, · 293 unmodified lines | |||
| 294 | continue; | 294 | continue; |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | if ((!i || i == w - 1 || !j || j == h - 1) && | 297 | if (!(!i || i == w - 1 || !j || j == h - 1) && |
| 298 | src[i] > low && | 298 | src[i] > low && |
| 299 | (src[-src_linesize + i-1] > high || | 299 | (src[-src_linesize + i-1] > high || |
| 300 | src[-src_linesize + i ] > high || | 300 | src[-src_linesize + i ] > high || |