[FFmpeg-devel] [PATCH v3] lavf/vf_find_rect: add the dual input support function

Michael Niedermayer michael at niedermayer.cc
Fri Jun 28 19:02:27 EEST 2019


On Fri, Jun 28, 2019 at 05:23:22PM +0200, Paul B Mahol wrote:
> On 6/28/19, Limin Wang <lance.lmwang at gmail.com> wrote:
> > On Fri, Jun 28, 2019 at 09:49:27AM +0200, Michael Niedermayer wrote:
> >> On Thu, Jun 27, 2019 at 05:40:31PM +0800, lance.lmwang at gmail.com wrote:
> >> > From: Limin Wang <lance.lmwang at gmail.com>
> >> >
> >> > Please using the below command for the testing:
> >> > ./ffmpeg -i input.ts -i ref.png -filter_complex
> >> > find_rect,cover_rect=cover.jpg:mode=cover output.ts
> >> >
> >> > I have updated the help document for the function change.
> >> >
> >> > Reviewed-by: Moritz Barsnick <barsnick at gmx.net>
> >> > Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> >> > ---
> >> >  doc/filters.texi           |  12 +--
> >> >  libavfilter/version.h      |   2 +-
> >> >  libavfilter/vf_find_rect.c | 173 +++++++++++++++++++++++--------------
> >> >  3 files changed, 118 insertions(+), 69 deletions(-)
> >> >
> >> > diff --git a/doc/filters.texi b/doc/filters.texi
> >> > index 2d9af46a6b..92e1dee07e 100644
> >> > --- a/doc/filters.texi
> >> > +++ b/doc/filters.texi
> >> > @@ -10156,12 +10156,14 @@ Set color for pixels in fixed mode. Default is
> >> > @var{black}.
> >> >
> >> >  Find a rectangular object
> >> >
> >> > +This filter takes in two video inputs, the first input is considered
> >> > +the "main" source and is passed unchanged to the output. The "second"
> >> > +input is used as a rectangular object for finding. Now the "second"
> >> > +input will be auto converted to gray8 format.
> >> > +
> >> >  It accepts the following options:
> >> >
> >> >  @table @option
> >> > - at item object
> >> > -Filepath of the object image, needs to be in gray8.
> >> > -
> >> >  @item threshold
> >> >  Detection threshold, default is 0.5.
> >> >
> >> > @@ -10178,7 +10180,7 @@ Specifies the rectangle in which to search.
> >> >  @item
> >> >  Cover a rectangular object by the supplied image of a given video using
> >> > @command{ffmpeg}:
> >> >  @example
> >> > -ffmpeg -i file.ts -vf
> >> > find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
> >> > +ffmpeg -i file.ts -i newref.pgm -filter_complex
> >> > find_rect,cover_rect=cover.jpg:mode=cover new.mkv
> >>
> >> It will be needed to support the old syntax until the next 2 major API
> >> bumps
> >> at minimum.
> > I haven't find a good way to support the old the syntax. With the dual
> > input, the input has been configured with two input(main and
> > find_object), so it'll report error if with old syntax.
> >
> > Or how about to create a new video filter like find_logo and keep the
> > find_rect
> > filter untouch as I plan to improve it for logo detection.
> 
> Unacceptable.

that would have been the easy option


> 
> Is this filter actually useful? If not, just remove it.

there was a company that wanted it.
In fact they would have paid me if i didnt make it open source ...
So this must be important to at least them and their competitor.

If you think that we have too many filters then we could start a broader
discussion/thread maybe about combining or factoring things. But we probably
should only go there if theres a broad consensus. I dont want to step
on anyones toes ...

Thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190628/89901b15/attachment.sig>


More information about the ffmpeg-devel mailing list