MATLAB Answers

I don't know this watermarking code~ please explain code~

5 views (last 30 days)
DoSeok Lee
DoSeok Lee on 29 Jun 2015
Edited: Walter Roberson on 29 Jun 2015
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');
%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.30;
%extracted watermark image
rgb2=idwt2(newwatermark_LL,w_LH,w_HL,w_HH,'haar');
figure;imshow(uint8(rgb2));title('Extracted watermark');
imwrite(uint8(rgb2),'EWatermark.jpg');
-----------------------------------------------------------------
someone sent this watermarking sourece to me
but I don't understand this code~
I wonder these part matlab source~
%host rgbimage=imread('host.jpg');%<-- example I insert image cameraman.tif (my file name)256x256
%watermark rgbimage=imread('watermark.jpg'); %<-- exmaple I insert image rice.tif (my file name)256x256
%watermarked rgbimage=imread('watermarked.jpg'); <-- I don't know what kind of image insert?

  0 Comments

Sign in to comment.

Accepted Answer

Thorsten
Thorsten on 29 Jun 2015
You first create the Watermarked.jpg using embedd.m and then you can can extract the image using extract.m, as far as I can see.

  0 Comments

Sign in to comment.

More Answers (1)

B.k Sumedha
B.k Sumedha on 29 Jun 2015
I apologize for not replying to your previous query.
Its just that after this :
figure,imshow(uint8(dec2d));title('DWT2 of Watermarked image');
write this line.
imwrite(uint8(rgb2),'Watermarked.jpg');
This is where you will be saving the watermarked image. After this u will be using it to extract the image.

  0 Comments

Sign in to comment.

Sign in to answer this question.