I have a 2D array of integers that represent groupings (crystal grains) on a 2D surface. something like this: (each pixel of that image is assigned an integer depending on the group it belongs to, so every red pixel is assigned 1 for example, every blue is 2)
在两个此类集团(用户点击)之间的边界上给予X,Y-coordination, how,我可以追踪这2个集团之间的边界,使沿边界的每座钢ordinate得以拯救,并获得两个终端坐标。 (一) 在没有终点但空档的情况下,并不涉及封闭状态。
不管算法如何 我来到这里似乎非常渴望执行,我可以想象,以前没有人这样做了。 任何帮助? 最好是在c#中找到解决办法,但非常赞赏对算法的任何担忧。
http://www.un.org。
我本应该指出,我将执行一种算法,使这一行文如此:
- between the two endpoints define a line
- get the boundary point farthest away from the current line, if it is farther than d, split the line at this point, so there are two line segments
- repeat until no boundary point is farther away than d from the line strip
我认为,这足以执行我为什么不说这一点。 要想到这里,我就迫切需要解决当前的问题。
问题:
short[,]belling;
with which is around 250x150 which such as:
11111112222
11111222222
11112222222
11112222222 <- user clicks on leftmost 2 or rightmost 1 -> I want to trace that border
11111122222 down to the first
11111133322 encountered 3 and up to the
11333333333 frame-border
what do I currently have? - at first I tried a walking -algorithm, something like mvds posted, but found me doing stepping, neighborcalculation and checking in all 4 directions which was tedious and looked awful. I didn t find a nice representation for "this is the direction the last step came from, don t check that pixel for neighborhood".
然后,我放弃了步行算法,并尝试了一种全球办法(如过滤器):每台钢子检查,如果是彩色1,在4个邻里有色2。 有了这一点,我就能够跨越肤色1和肤色2之间的界限。 我将拆除与用户-电离层协调不相连的所有边界,但随后我要谈谈:最终点是什么?
我仍然感谢更多的投入。 现在,我看一看一下我可以在多大程度上使用微薄算法。