1. Introduction
Part of the reference link of chaotic system image encryption and decryption theory: Design and application of image encryption algorithm based on chaotic system
2. Part of the source code
clear all;
t0 = clock;%测试程序运行时间
im=imread('elain.jpg');
im1=rgb2gray(im);%图像灰度化
im1=medfilt2(im1,[3 3]);%图像平滑处理
subplot(331);
figure(1);
imshow(im);%X为原始图像
title('原始图像');
figure(2);
imshow(im1);
title('灰度化处理');
im1=double(im1);
[ca1,ch1,cv1,cd1]=dwt2(im1,'bior3.7');%小波变换,获取图像的低频高频系数
figure(3);
subplot(231);
imshow(ca1,[]);
title('图像近似');
subplot(232);
imshow(ch1);
title('低频水平分量');
subplot(233);
imshow(cv1);
title('低频垂直分量');
subplot(234);
imshow(cd1),;
title('高频分量');
%以下为混沌加密算法
%以下为混沌加密算法
%以下为混沌加密算法
%以下为混沌加密算法
%以下为混沌加密算法
%以下为混沌加密算法
[M,N]=size(ca1);
e=hundungen555(M,N,0.1);
tt=0.1;
fca1=mod(tt*ca1+(1-tt)*e,256);
subplot(235);
imshow(fca1,[]);
title('加密');
im2=idwt2(ca1,ch1,cv1,cd1,'bior3.7');
figure(4);
imshow(uint8(im2),[]);
title('灰度图像小波重构');
im3=idwt2(fca1,ch1,cv1,cd1,'bior3.7');
figure(5);
imshow(uint8(im3),[]);
title('加密图像小波重构');
%以下为混沌解密算法
%以下为混沌解密算法
%以下为混沌解密算法
%以下为混沌解密算法
%以下为混沌解密算法
%以下为混沌解密算法
function e=hundungen(M,N,key0)
key0=3.925*key0*(1-key0);
end
key1=3.925;
for(i=1:M)
for(j=1:N)
key0=key1*key0*(1-key0);
a(i,j)=key0;
end
end
key3=0.2;
key2=3.925;
for(i=1:M)
for(j=1:N)
key3=key2*key3*(1-key3);
b(i,j)=key3;
end
end
key4=0.3;
key2=3.925;
for(i=1:M)
for(j=1:N)
key4=key2*key4*(1-key4);
c(i,j)=key4;
end
end
t=0.4;
w0=0.2;
w1=0.5;
w2=0.3;
w=(1-t)^2*w0+2*t*(1-t)*w1+t^2*w2;
for(i=1:M)
for(j=1:N)
P(i,j)=(1-t)^2*a(i,j)*w0+2*t*(1-t)*b(i,j)*w1+t^2*c(i,j)*w2;
d(i,j)=P(i,j)/w;
d(i,j)=P(i,j);
end
end
x=d;
end
复制代码
3. Operation results
4. Matlab version and references
1 matlab version 2014a
2 References [1] Cai Limei. MATLAB Image Processing - Theory, Algorithm and Case Analysis [M]. Tsinghua University Press, 2020. [2] Yang Dan, Zhao Haibin, Long Zhe. MATLAB Image Processing Example [M] . Tsinghua University Press, 2013. [3] Zhou Pin. MATLAB Image Processing and Graphical User Interface Design [M]. Tsinghua University Press, 2013. [4] Liu Chenglong. Proficient in MATLAB Image Processing [M]. Tsinghua University Publishing Society, 2015.