A list,
Digital watermarking based on the combination of discrete wavelet transform (DWT) and SVD
Ii. Source code
clear all;
close all;
clc;
key=35; % Number of Arnold replacements as the key Orignalmark=double(imread('suda64.bmp')); % read64*64[wrow,wcol]=size(Orignalmark);if wrow~=wcol
error('wrow~=wcol error'); End % - test key key is beyond the scope of -- -- -- -- -- -- -- -- -- n = check_arnold (wrow);if (key+1) >n
error('arnold key error'); end Arnoldw=arnold(Orignalmark,wrow,key); % Arnold conversion of watermark image figure(1);
imshow(Orignalmark);
title('Original watermark Image');
figure(2);
imshow(Arnoldw);
title('Scrambled watermark image');
Orignalpicture=double(imread('Lena.jpg'));
figure(3);
imshow(uint8(Orignalpicture));
title('Original image'); % DWT transform [ca1, ch1, cv1, which cd1] = dwt2 (Orignalpicture,'db1'); [ca1row,ca1col]=size(ca1); blocksize=ca1row/wrow; 0 0 0 0 0 0 0 0 01,wrow*wcol); % Convert the scrambled watermark to a one-dimensional wlength=wrow*wcol; % Watermark length a=0.25; % Quantization step %------------------------------------for k=1:wrow
for p=1:wcol
x=(k- 1)*blocksize+1;
y=(p- 1)*blocksize+1;
L=zeros(4.4);
L=ca1(x:x+blocksize- 1,y:y+blocksize- 1);
[U,S,V]=svd(ca1(x:x+blocksize- 1,y:y+blocksize- 1));
cc=floor(S(1.1)/a);
if(water_vector(k*p)==1) % embed an odd multipleif(mod(cc,2) = =0)
cc=cc+1;
end
S(1.1)=a*cc;
end
if(water_vector(k*p)==0)% is embedded in even multiplesif(mod(cc,2) = =1)
cc=cc+1;
end
S(1.1)=a*cc;
end
L=U*S*V';
ca1(x:x+blocksize- 1,y:y+blocksize- 1)=L;
end
end
markedimg=idwt2(ca1,ch1,cv1,cd1,'db1');
figure(4);
imshow(uint8(markedimg));
title('Watermarked image');
extractedmark=extract(markedimg,Orignalmark);
watermark=arnold(extractedmark,wrow,n-key);
figure(5);
imshow(watermark);
title('Extracted watermark image'); psnrvalue=psnr(Orignalmark,watermark) Nc=nc(Orignalmark,watermark) % against -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- f = markedimg; attack=0;
switch attack
case 0,
attackf=f;
att='Not attacked';
case 1, % %1.JPEG compression imwrite (f,'attackf.jpg'.'jpg'.'quality'.90);
attackf=imread('attackf.jpg');
attackf=double(attackf)/255;
att='JPEG compression';
case 2,
% %2.Gaussian low-pass filtering h=fspecial('gaussian'.3.1);
attackf=filter2(h,f);
att='Gaussian low-pass filtering';
case 3, % %3.Histogram equalization attackf=histeq(f); att='Histogram equalization';
case 4, % %4.Attackf =imadjust(f,[],[]0.4.1]);
att='Image brightening';
case 5, % %5.Attackf =imadjust(f,[],[]0.0.85]);
att='Image goes dark';
case 6, % %6.Increase contrast attackf=imadjust(f,[0.3.0.6], []); att='Increase contrast';
case 7, % %7.Attackf =imadjust(f,[],[]0.2.0.8]);
att='Reduce contrast';
case 8, % %8.Attackf =imnoise(f,'gaussian'.0.0.01);
att='Add Gaussian noise';
case 9, % %9.Attackf =imnoise(f,'salt & pepper'.0.05);
att='Salt and pepper noise';
case 10, % %10.Add multiplicative noise attackf=imnoise(f,'speckle'.0.08);
att='Add multiplicative noise';
case 11% % %11.Attackf = medFilt2 (f,[5 5]);
att='Median filtering';
case 12% % %12.Shear f (200:456.200:456, :) =0;
attackf=f;
att='cut';
case 13% % %13.Rotating attackf = imrotate (f,15.'bilinear'.'crop');
att='rotation';
end;
Copy the code
3. Operation results
Fourth, note
Version: 2014 a
Complete code or ghostwrite plus 1564658423