原项目地址为rohitrango/automatic-watermark-detection: Project for Digital Image Processing
因为有需求需要使用此项目解决视频去水印的问题,所以把此项目的源码大致看了。感觉写的不怎么好
关于上面那些短板,我针对视频识别水印都做了很大优化,对一个视频的识别,速度在ms级别,可以浏览我的项目:[待添加]()
这个项目很简单,只是调了bug发上来。研究之后的成果,我后续会发上来,带有文档说明。
This was a project that was built as part of project for CS663 (Digital Image Processing). This is a crude Python implementation of the paper "On The Effectiveness Of Visible Watermarks", Tali Dekel, Michael Rubinstein, Ce Liu and William T. Freeman, Conference on Computer Vision and Pattern Recongnition (CVPR), 2017.
A watermarked image J
is obtained by imposing a watermark W
over an unwatermarked image I
with a blend factor . Specifically, we have the following equation:
Where p = (x, y)
is the pixel location. For a set of K
images, we have:
Although we have a lot of unknown quantities (), we can make use of the structural properties of the image to determine its location and estimate its structure. The coherency of and W over all the images can be exploited to solve the above problem with good accuracy. The steps followed to determine these values are:
x
and y
directions, at every pixel location p
.Crop W_m
to remove boundary regions by computing its magnitude and taking the bounding box of the edge map. The initial estimated watermark is estimated using Poisson reconstruction. Here is an estimated watermark using a dataset of 450+ Fotolia images.
Watermark detection: Obtain a verbose edge map (using Canny edge detector) and compute its Euclidean distance transform, which is then correlated with to get the Chamfer distance from each pixel to the closest edge. Lastly, the watermark position is taken to be the pixel with minimum distance in the map.
Please refer to the paper and supplementary for a more in-depth description and derivation of the algorithm.
Here are some of the results for watermarked and watermark removed images:
However, this is a rough implementation and the removal of watermark leaves some "traces" in form of texture distortion or artifacts. I believe this can be corrected by appropriate parameter tuning.
For more information, refer to the original paper here
I do not encourage or endorse piracy by making this project public. The code is free for academic/research purpose. Please feel free to send pull requests for bug fixes/optimizations, etc.