KMeans Segmentation - MEX

バージョン 1.2.0.0 (5.7 KB) 作成者: Ahmad
Given N data elements of R dimensions (N x R matrix), it segregates the n elements into k clusters
ダウンロード: 3K
更新 2010/6/23

ライセンスの表示

KMEANSK - mex implementation (compile by mex kmeansK.cpp
Also an equivalent MATLAB implementation is present in zip file

Performs K-means clustering given a list of feature vectors and k. The argument k indicates the number of clusters you want the data to be divided into. data_vecs (N*R) is the set of R dimensional feature vectors for N data points. Each row in data_vecs gives the R dimensional vector for a single data point. Each column in data_vecs refers to values for a particular feature vector for all the N data points. The output data_idxs is a N*1 vector of integers telling which cluster number a particular data point belongs to. It also outputs centroids which is a k*R matrix, where each rows gives the vector for the cluster center. If we want to segment a color image i into 5 clusters using spacial and color information, we can use this function as follows:

% r = i(:,:,1);
% g = i(:,:,2);
% b = i(:,:,3);
% [c r] = meshgrid(1:size(i,1), 1:size(i,2));
% data_vecs = [r(:) g(:) b(:) r(:) c(:)];
% [ data_idxs centroids ] = kmeansK( data_vecs, k );
% d = reshape(data_idxs, size(i,1), size(i,2));
% imagesc(d);

引用

Ahmad (2024). KMeans Segmentation - MEX (https://www.mathworks.com/matlabcentral/fileexchange/27969-kmeans-segmentation-mex), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2009b
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersCluster Analysis and Anomaly Detection についてさらに検索
謝辞

ヒントを与えたファイル: Sparsified K-Means

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
1.2.0.0

Comments update. Plus shifted some functionality to a utils file

1.1.0.0

Included some input checking!

1.0.0.0