A digital watermark means embedding a set of bits in a file. In our case an image, but in general it could be a video, text or audio file.
Here we have an image of Tooti,
url='http://imageprocessingblog.com/wp-content/uploads/2013/07/Cat1.jpg';image=imread(url);
What Tooti doesn’t know is that there is a beagle dog hiding somewhere… after a simple reconstruction process, we find George watermark in the image.
So, how is it done?
There are a many different ways to create watermarks in images, one of them works in the image spatial domain, where the images are seperated into bits planes and a new image is reconstructed by a combination of bit planes from the main image and from the watermark image.
Our watermark image,
url1='http://imageprocessingblog.com/wp-content/uploads/2013/07/Bigel12.jpgMimage=imread(url1);
The bit depth of an image is the number of bits used to indicate the value of a pixel. In MATLAB, logical is a depth of one bit, uint8 is bit depth between 2-8, and uint16 for higher bit depths. Breaking our images to bits-planes, using bitget function:
for i=1:8A{i}=bitget(image,i)*2^(i-1);M{i}=bitget(Mimage,i)*2^(i-1);end
The highest 4 out of 8 bit-planes for each image:
And for the watermark image:
As you can see, almost all of the important visable data is stored in those planes. For creating our new image, the above bit-planes are combined to create one image, where the highest three bit-planes of the watermark will replace the lower three planes of the original image.
NewImage=A{8}+A{7}+A{6}+A{5}+A{4}+M{8}*(2^(-5))+M{7}*(2^(-5))+M{6}*(2^(-5));
and this is our final image (it is the first image that is shown in this post).
A reverse process to extract our message,
for i=1:8N{i}=bitget(NewImage,i)*2^(i-1);end
this is the hidden watermark,
WaterMark=N{1} * 2^7 + N{2} * 2^6 + N{3} * 2^5;