How to achieved Step of the watermarking?

1 view (last 30 days)
Foday  Jorh
Foday Jorh on 17 Jan 2019
Hello Team,
I need help in acheiving step number number. Below are the steps. I'm referencing from this article: "Robust Digital Image Watermarking in High Frequency Band Using Median Filter Function Based on DWT-SVD"
  1. Let A(i,j) represents the host image of size 128×128 and W(i,j) represents the watermark image of size 128×128. 1. Apply median filter function on the host image A(i,j) using block size 2×2 and obtain the reference image B(i,j)
  2. Perform 1-level discrete wavelet transform on the reference image B(i,j) and the watermark image W(i,j) into four sub-bands
  3. Perform inverse discrete wavelet transform on high frequency sub-band (HH) of both images.
  4. Decompose the high frequency sub-band of both reference image and watermark image using singular transform
  5. Modify the singular value of reference image with the singular value of watermark image
  6. Obtain the modified High frequency sub band of reference image
  7. Apply discrete wavelet transform on HH sub-band obtain new HH*
  8. Perform inverse discrete wavelet transform using LLb,LHb, HLb, and HH* to obtain the watermarked image.
All the above step i did accept the step number 3... Kindly help!!
clc;
close all;
clear ALL;
%% the embedding strength
alpha = 0.2;
%% ALL image are set to 128 by 128 pixel
% FacialIMGpath = 'C:\Users\foday\Documents\Thesis\originalImage\1-11a.jpg';
addpath(genpath(pwd));
FacialIMGpath = 'Lena1.jpg';
I = imread(FacialIMGpath);
if ndims(I) == 3; I = rgb2gray(I); end
%% Applying median filter to the original image
Fimg = medfilt2(uint8(I),[2 2]);
figure(1);
subplot(1,2,1), imshow(uint8(I),[]); title('original image');
subplot(1,2,2), imshow(uint8(Fimg),[]); title('filtered image');
%figure(1), imshow(I), title('Image in which we insert Watermark');
[host_LL, host_LH, host_HL, host_HH]= dwt2(Fimg, 'haar');
p = size(host_HH);
%% define watermarking image
addpath(genpath(pwd));
ExtMunpath ='baboon.jpg';
ExtMun = imread(ExtMunpath);
ExtMun = ExtMun(:,:,1);
% ExtMun = imresize(ExtMun, p);
% Decomposing the watermark image
[watermark_LL,watermark_LH, watermark_HL, watermark_HH]=dwt2(ExtMun, 'haar');
%% Perform inverse DWT on the host_HH and watermark_HH
% hostHH_HH = idwt2(host_HH,'haar');
% watermarkHH_HH= idwt2(watermark_HH, 'haar');
%% Decomposing host_HH using SVD
[U_hostHH, S_hostHH, V_hostHH]= svd(host_HH);
q= size(S_hostHH);
%% Decomposing watermark_HH using SVD
[U_watermarkHH,S_watermarkHH,V_watermarkHH]=svd(watermark_HH);
S_watermarkHH =imresize(S_watermarkHH,q);
%% Modify the singular value of reference image with the singular value of watermark image
S_mark = S_hostHH+alpha*S_watermarkHH;
%rebuild the sub-band using SVD
host_HH1 = U_hostHH*S_mark*V_hostHH';
%% applying DWT host_HH
host_HH2 = dwt2(host_HH1,'haar');
%Perform inverse discrete wavelet transform using
%host_LL,host_LH, host_HL, and host_HH2 to obtain the watermarked image.
host_HH2 =imresize(host_HH2,p);
Watermarked = idwt2(host_LL, host_LH,host_HL,host_HH2, 'haar');
figure(2);
subplot (1,3,1), imshow(uint8(Fimg),[]); title('Filtered image');
subplot (1,3,2), imshow(uint8(ExtMun),[]); title('Secret image');
subplot (1,3,3), imshow(uint8(Watermarked)); title('Watermarked image');

Answers (0)

Community Treasure Hunt

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

Start Hunting!