MATLAB: I don’t know this watermarking code~ please explain code~

dwtwatermark

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?

Best Answer

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.