In: Computer Science
I need matlab code for digital watermarking using SVD. Please explain each step
clc //uses to run the program and store the value
close all // uses to run the program and store the value
alpha= 0.75 //declare a variable alpha this is a embedding strength it is a strength which gives watermark a strength
I= imread ("cameraman.tif"); // this is usually available in MALTAB lab
figure(1) ; imshow(I); title ('The image');
[LL1, HL1, LH1, HH1] = dwt2 (I,'hear'); // low frequency in vertical and horizontal component
[LL2, HL2, LH2, HH2] = dwt2 (LL1,'hear');
p= size(LL2); // store the size LL2 in p
[Uy,Sy,Vy]= svd(LL2); // applying svd on LL2
q= size(Sy);
I_w = imread('watermark.jpg'); // define watermark
I_w = I_w (i, i, 1);
I1_w= imahow(I1_w); title ('I_w, p'); // figure(2)
[Uw, Sw, Vw] = svd (double(I1_w)); // applying svd on watermark
Smark = Sy+ alpha*Sw; // embed watermark
LL2_i = Uy*Smark*Vy; // rebuild the sub-bands using SVD
LL1_1 = idwt2 (LL2_1,HL2, LH2, HH2,'hear'); // applying inverse dwt to get watermark image
I_1 = idwt2 (LL1_1,HL1,LH1,HH1,'hear');
figure(3); imashow (uint6(I_1)); title ('Watermark image');
[LL1_wmv. HL1_wmv, LH1_wmv,HH1_wmv] = dwt2(I_1,'hear'); // Extraction
[LL2_wmv. HL2_wmv, LH2_wmv,HH2_wmv] = dwt2(LL1_wmv,'hear');
[Uy_wmv, Sy_wmv, Vy_wmv] = svd (LL2_wmv);
swrec = (Sy_wmv - Sy)/alpha;
WMy = Uw*Swrec*Vw' ;