Thursday, September 9, 2021

Digital Watermarking

Introduction

With the rapid growth of the internet and world wide web more and more digital media are transmitted and shared across the networks. So commercial organizations tend to use digital watermarks on their digital media such as audio, video, image, etc to protect the ownership rights. As Bryan Smith (Overview of Digital Watermark—For Images and Files, SANS institute, 2000-2002.) explained Digital watermarking is a means to protect ownership of files and images. The idea behind digital watermarking is to create a unique identifier and embed it on a file or image in order to be able to prove that the file or image is the property of the rightful owner. Digital watermarking and steganography are closely related terms. But Watermarking tries to hide a message related to the actual content of the digital signal, while in steganography the digital signal has no relation to the message, and it is merely used as a cover to hide its existence. Other than digital copyright management, digital watermarking has few other important applications such as broadcast monitoring, owner identification, Transaction tracking and copy control.
There are two main watermark embedding strategies available. They are

  1. Blind embedding
  2. Informed embedding

Blind embedding does not exploit the original image statistics to embed a message in an image. The detection is done using linear correlation. Informed embedding is an extension of the blind embedding system. It aims to provide 100% effectiveness in the watermarking detection. In informed embedding the watermark has significant influence from the original image before it adds to the image. Once the watermarked digital media is transmitted over a channel, noise is added. These added noise significantly affect the watermark decoding process. The noise types may be Gaussian noise, Shot noise, Salt and pepper noise etc.

Activity

In this tutorial I used labeled Faces in the Wild by University of Massachusetts, Amherst. This dataset contains 13,000 labeled faces that could be used for any machine learning tasks involving facial recognition. I will be using this dataset for the evaluation of my basic watermarking model. I divide the image set into three sets which contain 4000, 4000 and 5000 images. Then I embered 1-bit watermark, 0 and 1 to the image set 1 and 2. For that, need to derive a reference pattern (Wr) based on the Gaussian Distribution and based on that reference pattern need to derive the message pattern (Wm). With the given alpha value equals to 1 and Wm, I calculate the added pattern (Wa). Embed the Wa into the cover work (CO), which represents all the images in set 1 and set 2 to obtain watermarked work (Cw ). I generate Gaussian and Salt and Pepper noise and add them to the watermarked and non watermarked (image set 3) images one noise at a time. Then using a blind watermark detector calculate the linear correlation between each image and the reference pattern. Plot the detection value resulting from the blind watermark detector and the number of images belonging to each detection value. Then I identify upper and lower decision thresholds for the blind watermark detector for each type of channel noise mentioned above and calculate the false positive rate for each type of noise in the blind watermark embedder. Finally I convert the blind watermark embedder into an informed watermark embedder using the embedding strength parameters as 0.4.

All the algorithms implemented using C++ and OpenCV

  • Downloaded the “All images as gzipped tar file” (173MB, md5sum a17d05bd522c52d84eca14327a23d494) and copy first 4000 images in to a folder named 1, copy next 4000 images to a folder named 2 and copy next 5000 images to a folder named 3.
  • Derive a reference pattern (W r ) based on the Gaussian Distribution. All downloaded images were 250*250 images and the reference pattern also need to be in size 250*250. Create a Mat with 32 bit float values and one channel. Generate a uniform distribution with min value = 0 and max value = 10 and assign the values to the above created mat. Converted the uniform distribution into a normal distribution by subtracting the mean value of the distribution from each value and dividing each by the standard deviation. Then convert the 1 channel image to a 3 channel image by copying the channel 1s values to each channel.
  • Using the reference pattern derive the message pattern (Wm). For 1 bit (1 or 0), the message W_m = W_r when m = 1 and W_m = -W_r when m = 0. Used W_r as it is for messages when m = 1 and used minus version of W_r for messages when m = 0.
  • Compute the added pattern (W a ) using the W m and an alpha value initially set to 1. Added pattern W_ a = α * W_m, the α value is given as 1. So W_a = W_m
  • Embed the W a into the cover work (C O ) to obtain watermarked work (C w ). The cover work represents all the images in set 1 and set 2.To embed W_a to C_0 added the W_a_0 and W_a_1 to the original image C_0. By adding W_a_0 and W_a_1 to the original image C_0 obtained the watermarked images C_w_1 and C_w_0.
  • Add noise to the Cw to represent external effects to the watermark due to processing or malicious intent. The noise functions are
    • Gaussian Noise - Create a Mat with 32 bit float values and one channel. Generate a uniform distribution with min value = 0 and max value = 5 and assign the values to the above created mat. Converted the uniform distribution into a normal distribution by subtracting the mean value of the distribution from each value and dividing each by the standard deviation. Then convert the 1 channel image to a 3 channel image by copying the channel 1s values to each channel.
      Now Mat noise represents a noise based on the Gaussian Distribution.
    • Salt and Pepper Noise - Create a Mat with 32 bit float values and three channels filled with zero. Select a random pixel from the empty Mat. The selected pixel has BGR values. Randomly fill the B, G and R values of the selected pixel by 0 or 255. Number of noise pixels are given and that number of pixel values are changed based on the above mentioned algorithm.
      Now spNoise Mat contain a Mat with Salt and pepper noise. In a salt and pepper noise disturbance the value of a pixel may change to its highest value 255 or to its lowest value 0. For a multi channel pixel, the noise may affect each channel equally or differently. In above code I assumed that the noise disturbs the BGR values of a pixel in different levels. So for a particular pixel, all or a few BGR values become either 0 or 255.
  • Using a blind watermark detector with linear correlation, detect the entire set of images for the watermarked message (0 or 1) or “No watermark” in the case of nothing being embedded. Calculate the Gaussian Noise and Salt Papper NOise
    • With Gaussian Noise - Add the calculated gaussian noise to watermarked images.
    • Calculated linear correlation of watermarked images C_w_0, C_w_1 and reference pattern W_r using the following function.
      Did an element wise multiplication for C_w and W_r, using the OpenCV mul() function. Then calculated the average of B G R of each pixel. Then sum all average pixel values and divide it by number of pixels
    • Computed all the linear correlation of watermarked messages (0 and 1) and “No watermark” messages for all 13000 images which divide into 4000 images for m = 0, 4000 images for m = 1 and 5000 images for no watermark. Obtained the results as a comma separated 3 strings.
    • Using Jupyter Notebook and Matplotlib plotted the results as histograms. Connect all the bin heads of the histogram to obtain a clear result.
      The result is
    • Upper and Lower decision thresholds With the gaussian noise - Calculate the detection rate values of graph interchanging sections.
      With the Gaussian type of channel noise the upper decision threshold is 0.4500 and the lower decision threshold is -0.6475.
    • False Positive Rate With Gaussian Noise - Calculate the total number of images detected as watermarked images which actually do not have watermarks and the images not detected as watermarked images which actually have watermarks.
    • Write a simple java program to access the text files created by the C++ program and calculate the sum of the false positives based on the thresholds found above.
      Received counts :
      • Within the range 0 to 0.45, 265 images identified as false positives
      • Within the range -0.6475 to 0, 328 images identified as false positives
      • Within the range infinity to 0.45, 267 images identified as false positives
      • Within the range -0.6475 to infinity 174 images identified as false positives
      Calculations :
      • Total False positives when gaussian noise present = 265+328+267+174 = 1034
      • False positive rate (FPR) when gaussian noise present = 1034/13000 = 0.079
      • As a percentage FPR when gaussian noise present = 7.9%
    • With Salt and pepper Noise - Added the generated salt and pepper noise to the watermarked image as follows
    • Calculate the linear correlation as above gaussian noise section and plot a graph with the received values.
    • Upper and Lower decision thresholds With the Salt and pepper noise - Calculate the detection rate values of graph interchanging sections.
      With the Salt and pepper type of channel noise the upper decision threshold is 0.4000 and the lower decision threshold is -0.6450.
    • False Positive Rate With Salt and pepper Noise - Calculate the total number of images detected as watermarked images which actually do not have watermarks and the images not detected as watermarked images which actually have watermarks.
    • Write a simple java program to access the text files created by the C++ program and calculate the sum of the false positives based on the thresholds found above.
      Received counts :
      • Within the range 0 to 0.4, 192 images identified as false positives
      • Within the range -0.645 to 0, 360 images identified as false positives
      • Within the range infinity to 0.4, 347 images identified as false positives
      • Within the range -0.645 to infinity 176 images identified as false positives
      Calculations :
      • Total False positives when Salt and pepper noise present = 192+360+347+176 = 1075
      • False positive rate (FPR) when Salt and pepper noise present = 1075/13000 = 0.082
      • As a percentage FPR when Salt and pepper noise present = 8.2%
    • By observing above results we can conclude that when having gaussian noise over a channel it makes less effect on the transmitted media than having salt and pepper noise over a channel. Because the gap between upper and lower decision thresholds when gaussian type noise is present is bigger than the gap between upper and lower decision thresholds when salt and pepper type noise are present. And there is less false positive rate when gaussian noise occurs in a channel than Salt and pepper noise.
  • Covert the blind watermark embedder written above into an informed watermark embedder. Use 0.4 as the embedding strength parameter. As above activities generated a gaussian type reference pattern and embered the single bit (0 and 1) watermark to two sets of 4000 images and those two watermarked image sets and image set with 5000 images were used to calculate the linear correlation. No noise was added, take alpha value as 1. Using the detection rates retrieved plot graphs.
  • Since embedding strength parameter (𝛽) given as 0.4 use two upper and lower decision threshold values as Tc (when m = 0; Tc = 0.6475 and when m = 1; Tc = 0.45.) value to calculate the alpha (α) according to the following equation.
    Used the reference pattern and linear correlation calculating algorithm used in above activity.
    With the above function calculated the alpha values for Tc = 0.6475 and Tc = 0.45. Based on that alpha values, obtained the added pattern (W_a) and watermarked images. Calculate the detection values and plot them.
  • By observing above results can conclude that when the linear correlation value was above 0.85, the message is 1. when the linear correlation was below -1.0475 the message is 1. When the linear correlation is between -1.0475 and 0.85 it is a no watermark embedded image. there are no overlaps between images that have either a 1 or a 0 or no watermark embedded and they are clearly separated.


No comments:

Post a Comment

Featured Post

Data recovery of CCTV DVR systems which have Proprietary OS and Proprietary file systems - Literature Review

Abstract The purpose of this study is to explore some different ways of extracting data from closed-circuit television (CCTV) Digital video...

Popular Posts