关于使用K-means进行图像分割的帮助 [英] Help about Image Segmentation with K-means

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

问题描述

大家好,
之后,我在Microsoft Visual Studio 2008上设置了Accord.Net Framework.
我在其样本中看到有关K均值的图像分割.
例如,当我选择簇数为3时,结果将得到3个具有不同颜色强度的区域.
现在,我想对这些具有边界的群集进行本地化.例如,我有3个群集.因此,有1个具有红色边框的群集,1个具有黄色边框的群集,1个具有绿色边框的群集.
我需要您的帮助!!!
感谢!!

Hi all,
I set up Accord.Net Framework on Microsoft Visual Studio 2008, after that
i saw in a its samples about K-means as a image segmentation.
For example,when i choose a number of cluster is 3, the result will get 3 region with different color intensity.
Right now, I want to localize these clusters with borders.For example,i have 3 cluster.Thus, 1 cluster with red border, 1 cluster with yellow border, 1 cluster with green border.
I do need your help!!!
Thank!!

推荐答案

Dientu,

实现此目的的一种方法是创建一个单独的图像,在该图像中,您为每个像素分配群集颜色(1、2或3).然后扫描此图像,并针对每个像素查看直接的邻居(如果考虑不考虑拐角,则有8个或4个).如果至少一个邻居的颜色不同,则给定的像素为边框像素,您可以将其绘制在原始图像中.

这将为您提供区域的内部边界.通过即时重新计算像素索引,您也可以不用单独的图像.
Dientu,

A way to achieve this is to create a separate image where you assign every pixel the cluster color (1, 2, or 3). Then scan this image and for every pixel look at the immediate neighbors (there are 8 or 4 of them if you consider corners or not). If at least one neighbor is of a different color, then the given pixel is a border pixel and you can paint it in your original image.

This will give you the internal borders of the regions. You can also do without the separate image, by recomputing the pixel indexes on the fly.


谢谢Ydaoust
我是越南人,我的编程技能很差,因为我的专业是电子学.我也理解您的意见,但是我很难像您的建议那样编写代码.因此,很高兴您能给我一个有关此问题的示例项目.
Thank you Ydaoust
I''m Vietnamese and my programming skill is fairly bad because my major''s electronic. I also understood your opinion, but it''s difficult for me to write code like your suggestion.So,I''m glad if you can give me a sample project about this problem.
Regards,


抱歉,我没有使用Accord.NET.我所能提供的只是伪代码.

您是否能够执行最基本的操作,例如在给定的X,Y坐标处获取或设置图像中的像素?
I am sorry, I don''t use Accord.NET. All I could give you is pseudocode.

Are you able to perform the most basic operations such as getting or setting a pixel in the image at given X, Y coordinates ?


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

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