预览加载中,请您耐心等待几秒...
1/5
2/5
3/5
4/5
5/5

在线预览结束,喜欢就下载吧,查找使用更方便

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

%改进算法,及性能分析 clear clc a=imread('rice.png'); a=double(a); [m1,n1]=size(a); b=zeros(m1,n1*8); fori=1:1:m1 forj=1:1:n1 fort=0:1:7 ifmod(floor(a(i,j)/2^t),2)==1 b(i,j*8-t)=1; else b(i,j*8-t)=0; end end end end q=4; b1=b; x1(1)=0.3333; forn=1:n1*8+100 x1(n+1)=q*x1(n)*(1-x1(n)); end n=101:1:n1*8+100; y1(n-100)=x1(n); [z1,l1]=sort(y1,2); fori=1:1:n1*8 b1(:,i)=b(:,l1(i)); end x2(1)=0.4444; form=1:m1+100 x2(m+1)=q*x2(m)*(1-x2(m)); end m=101:1:m1+100; y2(m-100)=x2(m); [z2,l2]=sort(y2,2); fori=1:1:m1 b(i,:)=b1(l2(i),:); end fori=1:1:m1 forj=1:1:n1 a(i,j)=b(i,j*8); fort=1:1:7 a(i,j)=a(i,j)+2^t*b(i,j*8-t); end end end a=uint8(a); figure,imshow(a); figure,imhist(a); a=double(a); g(1)=0.5555;%混沌序列的初始值 fori=1:1:256*256%改进算法 t(i)=mod(floor(g(i)*10^3),256);% ifg(i)<0.5 g(i+1)=4*q*g(i)*(0.5-g(i)); else g(i+1)=1-4*q*(g(i)-0.5)*(1-g(i)); end end t=reshape(t,256,256); t=t'; fori=1:1:256 forj=1:1:256 s1(i,j)=mod((a(i,j)+t(i,j)*abs(i-j)),256); end end s1=uint8(s1); figure,imshow(s1);%显示加密图像 figure,imhist(s1);%加密图像灰度值 s1=double(s1);%解密是加密的反 fori=1:1:256 forj=1:1:256 a(i,j)=mod((s1(i,j)-t(i,j)*abs(i-j)),256); end end fori=1:1:m1 forj=1:1:n1 fort=0:1:7 ifmod(floor(a(i,j)/2^t),2)==1 b(i,j*8-t)=1; else b(i,j*8-t)=0; end end end end fori=1:1:m1 b1(l2(i),:)=b(i,:); end fori=1:1:n1*8 b(:,l1(i))=b1(:,i); end fori=1:1:m1 forj=1:1:n1 a(i,j)=b(i,j*8); fort=1:1:7 a(i,j)=a(i,j)+2^t*b(i,j*8-t); end end end a=uint8(a); figure,imshow(a); %求灰度值差异 clear clc a=imread('rice.png'); [m1,n1]=size(a); a=double(a); gn=zeros(m1-2,n1-2);%定义(m1-2)*(n1-2)的矩阵 fori=2:1:255%计算每个与其他四个相邻像素灰度值的差异 forj=2:1:255 am=(a(i,j)-a(i-1,j))^2; am=am+(a(i,j)-a(i+1,j))^2; am=am+(a(i,j)-a(i,j-1))^2; am=am+(a(i,j)-a(i,j+1))^2; gn(i-1,j-1)=am/4; end end am=0; fori=1:1:254 forj=1:1:254 am=gn(i,j)+am; end end an=am/((m1-2)*(n1-2)); %求各图像的相关性 k1=unidrnd(255,1,20);%生成1*20的矩阵,由[1,255]之间的数组成 k2=randint(1,50,[1,255]);%生成1*50的矩阵,由[1,255]之间的数组成 fori=1:50 forj=1:20 x(i,j)=s1(k2(i),k1(j)); y(i,j)=s1(k2(i),k1(j)+1);%%水平相关性 %y(i,j)=s1(k2(i)+1,k1(j));%