[FFmpeg-devel] [PATCH 1/2 v2] delogo: Use weighted interpolation

Jean Delvare khali at linux-fr.org
Fri Jun 28 13:07:19 CEST 2013

Hi Stefano,

On Thu, 27 Jun 2013 23:12:45 +0200, Stefano Sabatini wrote:
> On date Wednesday 2013-06-26 14:50:37 +0200, Jean Delvare encoded:
> > By properly weighting each known point when computing the value of
> > each interpolated pixel, the visual result is much better, especially
> > on borders and/or for high or large logo areas.
> >
> > The algorithm I implemented guarantees that the weight of each of the
> > 4 known points directly depends on its distance to the interpolated
> > point. It is largely inspired from the original algorithm, the key
> > difference being that it computes the relative weights globally
> > instead of separating the vertical and horizontal interpolations and
> > combining them afterward.
> [...]
> LGTM and nice idea.

Thanks :)

> Another possibility would be to consider generalized barycentric
> coordinates with respect to the logo rectangle vertexes, but this
> would be a completely different algorithm.

Indeed. I have been considering using different "known points" than the
current algorithm does, but this is beyond the scope of my current
changes. Using the vertexes only doesn't strike me as a better choice,
as they are statistically further away than the vertical and horizontal
projections the current algorithm uses. Distances to vertexes are also
much more costly to compute.

Also, there is another logo removal filter, vf_removelogo, and while I
did not yet look into the code closely, it seems to be much more
complex and slower. So there probably is value in keeping the delogo
filter reasonably fast and simple, and use the removelogo filter for
more advanced processing.

There is so much more that could be experimented with, I'm sure there's
more than one image reconstruction algorithm out there which could be
used for logo removal. And not only on a per-picture basis... IMHO a
good logo removal filter would use the motion vectors as an input, so
that it can use relevant data from the previous / next frame(s) to
improve the image reconstruction.

> I assume that the algorithm has been tested,

Oh yes :)

> and will push it in a day
> (or let Michael push it) if there are no other comments.

Jean Delvare

More information about the ffmpeg-devel mailing list