基于位置和灰度变换的混沌图像置乱算法 matlab具体算法 相关pdf百度下就有

如题所述

参考《基于位置和灰度变换的混沌图像置乱算法》实现的,有问题再讨论

lena = imread('C:\lena.jpg');
imtool(lena);
lena_1 = lena(:);
[M,N]=size(lena);
u=4;
visited(M*N,1)=0;
visited(1)=1;
index=1;
temp=0;
x=0.1415926;
count=1;
while count<M*N
temp=lena_1(index);
t=round(x*1E7);
x=u*x*(1-x);
K=mod(t,M*N)+1;
if visited(K)
continue;
end
visited(K)=1;
%lena_1(index)=lena_1(K)*x;
lena_1(index)=lena_1(K);
index=K;
count=count+1;
end
lena_1(index)=temp;
lena_2=reshape(lena_1,M,N);
imtool(lena_2);

visited(1)=0;
index=1;
x=0.1415926;
count=1;
temp_1=lena_1(1);
while count<M*N
t=round(x*1E7);
x=u*x*(1-x);
K=mod(t,M*N)+1;
if ~visited(K)
continue;
end
visited(K)=0;
temp_2=lena_1(K);
%lena_1(K)=temp_1/x;
lena_1(K)=temp_1;
temp_1=temp_2;
index=K;
count=count+1;
end
lena_1(1)=temp_1;
lena_3=reshape(lena_1,M,N);
imtool(lena_3);
温馨提示:答案为网友推荐,仅供参考