History

avfilter/vf_edgedetect: properly implement double_threshold()

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.

Valery Kot committed 6 years ago

Commit 855d51b1 parent 235a5733 files · +3 −3Browse files

Unified · Split

3 files
  1. libavfilter/vf_edgedetect.c +1 −1
  2. tests/ref/fate/filter-edgedetect +1 −1
  3. tests/ref/fate/filter-edgedetect-colormix +1 −1
libavfilter/vf_edgedetect.c+1−1
@@ -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 ||
tests/ref/fate/filter-edgedetect+1−1
@@ -1 +1 @@
1edgedetect 93ceace33f6636bcdbeb037317c657451edgedetect 04ff46bb35edff3dbad4102391516d25
tests/ref/fate/filter-edgedetect-colormix+1−1
@@ -1 +1 @@
1edgedetect-colormix 1b8658252e2f03fbae30e6d63dd24c7c1edgedetect-colormix 9f50c5586f899a8f5a10059154d64bde

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t