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:
- Initial watermark estimation and detection
- Estimating the matted watermark
- Compute the median of the watermarked image gradients, independently in the
x
andy
directions, at every pixel locationp
.
- 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.
- 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.
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.
# Optional: Create a virtual environment.
python -p python2.7 env
source env/bin/activate
# Install the dependencies
pip install -r requirements.txt
# Launch Jupyter
jupyter-notebook .
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.