【图像加密】基于Lshape算法实现图像加密解密附matlab代码
【图像加密】基于Lshape算法实现图像加密解密附matlab代码
TT_Matlab
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,完整matlab代码或者程序定制加qq1575304183。
1 简介
由于混沌序列具有容易生成,对初始条件和混沌参数敏感等特点,近年来在图像加密领域得到了广泛的应用.因此可以借助Matlab编程语言,编写适当的算法将信息进行加解密,实现对秘密消息的加密保护.
2 部分代码
% Following program is used to encrypt and decrypt an image with L-shaped
% Clear space
clc; clear all; close all;
% Get the Mona Lisa image
[filename,pathname,fileindex] = uigetfile(’*.jpg’,’Pls select a jpg file’);
% Read in picture
% rgb = imread(’*.jpg’);
rgb = imread(filename);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(1);
subplot(221)
imshow(rgb);
title(’The original image’);
sizeM = size(rgb);
nn = sizeM(1);
mm = sizeM(2);
% Transpose the Fractals
rgb0 = reshape(rgb,nn,mm*3,1)’;
rgb1 = reshape(rgb0,nn,mm,3);
rgb2 = rgb1;
% Prepare the L shapes
end
% Encrypt the image
subplot(222)
imshow(rgb2);
title(’The fractal tromino ’);
rgb3 = bitxor(rgb1,rgb2);
subplot(223)
imshow(rgb3);
title(’The encrypted image’);
% Decrypt the image
subplot(224)
rgb4 = bitxor(rgb3,rgb2);
rgb5 = reshape(rgb4,mm*3,nn,1)’;
rgb6 = reshape(rgb5,nn,mm,3);
imshow(rgb6);
title(’The decrypted image’);
3 仿真结果
4 参考文献
[1]李梅, 李佳酿, 陈飞翔. 基于混沌序列图像加密技术的Matlab实现[J]. 建筑工程技术与设计, 2015(27).
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
-
2023年血糖新标准公布,不是3.9-6.1,快来看看你的血糖正常吗? 2023-02-07
-
2023年各省最新电价一览!8省中午执行谷段电价! 2023-01-03
-
GB 55009-2021《燃气工程项目规范》(含条文说明),2022年1月1日起实施 2021-11-07
-
PPT导出高分辨率图片的四种方法 2022-09-22
-
2023年最新!国家电网27家省级电力公司负责人大盘点 2023-03-14
-
全国消防救援总队主官及简历(2023.2) 2023-02-10
-
盘点 l 中国石油大庆油田现任领导班子 2023-02-28
-
我们的前辈!历届全国工程勘察设计大师完整名单! 2022-11-18
-
关于某送变电公司“4·22”人身死亡事故的快报 2022-04-26
