【图像分割】基于哈里斯鹰优化多阈值实现图像分割附matlab代码(基于阈值的图像分割方法有哪些)

网友投稿 455 2022-09-06


【图像分割】基于哈里斯鹰优化多阈值实现图像分割附matlab代码(基于阈值的图像分割方法有哪些)

1 简介

一种基于哈里斯鹰优化算法图像分割方法,包括:步骤1:获取待分割图像的灰度值范围;步骤2:根据所述图像的灰度值范围利用哈里斯鹰优化算法得到待分割图像的最佳阈值;步骤3:根据所述图像分割的最佳阈值,对待分割图像进行分割.本发明是一种新的基于哈里斯鹰与S熵的图像分割方法,相比于其他经典优化算法解决多阈值图像分割的问题,具有分割图像质量更高和分割结果更为稳定的优点.

2 部分代码

%% MCET-HHO%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% An Efficient Harris Hawks-inspired Image Segmentation Method%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%clear allclcclose all%% Initial dataI=imread('rice.png'); % Load image[h,nh]=imhist(I); % Get Histogram[m,n]=size(I); % Image sizeL=length(h); % Lmax levels to segment 0 - 256Nt=size(I,1) * size(I,2); % Total pixels in the image% Frequency distribution of each intensity level of the histogram 0 - 256for i=1:L probI(i)=h(i)/Nt;end%% Initial data of the HHO algorithmnVar=1; % Number of thresholds (Th)VarSize=[1 nVar]; % Decision Variables in MatrixVarMin=1; % Minimum value of ThVarMax=255; % Maximum value of Th%% Harris Hawks Algorithm ParametersN=30; % Maximum Number of HawksT=100; % Maximum Number of IterationsticRabbit_Location=zeros(1,nVar); % Initialization of the rabbit's locationRabbit_Energy=inf; % Initialization of the energy of the rabbit%% Initialization of the position of the hawksX=initialization(N,nVar,VarMax,VarMin);%% Harris Hawks Algorithm MainCNVG=zeros(1,T);t=0; % Counter CNVG(t)=Rabbit_Energy;end%% Image segmentationIth=MultiTresh(I,Rabbit_Location);figuresubplot(122)imshow(Ith);title('哈里斯鹰优化阈值分割后的图')subplot(121)imshow(I);title('原图')%% Evaluation of the segmentation%PSNR: Peak Signal to Noise RatioPSNR=psnr(Ith, I)% SSIM: Structural Similarity Index (1, indica una conincidencia perfecta)SSIM=ssim(I,Ith)%FSIM: Feature Similarity IndexFSIM=FeatureSIM(I,Ith)%% Histogram Plotfitness = Rabbit_Energyintensity = Rabbit_Locationfigureplot(probI)hold onvmax = max(probI);for i = 1:length(Rabbit_Location) line([intensity(i), intensity(i)],[0 vmax],[1 1],'Color','r','Marker','.','LineStyle','-'); hold onendhold off

3 仿真结果

4 参考文献

[1]张光斌, 王运, 赵程程,等. 一种基于哈里斯鹰优化算法的图像分割方法:, CN110827299A[P]. 2020.

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:【车间调度】基于帝国企鹅算法求解考虑AVG分区多行车间调度问题附matlab代码
下一篇:详解Java SpringAOP切面类
相关文章

 发表评论

暂时没有评论,来抢沙发吧~