• Jean Delvare's avatar
    lavfi/delogo: use weighted interpolation · 16fd75ce
    Jean Delvare authored
    The original delogo algorithm interpolates both horizontally and
    vertically and uses the average to compute the resulting sample. This
    works reasonably well when the logo area is almost square. However
    when the logo area is significantly larger than high or higher than
    large, the result is largely suboptimal.
    
    The issue can be clearly seen by testing the delogo filter with a fake
    logo area that is 200 pixels large and 2 pixels high. Vertical
    interpolation gives a very good result in that case, horizontal
    interpolation gives a very bad result, and the overall result is poor,
    because both are given the same weight.
    
    Even when the logo is roughly square, the current algorithm gives poor
    results on the borders of the logo area, because it always gives
    horizontal and vertical interpolations an equal weight, and this is
    suboptimal on borders. For example, in the middle of the left hand
    side border of the logo, you want to trust the left known point much
    more than the right known point (which the current algorithm already
    does) but also much more than the top and bottom known points (which
    the current algorithm doesn't do.)
    
    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.
    Signed-off-by: 's avatarJean Delvare <khali@linux-fr.org>
    Signed-off-by: 's avatarStefano Sabatini <stefasab@gmail.com>
    16fd75ce
Name
Last commit
Last update
compat Loading commit data...
doc Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavresample Loading commit data...
libavutil Loading commit data...
libpostproc Loading commit data...
libswresample Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitignore Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
INSTALL Loading commit data...
LICENSE Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...
RELEASE Loading commit data...
arch.mak Loading commit data...
cmdutils.c Loading commit data...
cmdutils.h Loading commit data...
cmdutils_common_opts.h Loading commit data...
common.mak Loading commit data...
configure Loading commit data...
ffmpeg.c Loading commit data...
ffmpeg.h Loading commit data...
ffmpeg_filter.c Loading commit data...
ffmpeg_opt.c Loading commit data...
ffplay.c Loading commit data...
ffprobe.c Loading commit data...
ffserver.c Loading commit data...
library.mak Loading commit data...
version.sh Loading commit data...