wait-a-moment / automatic-watermark-detection-1

debug automatic-watermark-detection,and success run

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

关于此项目说明

原项目地址为rohitrango/automatic-watermark-detection: Project for Digital Image Processing

因为有需求需要使用此项目解决视频去水印的问题,所以把此项目的源码大致看了。感觉写的不怎么好

  • 速度方面,tf版的梯度下降实在是太慢了,感觉是代码没写好的问题
  • 水印提取,图片变化要大一点才好,相似对提取效果不好
  • 水印匹配,这个代码实现出来的,我实际用的匹配得不怎么准。比如视频中抖音水印会变化,对于旋转不变性和尺度不变性有很大的优化空间

关于上面那些短板,我针对视频识别水印都做了很大优化,对一个视频的识别,速度在ms级别,可以浏览我的项目:待添加

这个项目很简单,只是调了bug发上来。研究之后的成果,我后续会发上来,带有文档说明。

以下为原版readme

Automatic watermark detection and removal

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.

Rough sketch of the algorithm

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:

  • Initial watermark estimation and detection
  • Estimating the matted watermark
  • Compute the median of the watermarked image gradients, independently in the 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_est

  • 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.

Multi-image matting and reconstruction

  • Estimate keeping fixed.
  • Watermark update - Update the value of keeping the rest fixed.
  • Matte update - Update the value of keeping the rest fixed.

Please refer to the paper and supplementary for a more in-depth description and derivation of the algorithm.

Results

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.

More information

For more information, refer to the original paper here

Disclaimer

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.

About

debug automatic-watermark-detection,and success run


Languages

Language:Python 100.0%