YayBlogger.com
BLOGGER TEMPLATES

Huwebes, Enero 29, 2015

DWT Based Watermarking Algorithm using Haar Wavelet



DWT Based Watermarking Algorithm using
Haar Wavelet

This article is about the implementation of the DWT based watermarking algorithm using haar wavelet based on the study of “DWT Based Watermarking Algorithm using Haar Wavelet” by Anuradha , Rudresh Pratap Singh.  In this paper, a wavelet-based watermarking approach is proposed in which a visually recognizable watermark is added to the wavelet coefficients of an image. This watermark can be a binary, gray-scale. The extracted watermark is visually recognizable to claim ownership. The embedded watermark is hard to detect by human visual perceptivity. In the proposed method pixels of watermark are embedded in wavelet Coefficients corresponding to the points located in a neighborhood with maximum entropy. Embedding the watermark in such pixels makes it possible to use maximum amount of watermark due to human eye insensitivity to areas with high entropy.

Methodology:

Watermarking

In case of two-dimensional image, after a DWT transform, the image is divided into four corners, upper left corner of the original image, lower left corner of the vertical details, upper right corner of the horizontal details, lower right corner of the component of the original image detail (high frequency). You can then continue to the low frequency components of the same upper left corner of the 2nd, 3rd inferior wavelet transform.  After wavelet decomposition process, the low frequency component is equivalent or similar to the original image, so the band has added to the watermark robustness. So that the low frequency components of the human eye to adding a watermark are much higher than the sensitivity of high frequency components by adding information. On the other hand, by the knowledge of image compression, we know that the adding of watermark in the high frequency image can be easier to lose with lossy compression in the operation. On the basis of such considerations, the algorithm uses a different color image multiplied by the weighting coefficients of different ways to solve the visual distortion, and by embedding the watermark, wavelet coefficients of many ways, enhance the robustness of the watermark .

Here is the code in watermarking the image:

clc
close all

%host

rgbimage=imread('host.jpg');
figure;imshow(rgbimage);title('original color image');
[h_LL,h_LH,h_HL,h_HH]=dwt2(rgbimage,'haar');
dec2d = [...
        h_LL,     h_LH;     ...
        h_HL,     h_HH      ...
        ];
figure,imshow(uint8(dec2d));title('DWT2 of original color image');

%watermark

rgbimage=imread('watermark.jpg');
figure;imshow(rgbimage);title('Watermark image');
[w_LL,w_LH,w_HL,w_HH]=dwt2(rgbimage,'haar');
dec2d = [...
        w_LL,     w_LH;     ...
        w_HL,     w_HH      ...
        ];
figure,imshow(uint8(dec2d));title('DWT2 of Watermark image');

%watermarking

newhost_LL = h_LL + (0.01*w_LL);

%output

rgb2=idwt2(newhost_LL,h_LH,h_HL,h_HH,'haar');
figure;imshow(uint8(rgb2));title('Watermarked image');
imwrite(uint8(rgb2),'watermarked.jpg');

The method discussed above  was applied in various test images.  An example of embedding result is shown in figure 1, in which a colored bell pepper image is used as test image and the colored group of fruits as the watermark.
 (a)
 
(b)
Figure 1. (a) Original Image (b) Watermark Image

The resulting image of the method discussed above was shown in figure 2.



Figure 2. Watermarked Image

Watermark Extraction

The extraction algorithm process is the inverse of the embedding process. It is assumed that the watermark as well as the see value is available at the receiver end to the authorized users.
The operation of channel separation is applied on the watermarked color image to generate its sub images, and then 2-level discrete wavelet transform is applied on the sub images to generate the approximate coefficients and detail coefficients. After that the similar operation is applied on the original image, and generate it’s both coefficients, first approximate coefficients and second detail coefficients. With the both coefficient approximate coefficients and the detail coefficients of watermarked image and original image, we could extract watermark data through watermark extracting algorithm, respectively. For this purpose the following formulae is use- W(i) = (yw(i) + yo(i)) / α.
After this execution the Inverse 2-level discrete wavelet transform is applied on the watermark data to generate watermark images extracted.

Here is the code in extracting the image:

clc
close all

%host

rgbimage=imread('watermarked.jpg');
figure;imshow(rgbimage);title('original color image');
[h_LL,h_LH,h_HL,h_HH]=dwt2(rgbimage,'haar');
dec2d = [...
        h_LL,     h_LH;     ...
        h_HL,     h_HH      ...
        ];
figure,imshow(uint8(dec2d));title('DWT2 of original color image');


%watermark

rgbimage=imread('watermark.jpg');
figure;imshow(rgbimage);title('Watermark image');
[w_LL,w_LH,w_HL,w_HH]=dwt2(rgbimage,'haar');
dec2d = [...
        w_LL,     w_LH;     ...
        w_HL,     w_HH      ...
        ];
figure,imshow(uint8(dec2d));title('DWT2 of Watermark image');

%watermarked

rgbimage=imread('watermarked.jpg');
figure;imshow(rgbimage);title('Watermarked image');
[wm_LL,wm_LH,wm_HL,wm_HH]=dwt2(rgbimage,'haar');
dec2d = [...
        wm_LL,     wm_LH;     ...
        wm_HL,     wm_HH      ...
        ];
figure,imshow(uint8(dec2d));title('DWT2 of Watermarked image');

%watermarking

newwatermark_LL= (wm_LL-h_LL)/0.01;

%output

rgb2=idwt2(newwatermark_LL,w_LH,w_HL,w_HH,'haar');
figure;imshow(uint8(rgb2));title('Extracted watermark');
imwrite(uint8(rgb2),'EWatermark.jpg');


% M=512;
% N=512;
% X=imresize(uint8('Watermark.jpg'), [M N]);
% Y=imresize(uint8('EWatermark.jpg'), [M N]);
% cc = corr2(X,Y);
% disp(cc);

The generated watermarked image by the embedding code was used in order to extract the watermark image. The method discussed above was applied in various test images. An example of extracting result was shown in figure 3.


 






(c)                                                                           











(d)


Figure 3. (c) Watermarked Image (d) Extracted Image









Below is the complete file for the source code and article:
https://www.dropbox.com/home/Watermarking

Walang komento:

Mag-post ng isang Komento