WATERMARK
  ELIMINATION


   Created
   17 Jun 2007


   


© Guillermo Luijk 2007



WATERMARK MODELLING

From seeing the following panoramic view of the Ciudad de las Ciencias (Valencia, Spain) in the Ojo Digital forum, that was uploaded by his author in a gigantic size (it was made of 12 shots) but with a watermark as a protection against non authorised usage, I had the idea that it should not be very complicated to work out an algorithm to eliminate its watermark.


Fig. 1 View of the Ciudad de las Ciencias (Valencia, Spain). No watermark here.


To reach a mathematical equation that would allow to restore the original colour in the pixels affected by the watermark I made use of the following two assumptions:

ASSUMPTION 1

A watermark is an image overlapped with a certain degree of transparency over the original image, so that the final colour of each pixel will be a linear combination of the original image and watermark colours:

   [final colour] = p * [original colour] + (1 - p) * [watermark colour]

being 0 < p < 1 the transparency parameter of the watermark; the higher p is, the less visible the watermark will become. In order to obtain the original colour we must isolate it:

   [original colour] = ([final colour] - (1 - p) * [watermark colour]) / p

This expression will be replicated individually for each channel.


ASSUMPTION 2

In all its pixels, the watermark presents a uniform colour and it overlaps over the original image with a constant degree of transparency. Hence the former unknown values [watermark colour] and p are constant in the whole area affected by the watermark.

~~~


With these assumptions we just need to calculate the two unknown parameters, and to do this we can make use of any couple of areas of the image where both the original and the watermarked colour appear together, typically in wide areas with a uniform original colour that were split by the watermark border. We would have then a system of two equations with two unknown values that, despite it is not linear is very easy to solve:

   f1 = p * a1 + (1 - p) * m
   f2 = p * a2 + (1 - p) * m

   a=[original colour], f=[final colour], m=[watermark colour], p=transparency, 1,2=evaluated zone

after solving we get:

   p = (f1 - f2) / (a1 - a2)
   m = (f1 * a2 - f2 * a1) / (f1 - f2 - a1 + a2)

This system of equations can be calculated for any double pair of pixels that we may choose. It can be solved for many couples of pixels and average results, or the original and final colours in two uniform areas can be averaged and then solved, all with the goal to reduce statistic variance.

The true is that I just needed to use 4 pixels to perfectly model the watermark used by the author and solve the equations system. Once the unknown values are found out we just need to apply the following expression to restore the original colour of the image eliminating the effect of the watermark:

   a = (f - (1 - p) * m) / p


EXAMPLE OF APPLICATION

We apply the characterisation algorithm to the real watermarked image. This picture by courtesy of his author rubichi. Just a fraction is displayed here (move the mouse over the image to 'eliminate' the watermark):


Fig. 2 Watermark elimination (move mouse over image).


We blended the result of the colour restoration in the watermark areas with the original image out of these areas, obtaining a final image free of the watermark and with indistinguishable borders between the watermarked and non watermarked areas.


CONCLUSION

To preserve the authorship of photographic works we must be careful with the type of watermarks used. The algorithm explained only works on watermarks that follow the assumptions of uniform colour and transparency, that by the way are the most common. That means that if the watermark would have had some colour gradation, colour change, a visible border,... the method would have not been valid.

In any case, the most recommended is never to upload images at a size that could be usable for printing or other use in case someone manages to eliminate our watermark.

Periodically people contact me to ask for help in eliminating watermarks. Please avoid to do that. This article wants to help to prevent illegal use of any copyrighted photo stuff, and if anyone is interested in a particular watermarked photography he should contact the author.


~~~


If this content has been useful to you, please consider making a contribution to support this site. Keeping it means an important effort, so as considerable storage space and bandwidth in the server. It is a simple and totally secure operation.



gluijk@hotmail.com
  CURIOSITIES

HOME