-
大小: 2KB文件类型: .rar金币: 1下载: 0 次发布日期: 2021-06-09
- 语言: Matlab
- 标签: FuzzyMeans Cluster matlab
资源简介
基于FuzzyMeansCluster算法的高光谱遥感图像聚类(matlab实现)
代码片段和文件信息
%function [clusters] = Fuzzy_K(patterns_incplot_on)
clear all
clc
%read an image file 92av3c9.lan from Multispec
fid1=fopen(‘c:\image\92av3c9.lan‘‘rb‘);
status=fseek(fid1128‘bof‘);
bandnum=9;
row=145;
column=145;
X1=uint16(fread(fid1[row*bandnum column]‘uint16‘));
fclose(fid1);
% change the multispect picture 92av3c9.lan to 3D
for n=1:bandnum
Y1(1:row1:columnn)=X1(1+(n-1)*row:n*row1:column)‘;
end
%read ground truth from the file ‘92av3gt.gis‘
fid=fopen(‘C:\image\92AV3GT.GIS‘‘rb‘);
status=fseek(fid128‘bof‘);
row=145;
column=145;
X=uint8(fread(fid[column row]‘uint8‘));
fclose(fid);
X=X‘;
X_ESSS=X;
max=0;
for i=1:row
for j=1:column
if max max=X_ESSS(ij);
end
end
end
count=zeros(161);
for i=1:1:16
for j=1:row
for k=1:column
if X_ESSS(jk)==i
count(i)=count(i)+1;
end
end
end
end
count
% define the patterns that needs to be classified
for n=1:bandnum
pattern=Y1(::n);
pattern=pattern‘;
X=X‘;
X111=X;
pattern1=pattern(find(X(::)==2));
pattern2=pattern(find(X(::)==5));
pattern3=pattern(find(X(::)==6));
pattern4=pattern(find(X(::)==8));
pattern5=pattern(find(X(::)==11));
pattern6=pattern(find(X(::)==14));
patterns_in(n:)=[pattern1‘pattern2‘pattern3‘pattern4‘pattern5‘pattern6‘];
end
patterns_in=double(patterns_in);
X=X‘;
% define the matrix for the coordinates of the patterns that are to be classified
[R1C1]=find(X(::)==2);
co1=[R1C1]‘;
[R2C2]=find(X(::)==5);
co2=[R2C2]‘;
[R3C3]=find(X(::)==6);
co3=[R3C3]‘;
[R4C4]=find(X(::)==8);
co4=[R4C4]‘;
[R5C5]=find(X(::)==11);
co5=[R5C5]‘;
[R6C6]=find(X(::)==14);
co6=[R6C6]‘;
coordinates=[co1co2co3co4co5co6];
% fuzzy K-means
%Reduce the number of data points using the fuzzy k-means algorithm
%Inputs:
% patterns_in - Input patterns
% c - Number of output data points
% plot_on - Plot stages of the algorithm
%
%Outputs
% patterns - New patterns
% clusters - New clusters
m = 2;
N = size(patterns_in2);
c = 6;%c--the number of clusters designated
dist = zeros(cN);
Dim = size(patterns_in1);%t = size(Xdim) returns the size of the dimension of X specified by scalar dim.
%Initialize the V‘s
%V--the clustering centroids
V = randn(Dimc);
V = sqrtm(cov(patterns_in‘1))*V + mean(patterns_in‘)‘*ones(1c);
old_V = zeros(Dimc);
%Initialize the U‘s
%U--the membership matrix
for i = 1:c
dist(i:) = sum((patterns_in(::) - V(:i)*ones(1N)).^2);
%the sum of the square of the distance from one pattern to eac clustering centroid
end
%Compute U‘s
U = (1./dist).^(1/(m-1));
U = U ./ (ones(c1) * sum(U));
%If A is a matrix sum(A) treats the columns of A as vectors returning a row vector of the sums of
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4714 2007-06-04 19:25 Fuzzy_K.m
----------- --------- ---------- ----- ----
4714 1
- 上一篇:指纹识别matlab程序
- 下一篇:阵列信号处理的理论和应用 matlab程序
相关资源
- 阵列信号处理的理论和应用 matlab程序
- 指纹识别matlab程序
- matlab实现模糊c均值聚类
- 空间离散点最小二乘直线拟合matlab代
- 读取BMP信息并显示的MATLAB程序
- 各种调制方式的matlab程序
- MATLAB灰度共生矩阵纹理特征提取
- 借助matlab实现粗糙集属性约简算法
- 一个零水印算法的matlab实现
- 滑模变结构控制MATLAB仿真基本理论与
- 基于粒子群算法机器人路径规划matl
- matlab6.5以上版本安装advisor2002补丁
- RVM相关向量机实现代码matlab源码
- MATLAB遗传算法215695
- wave_vorticity.m
- hough变换的MATLAB程序
- 高斯混合模型matlab实现
- 语音识别的MATLAB代码
- SGP4的matlab源代码
- lorenz系统程序matlab仿真
- 一个小通信系统的MATLAB源代码仿真或
- 改进的维纳滤波的matlab代码
- 基于遗传算法的排序融合方法matlab程
- matlab仿真,lt码
-
Matlab Simuli
nk三维图形显示模块 - 剪切波变换MATLAB实现代码
- 双闭环直流调速MATLAB仿真模型基于传
- MATLAB辅助现代工程数字信号处理源程
- bpa转matpower
- PAM系统仿真matlab版本
评论
共有 条评论