Code Monkey home page Code Monkey logo

automatic-watermark-detection's Introduction

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.

automatic-watermark-detection's People

Contributors

rohitrango avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.