使用K表示图像分割 [英] Image Segmentation Using K means

查看:136
本文介绍了使用K表示图像分割的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Matlab中执行以下命令2012a

When I execute the following command in Matlab 2012a

centroids=kmeans(imread('image.jpg'),4);

我收到以下错误:

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);

我需要将图像分割成4个群集。该图像是 JPEG 格式的CT脑肿瘤图像。这个图片的大小是 233x216

请给我一个解决方案来集群这个图像文件。

I need to segment the image into 4 clusters. The image is a CT Brain tumour image in JPEG format. The size of this image is 233x216.
Please give me a solution to cluster this image file.

推荐答案

使用kmeans分段算法,而不是MATLAB中提供的默认kmeans算法。

Use the kmeans Segmentation algorithm instead of the default kmeans algorithm provided in MATLAB.

参考这个文件。这是用于分割目的的K均值算法。通过使用这个算法,我的程序正在运行。

Refer to this file. This is the K means algorithm used for segmentation purpose. By using this algorithm my program is working.

这篇关于使用K表示图像分割的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆