首页 > 行业资讯 > 【图像加密】基于直方图变换实现图像加密附matlab代码

【图像加密】基于直方图变换实现图像加密附matlab代码

时间:2023-12-27 来源: 浏览:

【图像加密】基于直方图变换实现图像加密附matlab代码

天天Matlab 天天Matlab
天天Matlab

TT_Matlab

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,完整matlab代码或者程序定制加qq1575304183。

✅作者简介:热爱科研的Matlab仿真开发者,修心和技 术同步精进,

代码获取、论文复现及科研仿真合作可私信。

个人主页: Matlab科研工作室

个人信条:格物致知。

更多Matlab完整代码及仿真定制内容点击

智能优化算法         神经网络预测         雷达通信        无线传感器          电力系统

信号处理                图像处理                 路径规划         元胞自动机          无人机

内容介绍

在加密过程中,我们首先将所有三个通道组合起来,然后进行洗牌和替换。因此,洗牌后的通道直方图与原始的不同(与灰度情况相反)。这种方法的好处是可以增加加密的强度,使得加密后的数据更难以被破解。然而,这也意味着在解密过程中需要对数据进行相应的逆操作,以恢复原始的直方图和通道数据。

在实际应用中,这种加密方法可以用于保护敏感信息,比如图像数据中的个人身份信息或商业机密。通过对图像数据进行通道组合、洗牌和替换,可以有效地保护这些信息,防止未经授权的访问和窃取。这对于保护用户隐私和企业利益都具有重要意义。

然而,需要注意的是,加密并不是万无一失的。即使采用了复杂的加密方法,也可能存在被破解的风险。因此,在实际应用中,除了加密算法本身,还需要考虑数据的存储和传输安全,以及对加密解密过程的严格控制和监管。只有综合考虑这些因素,才能真正保障数据的安全性和完整性。

总的来说,将通道组合、洗牌和替换应用于加密过程是一种有效的方法,可以增强数据的安全性。然而,在实际应用中需要谨慎对待,确保加密算法的安全性和可靠性,以及对加密数据的全面保护。只有这样,才能真正实现数据的安全加密和保护。

部分代码

% Realevant video % https://www.youtube.com/watch?v=_mNyanDTDvw % The SIPI database % https://sipi.usc.edu/database/ % The following papers can be used as references for chaos based encryption % https://dergipark.org.tr/en/pub/chaos/issue/54264/756229 % https://link.springer.com/chapter/10.1007/978-3-030-92166-8_7 % https://ieeexplore.ieee.org/abstract/document/9396395 % The following code displays the histograms of a plaintext image, its % shuffled version, and its encrypted one. % The histogram’s variance is also computed % See the references above on % information for chaos based encryption. clear plaintext=imread(’plaintext_rgb.png’); shuffled=imread(’shuffled_rgb.png’); ciphertext=imread(’ciphertext_rgb.png’); % Display Images figure subplot(1,3,1) box on imshow(plaintext) title(’Plaintext Image’) set (gca, ’fontsize’ , 10 ) set (gca, ’fontweight’ , ’bold’ ) subplot( 1 , 3 , 2 ) imshow(shuffled) title( ’Shuffled Image’ ) set (gca, ’fontsize’ , 10 ) set (gca, ’fontweight’ , ’bold’ ) box on subplot( 1 , 3 , 3 ) imshow(ciphertext) title( ’Encrypted Image’ ) set (gca, ’fontsize’ , 10 ) set (gca, ’fontweight’ , ’bold’ ) box on % Display their Histograms % In the encryption process, we first combine all three channels and then perform % shuffling and substitution. So the histograms of the shuffled channels % are not the same to the original ones ( in contrast to the grayscale case ) [R,G,B] = imsplit(plaintext); [Rshuf,Gshuf,Bshuf] = imsplit(shuffled); [Renc,Genc,Benc] = imsplit(ciphertext); figure(2) subplot(3,3,1) hold all histogram(R,256,FaceColor="r",EdgeColor="none") set (gca, ’fontsize’ , 10 ) set (gca, ’fontweight’ , ’bold’ ) title( ’Plaintext Image (R)’ ) box on subplot( 3 , 3 , 2 ) hold all histogram(G, 256 ,FaceColor= "g" ,EdgeColor= "none" ) set (gca, ’fontsize’ , 10 ) set (gca, ’fontweight’ , ’bold’ ) title( ’Plaintext Image (G)’ ) box on subplot( 3 , 3 , 3 ) hold all histogram(B, 256 ,FaceColor= "b" ,EdgeColor= "none" ) set (gca, ’fontsize’ , 10 ) set (gca, ’fontweight’ , ’bold’ ) box on title( ’Plaintext Image (B)’ ) subplot( 3 , 3 , 4 ) hold all histogram(Rshuf, 256 ,FaceColor= "r" ,EdgeColor= "none" ) set (gca, ’fontsize’ , 10 ) set (gca, ’fontweight’ , ’bold’ ) title( ’Shuffled Image (R)’ ) box on subplot( 3 , 3 , 5 ) hold all histogram(Gshuf, 256 ,FaceColor= "g" ,EdgeColor= "none" ) set (gca, ’fontsize’ , 10 ) set (gca, ’fontweight’ , ’bold’ ) title( ’Shuffled Image (G)’ ) box on subplot( 3 , 3 , 6 ) hold all histogram(Bshuf, 256 ,FaceColor= "b" ,EdgeColor= "none" ) set (gca, ’fontsize’ , 10 ) set (gca, ’fontweight’ , ’bold’ ) box on title( ’Shuffled Image (B)’ ) subplot( 3 , 3 , 7 ) hold all histogram(Renc, 256 ,FaceColor= "r" ,EdgeColor= "none" ) set (gca, ’fontsize’ , 10 ) set (gca, ’fontweight’ , ’bold’ ) title( ’Encrypted Image (R)’ ) box on subplot( 3 , 3 , 8 ) hold all histogram(Genc, 256 ,FaceColor= "g" ,EdgeColor= "none" ) set (gca, ’fontsize’ , 10 ) set (gca, ’fontweight’ , ’bold’ ) title( ’Encrypted Image (G)’ ) box on subplot( 3 , 3 , 9 ) hold all histogram(Benc, 256 ,FaceColor= "b" ,EdgeColor= "none" ) set (gca, ’fontsize’ , 10 ) set (gca, ’fontweight’ , ’bold’ ) box on title( ’Encrypted Image (B)’ ) % histogram(R, 256 ,binw) % compute variance of histograms counts = imhist(R); disp(’Variance: Plaintext R’) var(counts) counts = imhist(G); disp(’Variance: Plaintext G’) var(counts) counts = imhist(B); disp(’Variance: Plaintext B’) var(counts) counts = imhist(Rshuf); disp(’Variance: Shuffled R’) var(counts) counts = imhist(Gshuf); disp(’Variance: Shuffled G’) var(counts) counts = imhist(Bshuf); disp(’Variance: Shuffled B’) var(counts) counts = imhist(Renc); disp(’Variance: Encrypted R’) var(counts) counts = imhist(Genc); disp(’Variance: Encrypted G’) var(counts) counts = imhist(Benc); disp(’Variance: Encrypted B’) var(counts)

⛳️ 运行结果

参考文献

程序参考以下中文EI期刊,程 序注释清晰,干货满满

https://dergipark.org.tr/en/pub/chaos/issue/54264/756229 

https://link.springer.com/chapter/10.1007/978-3-030-92166-8_7 

https://ieeexplore.ieee.org/abstract/document/9396395 

部分理论引用网络文献,若有侵权联系博主删除
 关注我领取海量matlab电子书和数学建模资料

 私信完整代码、论文复现、期刊合作、论文辅导及科研仿真定制

1 各类智能优化算法改进及应用

生产调度、经济调度、装配线调度、充电优化、车间调度、发车优化、水库调度、三维装箱、物流选址、货位优化、公交排班优化、充电桩布局优化、车间布局优化、集装箱船配载优化、水泵组合优化、解医疗资源分配优化、设施布局优化、可视域基站和无人机选址优化

2 机器学习和深度学习方面

卷积神经网络(CNN)、LSTM、支持向量机(SVM)、最小二乘支持向量机(LSSVM)、极限学习机(ELM)、核极限学习机(KELM)、BP、RBF、宽度学习、DBN、RF、RBF、DELM、XGBOOST、TCN实现风电预测、光伏预测、电池寿命预测、辐射源识别、交通流预测、负荷预测、股价预测、PM2.5浓度预测、电池健康状态预测、水体光学参数反演、NLOS信号识别、地铁停车精准预测、变压器故障诊断

2.图像处理方面

图像识别、图像分割、图像检测、图像隐藏、图像配准、图像拼接、图像融合、图像增强、图像压缩感知

3 路径规划方面

旅行商问题(TSP)、车辆路径问题(VRP、MVRP、CVRP、VRPTW等)、无人机三维路径规划、无人机协同、无人机编队、机器人路径规划、栅格地图路径规划、多式联运运输问题、车辆协同无人机路径规划、天线线性阵列分布优化、车间布局优化

4 无人机应用方面

无人机路径规划、无人机控制、无人机编队、无人机协同、无人机任务分配、无人机安全通信轨迹在线优化

5 无线传感器定位及布局方面

传感器部署优化、通信协议优化、路由优化、目标定位优化、Dv-Hop定位优化、Leach协议优化、WSN覆盖优化、组播优化、RSSI定位优化

6 信号处理方面

信号识别、信号加密、信号去噪、信号增强、雷达信号处理、信号水印嵌入提取、肌电信号、脑电信号、信号配时优化

7 电力系统方面

微电网优化、无功优化、配电网重构、储能配置

8 元胞自动机方面

交通流 人群疏散 病毒扩散 晶体生长

9 雷达方面

卡尔曼滤波跟踪、航迹关联、航迹融合

版权:如无特殊注明,文章转载自网络,侵权请联系cnmhg168#163.com删除!文件均为网友上传,仅供研究和学习使用,务必24小时内删除。
相关推荐