⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hide5.m

📁 关于图像隐藏的几个例程。属于matlab图像处理的内容
💻 M
字号:
function hide()
m=input('please input the lock password:');
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);
%%密码分解
m1=fix(m/100);     
m2=m-(fix(m/100))*100;
%%检测
E=bitand(C,240);         
F=bitor(bitshift(bitand(C,240),-4),240);
imshow(E);pause;close;
imshow(F);pause;close;
%%构建CC
C1=zeros(Cx,m2,Bz);
C=[C1,C];
C2=zeros(m1,m2+Cy,Bz);
C=[C2;C];
CC1=zeros(Bx-Cx-m1,Cy+m2,Bz);
C=[C;CC1];
CC2=zeros(Bx,By-Cy-m2,Bz);
C=[C,CC2];   
C=uint8(C);
%%隐藏
b=B;b(((m1+1):(m1+Cx)),((m2+1):(m2+Cy)),1:Bz)=bitand(B(((m1+1):(m1+Cx)),((m2+1):(m2+Cy)),1:Bz),240);
c=bitshift(bitand(C,240),-4);
D=bitor(b,c);
imshow(D);pause;close;
imwrite(D,'E:\chan\mat\d.bmp')
%%输解码
D=imread('E:\chan\mat\d.bmp','bmp');
n=input('please input the unlock password:');
for i=1:10000
    if n==m
        break
    else
        sprintf('put the wrong unlock password!!!')
        n=input('please input the correct unlock password:');
    end
end
%%提取
n1=fix(n/100);  
n2=n-(fix(n/100))*100;
U=bitshift((bitand(D,15)),4);
U=U((n1+1):n1+Cx,(n2+1):n2+Cy,1:Cz);
imwrite(U,'E:\chan\mat\e.bmp')
imshow(U);pause;close;
sprintf('ok')

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -