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

1 view (last 30 days)
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?

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.

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.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!