K-Nearest Neighbors for image segmentation

版本 1.3.0.0 (1.1 KB) 作者: Makrim
Implementation of the algorithm K-Nearest Neighbors.
1.8K 次下载
更新时间 2014/4/22

查看许可证

Script Exemple :
-------------
% k of k-nearest neighbors
k = 3 ;
% generate a test image data , a matrix of 3 by 3, values are doubles that
% range from 10 to 20
im_test_data = [10 20 30; 20 10 30; 20 10 30];

% generate a training/apprentissage data image from test data image
im_tr_data = [10 0 30;0 10 0; 20 0 30];

% generate a truth image labels with 3 by 3 matrix, values are integers
% that range from 1 to 3 (10 correspond to label 1, 20 to 2 and 30 to 3)
im_t_lbls = [1 2 3; 2 1 3; 2 1 3];

% generate a training/apprentissage image labels from truth image labels
im_tr_lbls = [1 0 3;0 1 0; 2 0 3];

% we are looking for "test_lbls" ?
test_lbls = knnAlgo(im_test_data, im_tr_data,im_tr_lbls,k);

引用格式

Makrim (2024). K-Nearest Neighbors for image segmentation (https://www.mathworks.com/matlabcentral/fileexchange/46117-k-nearest-neighbors-for-image-segmentation), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2009b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Statistics and Machine Learning Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.3.0.0

update

1.2.0.0

improved the description

1.1.0.0

problem solved of frequency when there is unique knn

1.0.0.0