?? yihuosalt.m
字號(hào):
clear all;close all;
Ximage=double(imread('e:\work\F1.BMP'));
% Ximage=double(imread('E:\work\lena.jpg'));%待隱藏圖像
% Zimage=double(imread('E:\work\House.jpg'));
n=1;
% times=2;
% key0=0.1;
x=2;
kk=0.1;
k0=4;
M=size(Ximage,1);
N=size(Ximage,2);
figure(1)
imshow(Ximage,[]);
% Z=Zimage;
tt=1
for(j=1:M*N*n)
kk=k0*kk*(1-kk);
% kk=1-x*kk*kk;
key1(j)=kk;
end
key2=key1;
key2=round(key2*256);
% for(j=1:M*N*n)
% key2(j)=key2(j)*255;
% % key2(j)=abs(key2(j)*255);
% end
% for(i=1:M)
% for(j=1:N)
% XX(tt)=Ximage(i,j);
% % key2(tt)=Zimage(i,j);
% tt=tt+1;
% end
% end
XX=reshape(Ximage,1,M*N);
% Z=bitand(XX,key2);
for(j=1:M*N*n)
Z(j)=double(bitxor(XX(j),key2(j)));
% subplots(149);
% imshow(Z)
end
ZZ=reshape(Z,M,N);
figure(2)
Imshow(ZZ,[]);
ZZ1=uint8(ZZ);
% jgimage=ZZ;
jgimage1=imnoise(ZZ1,'salt & pepper',0.02);
jgimage=double(jgimage1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 恢 復(fù) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% for i=1:M*N*n
% if Z(i)==1
% if key2(i)==1
% XX(i)=0;
% elseif key2(i)==0
% XX(i)=1
% end
% end
%
%
% if Z(i)==0
% if key2(i)==0
% XX(i)=0;
% elseif key2(i)==1
% XX(i)=0;
% end
% end
% end
n=1;
kk=0.1;
k0=4;
for(j=1:M*N*n)
kk=k0*kk*(1-kk);
% kk=1-x*kk*kk;
key1(j)=kk;
end
key2=key1;
key2=round(key2*256);
ZZZ=reshape(jgimage,1,M*N);
for(j=1:M*N*n)
Zimage(j)=double(bitxor(ZZZ(j),key2(j)));
end
Himage=reshape(Zimage,M,N);
% Q=imrotate(QQ,270,'bilinear');
figure(3)
Imshow(Himage,[]);
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -