## 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 <a href="https://www.codecogs.com/eqnedit.php?latex=\alpha" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\alpha" title="\alpha" /></a>. Specifically, we have the following equation:
<div align="center">
<a href="https://www.codecogs.com/eqnedit.php?latex=J(p)&space;=&space;\alpha(p)W(p)&space;+&space;(1-\alpha(p))I(p)" target="_blank"><img src="https://latex.codecogs.com/gif.latex?J(p)&space;=&space;\alpha(p)W(p)&space;+&space;(1-\alpha(p))I(p)" title="J(p) = \alpha(p)W(p) + (1-\alpha(p))I(p)" /></a>
</div>
Where `p = (x, y)` is the pixel location. For a set of `K` images, we have:
<div align="center"><a href="https://www.codecogs.com/eqnedit.php?latex=J_k&space;=&space;\alpha&space;W&space;+&space;(1-\alpha)I_k,\quad&space;k=1,2....K" target="_blank"><img src="https://latex.codecogs.com/gif.latex?J_k&space;=&space;\alpha&space;W&space;+&space;(1-\alpha)I_k,\quad&space;k=1,2....K" title="J_k = \alpha W + (1-\alpha)I_k,\quad k=1,2....K" /></a></div>
Although we have a lot of unknown quantities (<a href="https://www.codecogs.com/eqnedit.php?latex=J_k,&space;W,&space;\alpha" target="_blank"><img src="https://latex.codecogs.com/gif.latex?J_k,&space;W,&space;\alpha" title="J_k, W, \alpha" /></a>), we can make use of the structural properties of the image to determine its location and estimate its structure. The coherency of <a href="https://www.codecogs.com/eqnedit.php?latex=\alpha" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\alpha" title="\alpha" /></a> 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`.
<div align="center"><a href="https://www.codecogs.com/eqnedit.php?latex=\nabla{\hat{W_m}(p)}&space;=&space;median_k(\nabla{J_k(p)})" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\nabla{\hat{W_m}(p)}&space;=&space;median_k(\nabla{J_k(p)})" title="\nabla{\hat{W_m}(p)} = median_k(\nabla{J_k(p)})" /></a></div>
- Crop `W_m` to remove boundary regions by computing its magnitude and taking the bounding box of the edge map. The initial estimated watermark <a href="https://www.codecogs.com/eqnedit.php?latex=\hat{W}_m&space;\approx&space;W_m" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\hat{W}_m&space;\approx&space;W_m" title="\hat{W}_m \approx W_m" /></a> is estimated using Poisson reconstruction. Here is an estimated watermark using a dataset of 450+ Fotolia images.
<img src="https://github.com/rohitrango/automatic-watermark-detection/blob/master/watermark.png?raw=True" alt="watermark_est"/>
- Watermark detection: Obtain a verbose edge map (using Canny edge detector) and compute
its Euclidean distance transform, which is then correlated with <a href="https://www.codecogs.com/eqnedit.php?latex=\nabla{\hat{W_m}}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\nabla{\hat{W_m}}" title="\nabla{\hat{W_m}}" /></a>
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 <a href="https://www.codecogs.com/eqnedit.php?latex=I_k,&space;W_k" target="_blank"><img src="https://latex.codecogs.com/gif.latex?I_k,&space;W_k" title="I_k, W_k" /></a> keeping <a href="https://www.codecogs.com/eqnedit.php?latex=W,&space;\alpha" target="_blank"><img src="https://latex.codecogs.com/gif.latex?W,&space;\alpha" title="W, \alpha" /></a> fixed.
- Watermark update - Update the value of <a href="https://www.codecogs.com/eqnedit.php?latex=W,&space;\alpha" target="_blank"><img src="https://latex.codecogs.com/gif.latex?W" title="W" /></a> keeping the rest fixed.
- Matte update - Update the value of <a href="https://www.codecogs.com/eqnedit.php?latex=W,&space;\alpha" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\alpha" title="\alpha" /></a> 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:
<div align="center">
<img src="https://github.com/rohitrango/automatic-watermark-detection/blob/master/final/fotolia_137840668.jpg?raw=True" width="45%">
<img src="https://github.com/rohitrango/automatic-watermark-detection/blob/master/final/137840668.jpg?raw=True" width="45%"> <br>
<img src="https://github.com/rohitrango/automatic-watermark-detection/blob/master/final/fotolia_168668046.jpg?raw=True" width="45%">
<img src="https://github.com/rohitrango/automatic-watermark-detection/blob/master/final/168668046.jpg?raw=True" width="45%"> <br>
<img src="https://github.com/rohitrango/automatic-watermark-detection/blob/master/final/fotolia_168668150.jpg?raw=True" width="45%">
<img src="https://github.com/rohitrango/automatic-watermark-detection/blob/master/final/168668150.jpg?raw=True" width="45%"> <br>
</div>
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](http://openaccess.thecvf.com/content_cvpr_2017/papers/Dekel_On_the_Effectiveness_CVPR_2017_paper.pdf)
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.
没有合适的资源?快使用搜索试试~ 我知道了~
AI去水印源码 CVPR 2017
共43个文件
jpg:22个
py:9个
png:5个
4星 · 超过85%的资源 需积分: 47 85 下载量 33 浏览量
2018-09-22
20:47:34
上传
评论 6
收藏 38.91MB ZIP 举报
温馨提示
automatic-watermark-detection AI自动去水印源码实现
资源推荐
资源详情
资源评论
收起资源包目录
automatic-watermark-detection-master.zip (43个子文件)
automatic-watermark-detection-master
.ipynb_checkpoints
Watermarking -checkpoint.ipynb 1018KB
coco_dataset
alpha.png 6KB
auth.png 32KB
copyright.png 61KB
watermark.png 22KB
Matting-Levin-Lischinski-Weiss-PAMI.pdf 22.85MB
references.txt 114B
main_cocoset.py 3KB
src
closed_form_matting.py 2KB
__init__.py 122B
image_crawler.py 5KB
tensorflow_experiments.py 5KB
preprocess.py 889B
estimate_watermark.py 5KB
watermark_reconstruct.py 11KB
Watermarking .ipynb 1018KB
main.py 2KB
closed-form-matting
array.npz 84.73MB
README.md 6KB
.gitignore 33B
watermark.png 67KB
final
168668190.jpg 99KB
fotolia_168667186.jpg 95KB
fotolia_168667468.jpg 77KB
fotolia_168667147.jpg 96KB
75353029.jpg 78KB
fotolia_168668150.jpg 131KB
fotolia_168668148.jpg 88KB
137840668.jpg 74KB
168668046.jpg 108KB
168667261.jpg 108KB
168667147.jpg 95KB
168667468.jpg 76KB
fotolia_168668046.jpg 108KB
168668150.jpg 130KB
168668148.jpg 87KB
168667186.jpg 95KB
fotolia_137840668.jpg 74KB
fotolia_168667490.jpg 70KB
fotolia_75353029.jpg 78KB
168667490.jpg 69KB
fotolia_168668190.jpg 100KB
fotolia_168667261.jpg 108KB
共 43 条
- 1
资源评论
- -JALEN-2019-08-15还没用过。
- tchqiq2018-11-28为啥下载这么慢啊?csdn的问题还是我网的问题
- qq_360719272019-07-09git源码,没有完全实现去水印
depaJun
- 粉丝: 19
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Pytorch复现Point-Transformer,用于ShapeNet数据集点云分割
- 【医学影像分析】2D超声图像的分割检测(Ultrasound Nerve Segmentation - Kaggle数据集)
- 嘎嘎香的五款神仙谷歌插件
- .arch书源导入教程.mp4
- 贪心算法介绍及代码示例讲解
- CR13SP35MSI64 Crystal 水晶报表运行组件最后版本64位
- 图像分类数据集:玉米叶是否感染分类数据集(2分类,包含训练集、验证集)
- 小U商城.zip
- 高光谱图像计算机视觉分类图像预处理工具集,包含去除图片无关背景,数据增强,生成标签文件等功能
- (顶刊复现)基于配电网韧性提升的应急移动电源预配置和动态调度(下)-MPS动态调度
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功