[FFmpeg-devel] [PATCH v2] avfilter/vf_edgedetect: properly implement double_threshold()

Valery Kot valery.kot at gmail.com
Mon Jun 29 10:26:50 EEST 2020


On Sun, Jun 28, 2020 at 12:03 AM Andriy Gelman <andriy.gelman at gmail.com> wrote:
>
> lgtm. I saw a small improvement when testing.
>
> Would be nice to allow weak edges that become strong to trigger neighboring weak
> edges in the future.

Thanks for the comment.

You are right, ideally double_threshold should be recursive (seed from
each "high" peak and spread over "low" peaks). But then potentially we
may end up with width*height/2 recursion depth, which may lead to
stack overflow. So probably some recursion limit is needed, and hence
suboptimal solution.

Or iterative approach, running through the complete image again and
again checking if "low" peaks are touching already selected edge
pixels. Stop when no new pixels can be added to the edge. Better, but
still potentially width*height/2 iterations with width*height
operations each, completely killing performance.

Maybe later I'll try to implement it in a generic way, but this is out
of scope for this patch.

Regards,

Valery Kot


More information about the ffmpeg-devel mailing list