A list,

The design and application of image encryption algorithm based on chaotic system

Part of the source code

Function b=jiami(a,s,h) [m1,n1]=size(a(:,:,1));
x=zeros(1,m1+n1);
y=[1:m1+n1]; % Then, using Logitic mapping to generate a chaotic sequence:for n=1:m1+n1- 1
    x(1)=s;
    q=h;
   x(n+1)=q*x(n)*(1- x(n)); End % sort row scramblingfor f=1:m1- 1
    for h=f:m1
        if x(f)>x(h)
            k=x(f);
            x(f)=x(h);
            x(h)=k;
            m=y(f);
            y(f)=y(h);
            y(h)=m;
            c1=a(f,:,:);
            a(f,:,:)=a(h,:,:);
            a(h,:,:)=c1;
       end
    end
end
 function b=jiemi(a,s,h)
[m1,n1]=size(a(:,:,1));
x=zeros(1,m1+n1);
y=[1:m1+n1]; % Then, using Logitic mapping to generate a chaotic sequence:for n=1:m1+n1- 1
    x(1)=s;
    q=h;
   x(n+1)=q*x(n)*(1- x(n)); End % row scramblingfor f=1:m1- 1
    for h=f:m1
        ifx(f)>x(h) k=x(f); x(f)=x(h); x(h)=k; m=y(f); y(f)=y(h); y(h)=m; End end END % Column scramblingfor f=m1+1:m1+n1- 1
    for h=f:m1+n1
        ifx(f)>x(h) k=x(f); x(f)=x(h); x(h)=k; m=y(f); y(f)=y(h); y(h)=m; End end END % Line decryptionfor f=1:m1- 1
    for h=f:m1
        if y(f)>y(h)
            m=y(f);
            y(f)=y(h);
            y(h)=m;
            c1=a(f,:,:);
            a(f,:,:)=a(h,:,:);
           a(h,:,:)=c1;
           
        end
    end
end
Copy the code

Third, the operation result

Iv. 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. Detailed Analysis of MATLAB Image Processing Examples [M]. Tsinghua University Press, 2013. [3] Zhou Pin. MATLAB Image Processing and Graphic User Interface Design [M]. Tsinghua University Press, 2013. [4] LIU Chenglong. Proficient in MATLAB image processing [M]. Tsinghua University Press, 2015.