Digital Image Watermarking using Optimized DWT-DCT

$ 0.00

Total downloads: 198

This repository is for the free code of digital image watermarking .  This code is for the invisible digital image watermarking using combination of three methods: Discrete Wavelet Transform (DWT), Discrete Cosine transform (DCT) and Bacterial Foraging optimization (BFO). You need to run the file ‘main.m’ in MATLAB and follow the steps shown in video https://youtu.be/jgkaG8hA5vo.

Description

The digital image watermarking is based on the fact that a message is hide into the image such that image doesn't get disturbed and message can be retrieved easily. The method should be robust. For this purpose, this repository is implementing the discrete wavelet transform (DWT) and discrete cosine transform (DCT) in cascade so that more robustness and security can be achieved. These methods divide the image into different frequency regions so that watermark message can be embedded into lowest frequency region which will not disturb the image. DCT is applied first which is similar to Fourier transform and divides the image into two parts of lower and higher frequency region. Lower frequency region has most of the image information.

DCT frequency coefficient of image

Figure: (a) original image (b) low frequency component of DCT (c) high frequency component of DCT

Similarly, DWT using haar  wavelet transform split the images into four different frequency coefficients: approximation coefficients, horizontal , vertical and detailed frequency component.

DWT frequency coefficient for image

Figure: DWT frequency components of image

Horizontal coefficient is used to insert the watermark image and DCT transform is further applied to cH1 component of DWT transformed image. The embedding of watermark image needs a optimal gain factor which sets the robustness of the message. If this value is too high then security will be increased but retrieval of message will be difficult and vice-versa. So trade off gain factor has to be used for embedding of watermark in it. We used Bacterial Foraging optimization (BFO) for this purpose at https://free-thesis.com.

Embedding of Watermark

  1. Take the message and reformulate the message into sequence of 1 and 0.
  2. Encode the message using convolution and this encoded message is further used for processing
  3. Take the key and generate a PN sequence by that key. This PN sequence is kept same during all embedding process.
  4. Generate two highly uncorrelated PN sequence pn_sequence_1 and pn_sequence_0.
  5. Perform DWT on the host image to decompose it into four non-overlapping multi resolution coefficient sets: cA1, cH1, cV1 and cD1.
  6. Choose block size and a mid band coefficients matrix for DCT. In our paper block size of 8 is chosen and a mid band matrix of 8*8 is chosen from literature review.
  7. Now perform DCT on cH1 and embed both PN sequence with a gain factor ‘k’ depending on the bit value of message. The algorithm for embedding PN sequence is shown as

    X = x + k * PN0 if b = 0

    X = x + k * PN1 if b = 1

    Where,

                  x = is the cover image

                  b = is the watermarked bit

                 X = is the embedded image

  8.  Now perform IDCT on cH1.
  9. Repeat step6 and 7 for cV1.
  10. Perform IDWT on updated values of cA1, cH1, cV1, cD1 and name this image as watermarked image.
  11. PSNR and Normalized cross correlation is found out to determine robustness and image quality of watermarked image.
  12. Now follow steps from 1 to 10 for embedding next watermark using separate key for PN sequence. The size of watermark is determined by hit and trial method and that comes less than the previous watermark size.
  13. Number of watermarks embedded depends upon retrieval process because watermark should be retrieved properly that is without any distortion.

Retrieval of Watermark

The joint DWT-DCT algorithm is a blind watermarking algorithm, and thus the original host image is not required to extract the watermark.

  1. Step 1: Steps from 1 to 5 of embedding process are same using same key for PN sequence generation.
  2. Now perform DCT on cH1 and generate a sequence at condition where mid band matrix element is 1. Correlate that sequence to pn_sequenc_0 and to pn_sequence_1.
  3. Repeat the step 2 with cV1.
  4. Take the mean of correlation value for pn_sequence_1 of cH1 and cV1 and correlation value for pn_sequence_0 of cH1 and cV1.
  5. If correlation value for 0 is greater than the correlation value of 1, put the message vector element equal to 0 otherwise 1.correlation_0>correlation_1

    Message vector = 0

    Otherwise

    Message vector = 1

  6. Apply viterbi decoder on message vector to deocde message vector into original.
  7. Reshape the message vector and that will be similar to message embedded.
  8. Same steps are repeated for next watermark message retrieval.

Fitness Function Calculation

To set the optimum value of gain factor bacterial foraging optimization is used in our work. The BFO minimizes the objective function value to get the best location of E.Coli bacteria. So the task is to formulate the objective function to achieve the best gain value. For this purpose inverse of normalized cross correlation has been considered the parameter which is to be minimized. Initially random gain value is selected and that is passed to the embedding and retrieval process of message using DWT and DCT watermarking process. At the watermarked image by this process various noises like Gaussian noise, salt & pepper noise, speckle noise and poisson noise have been added and message is recovered from these noisy images. NCC between the original message and recovered from these noisy watermarked images have been found out. Then the inverse of sum of all these NCCs is considered as the objective function of BFO.

Image watermarking objective function

Result Discussion

We tested the algorithm at three different kind of images which are low,high and medium key images. This category is suggested on the basis of computer graphics literature where the image with more number of histogram bins are aligned to left for low key image, to right for hugh key image and in middle  for medium key image.

low key image for image watermarking

Figure: histogram plot for low and high key image

A gui to compare the three different watermarking algorithms is also designed in MATLAB. It makes easy to run the algorithm and analyse. On the criteria of PSNR, NCC and IF parameters, we found the gain factor tuning by BFO gives best performance.

Image Watermarking GUI

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.