
欢迎来到海神之光博客之家✅博主简介热爱科研的Matlab仿真开发者修心和技术同步精进个人主页海神之光代码获取方式海神之光Matlab王者学习之路—代码获取方式⛳️座右铭行百里者半于九十。更多Matlab图像处理仿真内容点击①Matlab图像处理进阶版②付费专栏Matlab图像处理初级版⛳️关注CSDN海神之光更多资源等你来⛄一、图像分割简介理论知识参考【基础教程】基于matlab图像处理图像分割【含Matlab源码 191期】⛄二、部分源代码clearclose allclcclearclose allclc%% %%%%%%%%%%%%%%%图像%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Iimread(‘3096.jpg’);if size(I,3) 3Irgb2gray(I);elseendfigure;imshow(I);title(‘(a)原始图像’);imwrite(I,‘1.tiff’,‘tiff’,‘Resolution’,300);%保存为tif%II;%不加噪声% Iimnoise(I,‘speckle’,deta_2);Iimnoise(I,‘salt pepper’,0.05); %加噪图椒盐噪声% Iimnoise(I,‘gaussian’,0,0.01); % 加高斯噪声figure;imshow(I);title(‘(b)加噪图像’);imwrite(I,[‘2.’,‘.tiff’],‘tiff’,‘Resolution’,300);%保存为tif[m,n]size(I);% k4;k2;r3;m_index2;beta6;neighbor3;%3*3邻域去噪lamda_s_enfcm3;%s参数Iim2double(I);I4 I(; %% 将图像灰度按列排列%% ------------------------ ifcm------------------------ifcm_labelzeros(m*n,1);tcputime;tic;[O2, U2, obj_fcn2] ifcm(I4, k);toc;time_fcm_spatial_meancputime-t;maxU2 max(U2); %隶属度最大for j1:kindex find(U2(j, maxU2); %隶属度最大对应的像素位置ifcm_label(index) j;endlabels2reshape(ifcm_label,[m n]);%显示聚类分割图labels2(find(labels21))0;labels2(find(labels22))255;labels2(find(labels23))125;labels2(find(labels24))180;labels2uint8(labels2);% figure;imshow(labels2,[]);title(‘©聚类分割图’);imwrite(labels2,‘3.jpg’);imwrite(labels2,‘33.png’)%保存为jpgfigure;imshow(labels2,[]);title(‘©聚类分割图’);imwrite(labels2,[‘3.1.’,‘.tiff’],‘tiff’,‘Resolution’,300);%保存为tiffunction [center, U, obj_fcn] ifcm(data,cluster_n)if nargin ~ 2 nargin ~ 3,error(‘Too many or too few input arguments!’);enddata_n size(data, 1);in_n size(data, 2);% Change the following to set default optionsdefault_options [2; % exponent for the partition matrix U100; % max. number of iteration1e-5; % min. amount of improvement1]; % info display during iterationif nargin 2,options default_options;else% If “options” is not fully specified, pad it with default values.if length(options) 4,tmp default_options;tmp(1:length(options)) options;options tmp;end% If some entries of “options” are nan’s, replace them with defaults.nan_index find(isnan(options)1);options(nan_index) default_options(nan_index);if options(1) 1,error(‘The exponent should be greater than 1!’);endendexpo options(1); % Exponent for Umax_iter options(2); % Max. iterationmin_impro options(3); % Min. improvementdisplay options(4); % Display info or notobj_fcn zeros(max_iter, 1); % Array for objective function%U initfcm(cluster_n, data_n); % Initial fuzzy partitioncenter initifcmv(cluster_n); %初始化聚类中心[Miuij,Vij,Paiij]initifcmmvp(data);for i 1:max_iter,[U, center, obj_fcn(i)] ifcm_step(data, center, cluster_n, expo, Miuij,Vij,Paiij);if display,fprintf(‘Iteration count %d, obj. fcn %f\n’, i, obj_fcn(i));end% check termination conditionif i1% if abs(obj_fcn(i) - obj_fcn(i-1)) min_impro, break; end,% if norm(old_U-U,2) min_impro, break; end,% if norm(old_U-U,‘fro’) min_impro, break; end,if norm(old_center-center,2) min_impro, break; end,% (old_center-center).^2end old_U U; old_center center;end% iter_n i; % Actual number of iterations% % obj_fcn(iter_n1:max_iter) [];% mf old_U.^expo; % 隶属度矩阵进行指数运算结果% dist distfcm(old_center, data); % 计算距离矩阵% obj_fcn sum(sum((dist.^2).*mf)); % 计算目标函数值⛄三、运行结果⛄四、matlab版本及参考文献1 matlab版本2014a2 参考文献[1]赵勇,方宗德,庞辉,王侃伟.基于量子粒子群优化算法的最小交叉熵多阈值图像分割[J].计算机应用研究. 2008,(04)3 备注简介此部分摘自互联网仅供参考若侵权联系删除 仿真咨询1 各类智能优化算法改进及应用生产调度、经济调度、装配线调度、充电优化、车间调度、发车优化、水库调度、三维装箱、物流选址、货位优化、公交排班优化、充电桩布局优化、车间布局优化、集装箱船配载优化、水泵组合优化、解医疗资源分配优化、设施布局优化、可视域基站和无人机选址优化2 机器学习和深度学习方面卷积神经网络CNN、LSTM、支持向量机SVM、最小二乘支持向量机LSSVM、极限学习机ELM、核极限学习机KELM、BP、RBF、宽度学习、DBN、RF、RBF、DELM、XGBOOST、TCN实现风电预测、光伏预测、电池寿命预测、辐射源识别、交通流预测、负荷预测、股价预测、PM2.5浓度预测、电池健康状态预测、水体光学参数反演、NLOS信号识别、地铁停车精准预测、变压器故障诊断3 图像处理方面图像识别、图像分割、图像检测、图像隐藏、图像配准、图像拼接、图像融合、图像增强、图像压缩感知4 路径规划方面旅行商问题TSP、车辆路径问题VRP、MVRP、CVRP、VRPTW等、无人机三维路径规划、无人机协同、无人机编队、机器人路径规划、栅格地图路径规划、多式联运运输问题、车辆协同无人机路径规划、天线线性阵列分布优化、车间布局优化5 无人机应用方面无人机路径规划、无人机控制、无人机编队、无人机协同、无人机任务分配6 无线传感器定位及布局方面传感器部署优化、通信协议优化、路由优化、目标定位优化、Dv-Hop定位优化、Leach协议优化、WSN覆盖优化、组播优化、RSSI定位优化7 信号处理方面信号识别、信号加密、信号去噪、信号增强、雷达信号处理、信号水印嵌入提取、肌电信号、脑电信号、信号配时优化8 电力系统方面微电网优化、无功优化、配电网重构、储能配置9 元胞自动机方面交通流 人群疏散 病毒扩散 晶体生长10 雷达方面卡尔曼滤波跟踪、航迹关联、航迹融合