• 大小: 1KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-10
  • 语言: 其他
  • 标签:

资源简介

上传一个SVD水印算法,算法中包括嵌入、提取算法。算法的鲁棒性很强

资源截图

代码片段和文件信息

clear all;
start_time=cputime;
file_name=‘lenagray.bmp‘;
cover_object=double(imread(file_name));
Mc=size(cover_object1);
Nc=size(cover_object2);
file_name=‘wp.bmp‘;
message=double(imread(file_name));
Mm=size(message1);
Nm=size(message2);
blocksize=8;
blocksize1=2;
m=(Mc*Nc)/(blocksize^2);
M=(4*Mm*Nm)/(blocksize1^2);
x=1;
y=1;
j=1;
for(kk=1:m)
    s=svd(cover_object(y:y+blocksize-1x:x+blocksize-1));
    A0(1j:(j+3))=s(1:4:)‘;
    j=j+4;
    if(x+blocksize)>=Nc
        x=1;y=y+blocksize;
    else
        x=x+blocksize;
    end
    
end
A=A0(:1:4*Mm*Nm);
q=reshape(A2*Mm2*Nm);
x=1;
y=1;
j=1;
i=1;
for(kk=1:M)
   s=svd(q(y:y+blocksize1-1x:x+blocksize1-1));
    A1(ij)=s(11);
    if(x+blocksize1)>=2*Nm
        x=1;
        y=y+blocksize1;
        i=i+1;
        j=1;
    else
        x=x+blocksize1;
        j=j+1;
    end
end
[usv]=svd(A1);
%a=input(‘message‘)
a=0.4;
[u1s1v1]=svd(s+a*message);
save s s;
save u1 u1;
save v1 v1;
A=u*s1*v‘;
i=1;
j=1;
x=1;
y=1;
for(kk=1:M)
    [usv]=svd(q(y:y+blocksize1-1x:x+blocksize1-1));
     s(11)=A(ij);
     midA(y:y+blocksize1-1x:x+blocksize1-1)=u*s*v‘;
    if(x+blocksize1)>=2*Nm
        x=1;y=y+blocksize1;i=i+1;j=1;
    else
        x=x+blocksize1;j=j+1;
    end
end
A=reshape(midA14*Mm*Nm);
A0(:1:4*Mm*Nm)=A;
watermarked_image=cover_object;
x=1;
y=1;
j=1;
for(kk=1:m)
     [usv]=svd(cover_object(y:y+blocksize-1x:x+blocksize-1));
     s(1:41:4)=diag(A0(1j:j+3));
     watermarked_image(y:y+blocksize-1x:x+blocksize-1)=u*s*v‘;
     j=j+4;
    if(x+blocksize)>=Nc
        x=1;y=y+blocksize;
    else
        x=x+blocksize;
    end
    
end
outme=uint8(watermarked_image);
imwrite(outme‘svd_watermarked.bmp‘‘bmp‘);
elapsed_time=cputime-start_time
xsz=255*255*Nc*Mc/sum(sum((cover_object-watermarked_image).^2));
psnr=10*log10(xsz)
subplot(131)imshow(imread(‘lenagray.bmp‘))
title(‘原图‘)
subplot(132)imshow(uint8(message))
title(‘水印‘)
subplot(133)imshow(outme[])
title(‘含水印图‘)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1510  2007-04-07 21:20  svdout00.m

     文件       2067  2007-04-01 19:45  svd00.m

----------- ---------  ---------- -----  ----

                 3577                    2


评论

共有 条评论

相关资源