资源简介
利用模糊C聚类(FCM)的方法对彩色图像进行分割,期中可以用不通的特征向量来表征图像的特征
代码片段和文件信息
clear
close all
cluster_n=3;
I=imread(‘PeppersRGB.tif‘);
%the feature vector is hsv
I_hsv=rgb2hsv(I);
data1=double(I_hsv(::1));
data2=double(I_hsv(::2));
data3=double(I_hsv(::3));
[mnz]=size(I);
result=zeros(mnz);
r=double(I(::1));
g=double(I(::2));
b=double(I(::3));
%The feature vector is rgb
% data1=r;
% data2=g;
% data3=b;
%The feature vector is lst
% data1=(r+g+b)/3;
% data2=(r-b)/2;
% data3=(2*g-r-b)/4;
% I(::1)=data1;
% I(::2)=data2;
% I(::3)=data3;
data=[data1(:)data2(:)data3(:)];
data_n=size(data1);
max_iter=100;
expo=2;
min_impro=1;
U = initfcm(cluster_n data_n); % initialize the membership matrix
% Main loop
for i = 1:max_iter
%update the membership matrix U and the clustering center;
[U center obj_fcn(
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-03-27 03:25 FCM\
文件 1649 2012-03-06 23:35 FCM\FCM1.m
文件 1319 2012-03-05 10:33 FCM\FCM2.m
文件 2809350 2012-03-06 23:38 FCM\HW3.pdf
评论
共有 条评论