Plz help in dwt-svd wwtaermarking-its imp
Show older comments
Plz help me in my dessertation work.
I have written this dwt-svd code in matlab.it is running bt giving a very low psnr value.plz help me for wat the errors are.... also my mail id is engr.madhuri@gmail.com
%-------------------------
%Embedding
%-------------------------
clear;
clc
img= imread('lena_gray_256.bmp');
img=imresize(img,[256 256]);
cover_img=img;
img=double(img);
[M,N]=size(img);
%[Uimg,Simg,Vimg]=svd(img);
%Vimg_temp=Vimg;
% read watermark
img_wat= imread('baboon.bmp');
img_wat=imresize(img_wat,[256 256]);
img_wat=double(img_wat);
[x y]=size(img_wat);
[ca1,ch1,cv1,cd1]=dwt2(img,'haar');
[u1 s1 v1]=svd(ca1); %svd each subband (DWT 1 level)
[u2 s2 v2]=svd(ch1); %from cover image
[u3 s3 v3]=svd(cv1);
[u4 s4 v4]=svd(cd1);
[ca2,ch2,cv2,cd2]=dwt2(img_wat,'haar');
[u11 s11 v11]=svd(ca2); %svd each subband (DWT 1 level)
[u22 s22 v22]=svd(ch2); %from cover image
[u33 s33 v33]=svd(cv2);
[u44 s44 v44]=svd(cd2);
%[wu ws wv]=svd(img_wat); %svd visual watermark
ws1 = s1 + (s11 * 0.05); %Modify the singular values of the cover
ws2 = s2 + (s22 * 0.05); %image in each subband with singular
ws3 = s3 + (s33 * 0.05); %values of the visual watermark
ws4 = s4 + (s44 * 0.05);
%to obtain the 4 sets of modified DWT coefficients :
wca1=(u1*ws1*v1);
wch1=(u2*ws2*v2);
wcv1=(u3*ws3*v3);
wcd1=(u4*ws4*v4);
% perform IDWT CAA1 = idwt2(cA22,cH2,cV2,cD2,'haar',[RcA1,CcA1]);
Wimg= idwt2(wca1,wch1,wcv1,wcd1,'haar',[M,N]);
Wimg=uint8(Wimg);
figure(1)
imshow(uint8(img));
title('The Original Image')
figure(2)
imshow(uint8(img_wat));
title('The Watermark ')
figure(3)
imshow(uint8(Wimg));
title('The Watermarked Image')
% display psnr of watermarked image
psnr=psnr(cover_img,Wimg,M,N),
PSNR=10*(log10(psnr))
%MSE=mse(img,Wimg,M,N);
%MSE=10*(log10(MSE))
%mse=mean(squeeze(sum(sum((double(img)-double(Wimg)).^2))/(M*N)));
%PSNR=10*log10(255^2./mse);
msg=sprintf('\n\n-------------------------\nWatermark by SVD PSNR=%fdB\n-----------------------------\n\n', PSNR);
disp(msg);
Answers (0)
Categories
Find more on Watermarking in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!