www.pudn.com > hide1.rar > hide.m, change:2004-02-27,size:1145b


function hide() 
B=imread('E:\chan\mat\b.bmp','bmp'); 
imshow(B);pause;close; 
[Bx,By,Bz]=size(B); 
C=imread('E:\chan\mat\cc.bmp','bmp'); 
imshow(C);pause;close; 
[Cx,Cy,Cz]=size(C); 
for i=1:Cx    %%以下12行检测 
    for j=1:Cy 
        for k=1:Cz 
            b=bitand(C(i,j,k),240); 
            E(i,j,k)=b; 
            cc=bitor(bitshift(bitand(C(i,j,k),240),-4),240); 
            F(i,j,k)=cc; 
        end 
    end 
end 
imshow(E);pause;close; 
imshow(F);pause;close; 
for i=1:Bx               %%隐藏开始 
    for j=1:By 
        for k=1:Bz 
            if (i<=Cx)&(j<=Cy)&(k<=Cz) 
               b=bitand(B(i,j,k),240); 
               c=bitshift(bitand(C(i,j,k),240),-4); 
               D(i,j,k)=bitor(b,c); 
            else 
               D(i,j,k)=B(i,j,k); 
           end 
        end 
    end 
end 
imshow(D);pause;close; 
imwrite(D,'E:\chan\mat\d.bmp') 
for i=1:Bx               %%提取 
    for j=1:By 
        for k=1:Bz 
            if (i<=Cx)&(j<=Cy)&(k<=Cz) 
               U(i,j,k)=bitshift((bitand(D(i,j,k),15)),4); 
           end 
        end 
    end 
end 
size(U) 
imshow(U);pause;close; 
imwrite(U,'E:\chan\mat\e.bmp')