🍒🍒🍒欢迎关注🌈🌈🌈
📝个人主页:我爱Matlab
👍点赞➕评论➕收藏 == 养成习惯(一键三连)🌻🌻🌻🍌希望大家多多支持🍓~一起加油 🤗
💬语录:将来的我一定会感谢现在奋斗的自己!
🍁🥬🕒摘要🕒🥬🍁
【图像分割】基于神经气体网络 (NGN)实现图像分割附matlab代码
✨🔎⚡运行结果⚡🔎✨
💂♨️👨🎓Matlab代码👨🎓♨️💂
clc;
clear;
close all;
%% Load Image
Org=imread('Veg.jpg');
X = rgb2gray(Org);
X=double(X);
img=X;
X=X(:)';
%% Neural Gas Network (NGN) Parameters
ParVal.N = 16; % Number of Segments
ParVal.MaxIt = 50; % Number of runs
ParVal.tmax = 100000;
ParVal.epsilon_initial = 0.3;
ParVal.epsilon_final = 0.02;
ParVal.lambda_initial = 2;
ParVal.lambda_final = 0.1;
ParVal.T_initial = 5;
ParVal.T_final = 10;
%% Training Neural Gas Network
NGNnetwok = GasNN(X, ParVal);
%% Vector to image and plot
Weight=sum(round(rescale(NGNnetwok.w,1,ParVal.N)));
Weight=round(rescale(Weight,1,ParVal.N));
indexed=reshape(Weight(1,:),size(img));
segmented = label2rgb(indexed);
% Plot Res
figure('units','normalized','outerposition',[0 0 1 1])
subplot(2,2,1)
imshow(Org,[]); title('Original');
subplot(2,2,2)
imshow(img,[]); title('Grey');
subplot(2,2,3)
imshow(segmented);
title(['Segmented in [' num2str(ParVal.N) '] Segments']);
subplot(2,2,4)
imshow(indexed,[]);
title(['Quantized in [' num2str(ParVal.N) '] Thresholds']);
📜📢🌈参考文献🌈📢📜
[1]张烨,樊一超,许艇,郭艺玲.基于轻量化图像分割的物流车辆特征定位研究[J].浙江工业大学学报,2020,48(04):426-434.