在 MATLAB 中的数据簇上绘制多边形时出现问题
我有一些数据点,我用一些聚类算法将它们分成了一些簇,如下图所示:(图像可能需要一些时间才能出现) 替代文本 http://www.freeimagehosting.net/uploads/05a807bc42.png
每个颜色代表不同的簇。我必须在每个簇周围绘制多边形。出于这个原因,我使用 convhull。但正如您所看到的,红色簇的多边形非常大并且覆盖了很多区域,这不是我要寻找的多边形。我需要精确地围绕我的数据集绘制线条(多边形)。例如,在上图中,我想要一个与具有 3 个分支的红色簇完全相同(且围绕)绘制的多边形。换句话说,在这种情况下,我需要一个具有 3 个分支的多边形来覆盖我的红色簇,而不是覆盖整个区域的大多边形。谁能帮我解决这个问题吗? 请注意,解决方案应该是通用的,因为聚类在算法的每次运行中都会发生变化,因此它需要采用通用的方式。
I have some data points which I have devided into them into some clusters with some clustering algorithms as the picture below:(it might takes some time for the image to appear)
alt text http://www.freeimagehosting.net/uploads/05a807bc42.png
Each color represents different cluster. I have to draw polygons around each cluster. I use convhull for this reason. But as you can see the polygon for the red cluster is very big and covers a lot of areas, which is not the one I am looking for. I need to draw lines(ploygons) exactly around my data sets. For example in the picture above I want a polygon that is drawn exactly the same(and around) as the red cluster with the 3 branches. In other words, in this case I need a polygon with 3 branches to cover my red clusters not that big polygon that covers the whole area. Can anyone help me with this?
Please Note that the solution should be general, because the clusters will change in each run of the algorithm, so it needs to be in a way that is general.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定这是一个完全指定的问题。我发现这个问题的这种变体经常出现。
为什么这个问题不能在这里得到真正的答案:想象六个点,三个点在一个等边三角形中,另外三个点在其内部的等边三角形中,方向相同。
正确的船体是什么?它只是凸包吗?它是一个内三角形,有三个线支线从中伸出吗?三角形的相对大小重要吗?那么您是否必须指定该参数?
I am not sure this is a fully specified question. I see this variants on this question come up quite often.
Why this can not really be answered here: Imagine six points, three in an equilateral triangle with another three in an equilateral triangle inside it in the same orientation.
What is the correct hull around this? Is it just the convex hull? Is it the inner triangle with three line spurs coming out from it? Does it matter what the relative sizes of the triangles are? Should you have to specify that parameter then?
如果您的簇非常紧凑,您可以尝试以下操作:
imclose
来填充由于运气不好而未着色的内部小孔。bwperim
提取边框像素。这是您要寻找的多边形的轮廓。If your clusters are very compact, you could try the following:
imclose
on your mask in order to fill little holes inside that have not been colored due to sheer bad luck.bwperim
. This is the outline of the polygon you're looking for.