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

조회 수: 2 (최근 30일)
DoSeok Lee
DoSeok Lee 2015년 6월 29일
편집: Walter Roberson 2015년 6월 29일
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?

채택된 답변

Thorsten
Thorsten 2015년 6월 29일
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.

추가 답변 (1개)

B.k Sumedha
B.k Sumedha 2015년 6월 29일
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!

Translated by