## 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.

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.

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 **

- Take the message and reformulate the message into sequence of 1 and 0.
- Encode the message using convolution and this encoded message is further used for processing
- Take the key and generate a PN sequence by that key. This PN sequence is kept same during all embedding process.
- Generate two highly uncorrelated PN sequence pn_sequence_1 and pn_sequence_0.
- Perform DWT on the host image to decompose it into four non-overlapping multi resolution coefficient sets: cA1, cH1, cV1 and cD1.
- 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.
- 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,

b = is the watermarked bit

X = is the embedded image

- Repeat step6 and 7 for cV1.
- Perform IDWT on updated values of cA1, cH1, cV1, cD1 and name this image as watermarked image.
- PSNR and Normalized cross correlation is found out to determine robustness and image quality of watermarked image.
- 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.
- 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.

- Step 1: Steps from 1 to 5 of embedding process are same using same key for PN sequence generation.
- 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.
- Repeat the step 2 with cV1.
- 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.
- 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_1Message vector = 0
Otherwise

Message vector = 1

- Apply viterbi decoder on message vector to deocde message vector into original.
- Reshape the message vector and that will be similar to message embedded.
- 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.

**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.

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.

5out of 5fodayj25(verified owner)–I am working on my thesis using DWT-SVD and I have embedded in different sub-band of the DWT. I came across your work. It has really helped me. The reason is that my supervisor wants me to compare DWT with other watermarking techniques and see the results. I really appreciate the work done with this code. It very neat and easy to understand.

Thank you!

admin(verified owner)–We are glad, it helped you.

pratuisha.koripilli(verified owner)–thnks

azlina.mahad(verified owner)–ok

qq.qq(verified owner)–nice

imjoy(verified owner)–good

anshuman.prakash(verified owner)–Good

kumarraghav(verified owner)–very good

raillon.georges(verified owner)–Très interresentes approche

ashishsoni(verified owner)–Great

venkat.reddy(verified owner)–great

venkat.reddy(verified owner)–great

rohit.bumo(verified owner)–Great!

mieszko.nowicki(verified owner)–yoo

nikhil(verified owner)–GOOD

nikhil(verified owner)–GOOD

anilkumar.katharotita(verified owner)–Good !!!!

ankush.chaudhary(verified owner)–Good

hello.world(verified owner)–nice

vvp.vvpiet(verified owner)–good

vvp.vvpiet(verified owner)–good

blade.runner(verified owner)–good experince

sameer.kumthekar(verified owner)–best

vankani.arjun(verified owner)–Nice project !!

jyoti.khandelwal(verified owner)–good

anshuman.vishwakarma(verified owner)–Good

SHENXIAOXIAO(verified owner)–well done

namit.gupta(verified owner)–Thanks

sandeep.reddy(verified owner)–Ch

sathvik.hr(verified owner)–Nice

muhammad.luki(verified owner)–ok

mehrab.hosain(verified owner)–That good one

Manikanta(verified owner)–nice

akshad.singh(verified owner)–good

aditya.anugrah(verified owner)–nice brooo

aditya.anugrah(verified owner)–nicee

hanaa.hamouda(verified owner)–i like this website

deeraj.kumar(verified owner)–good

rishu.singh(verified owner)–Good

rishu.singh(verified owner)–Good

dheeraj.dang(verified owner)–jnfam ma

tom.thomas(verified owner)–tks

rasheed.shake(verified owner)–good

brown.charlie(verified owner)–。

arpita.kuntageri(verified owner)–good

Pranayasahu(verified owner)–very good service

chou_aib(verified owner)–Great