Image Segmentation Using K means
古いコメントを表示
When I execute the following command in Matlab 2012a
centroid=kmeans(imread('image.jpg'),4);
I get the following error
Error using +
Integers can only be combined with integers of the same class, or scalar doubles.
Error in kmeans>distfun (line 659)
*D(:,i) = D(:,i) + (X(:,j) - C(i,j)).^2;*
*Error in kmeans (line 273)*
*D = distfun(X, C, distance, 0, rep, reps);*
I need to segment this image into 4 cluster. This image is a CT Brain tumour Image. Size of this image is 233 x 216. Please give me a solution to cluster this image file.
回答 (3 件)
Walter Roberson
2013 年 6 月 29 日
YourImage = imread('Image.jpg');
centroid = kmeans(double(YourImage), 4);
Note: if your .jpg is color rather than greyscale, you will probably need to convert it to greyscale before clustering.
5 件のコメント
Octa
2013 年 6 月 29 日
Image Analyst
2013 年 6 月 29 日
Do you want to cluster based on intensity of pixels (e.g. you want 4 gray level classes), or you want to find spatial clusters (e.g. 4 clumps of spatially separated pixels)?
Octa
2013 年 7 月 2 日
syed salma banu s
2018 年 12 月 31 日
sir i need to cluster the image based on intensity of pixels e.g. i want 3 gray level classes
Walter Roberson
2018 年 12 月 31 日
convert the image to grayscale and kmeans requesting 3 clusters .
moahaimen talib
2017 年 4 月 10 日
0 投票
hi i need to use kmean for segmenting and clustering a binary image please help
1 件のコメント
Image Analyst
2017 年 4 月 10 日
Gebra maryam Alehegn
2017 年 5 月 1 日
0 投票
How to correctly culsture image using k menas?
カテゴリ
ヘルプ センター および File Exchange で Image Segmentation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!