水印 截屏攻击 matlab,可以运行的水印MATLAB程序(嵌入,提取,攻击测试等).doc

可以运行的水印MATLAB程序(嵌入,提取,攻击测试等)

input=imread('yuanshituxiang.bmp'); subplot(2,2,1); imshow(input);title('原始图像');water=imread('water.bmp'); subplot(2,2,2);imshow(water); title('水印');input=double(input); water=double(water); inputr=input(:,:,1);waterr=water(:,:,1); inputg=input(:,:,2);waterg=water(:,:,2); inputb=double(input(:,:,3)); waterb=double(water(:,:,3)); r=0.06; [Cwr,Swr]=WAVEDEC2(waterr,2,'haar');[Cr,Sr]=WAVEDEC2(inputr,2,'haar');%水印的嵌入 Cr(1:size(Cwr,2)/16)=Cr(1:size(Cwr,2)/16)+r*Cwr(1:size(Cwr,2)/16);k=0; while k<=size(Cr,2)/size(Cwr,2)-1 Cr(1+size(Cr,2)/4+k*size(Cwr,2)/4:size(Cr,2)/4+(k+1)*size(Cwr,2)/4)=Cr(1+size(Cr,2)/4+k*size(Cwr,2)/4:size(Cr,2)/4+(k+1)*size(Cwr,2)/4+r*Cwr(1+size(Cwr,2)/4:size(Cwr,2)/2)); Cr(1+size(Cr,2)/2+k*size(Cwr,2)/4:size(Cr,2)/2+(k+1)*size(Cwr,2)/4)=Cr(1+size(Cr,2)/2+k*size(Cwr,2)/4:size(Cr,2)/2+(k+1)*size(Cwr,2)/4+r*Cwr(1+size(Cwr,2)/2:3*size(Cwr,2)/4)); Cr(1+3*size(Cr,2)/4+k*size(Cwr,2)/4:3*size(Cr,2)/4+(k+1)*size(Cwr,2)/4)=Cr(1+3*size(Cr,2)/4+k*size(Cwr,2)/4:3*size(Cr,2)/4+(k+1)*size(Cwr,2)/4+r*Cwr(1+3*size(Cwr,2)/4:size(Cwr,2))); k=k+1;end; Cr(1:size(Cwr,2)/4)=Cr(1:size(Cwr,2)/4)+r*Cwr(1:size(Cwr,2)/4); g=0.03; [Cwg,Swg]=WAVEDEC2(waterg,2,'haar'); [Cg,Sg]=WAVEDEC2(inputg,2,'haar'); %水印的嵌入 Cg(1:size(Cwg,2)/16)=Cg(1:size(Cwg,2)/16)+g*Cwg(1:size(Cwg,2)/16);k=0; while k<=size(Cg,2)/size(Cwg,2)-1 Cg(1+size(Cg,2)/4+k*size(Cwg,2)/4:size(Cg,2)/4+(k+1)*size(Cwg,2)/4)=Cg(1+size(Cg,2)/4+ k*size(Cwg,2)/4:size(Cg,2)/4+(k+1)*size(Cwg,2)/4+ g*Cwg(1+size(Cwg,2)/4:size(Cwg,2)/2)); Cg(1+size(Cg,2)/2+k*size(Cwg,2)/4:size(Cg,2)/2+(k+1)*size(Cwg,2)/4)=Cg(1+size(Cg,2)/2+ k*size(Cwg,2)/4:size(Cg,2)/2+(k+1)*size(Cwg,2)/4+ g*Cwg(1+size(Cwg,2)/2:3*size(Cwg,2)/4)); Cg(1+3*size(Cg,2)/4+k*size(Cwg,2)/4:3*size(Cg,2)/4+(k+1)*size(Cwg,2)/4)=Cg(1+3*size(Cg,2)/4+k*size(Cwg,2)/4:3*size(Cg,2)/4+(k+1)*size(Cwg,2)/4+g*Cwg(1+3*size(Cwg,2)/4:size(Cwg,2))); k=k+1;end; Cg(1:size(Cwg,2)/4)=Cg(1:size(Cwg,2)/4)+g*Cwg(1:s

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值