www.pudn.com > Arnold.rar > lsb.m, change:2014-07-12,size:311b


function WII1=lsb(WI,s) 
%WI为嵌入水印后的图像,s为攻击的位置 
%(1)产生256*256个伪随机数 
%b=randsrc(256*256,1,[0 1;0.5 0.5]); 
b=wei(); 
%(2)嵌入WI中的第s位 
WII1=WI; 
k=1; 
for i=1:256 
    for j=1:256 
        WII1(i,j)=bitset(WII1(i,j),s,b(k)); 
        k=k+1; 
    end 
end 
imwrite(WII1,'WII1.bmp');