如何使用MATLAB找到两个斑点之间的最短路径(轮廓/闭合曲线)?斑点、最短、如何使用、轮廓

2023-09-11 06:22:47 作者:半缕轻烟

bwlabel 可以用来获取图像中的断开连接的对象:

bwlabel can be used to get disconnected objects in an image:

[L Ne] = bwlabel(image);   

如何计算断开这两者之间的最短路径的闭合曲线

How to calculate the shortest path between two disconnected closed curves?

有没有实际的(不是理论)的解决方案?

Is there a practical(not theoretical) solution?

推荐答案

尝试提取要连接和使用它们作为你的图节点对象的周边像素的坐标。然后使用 A *算法找出每对你的套之间的最短路径。这有效地使用A *,但它限制对感兴趣的节点(从节点的路径中的一个对象到另一个),解决了全对的问题。

Suggestion 1

Try extracting the coordinates of the perimeter pixels of the objects you want to connect and use them as nodes in your graph. Then use the A* algorithm to find the shortest paths between each pair between your sets. This effectively solves the all-pairs problem using A* but restricting it to nodes of interest (paths from nodes in one object to the other).

另一个想法(未测试)是计算每个斑点的形心之间的最短路径(regionprops可用于计算质心),看看它周长像素是通过将路径相交。当然,这可能会工作,如果你的心是BLOB内,但事情变得复杂非凸的斑点。这减少了你的算法,以斑点的数目的复杂性,而不是周边像素的数量(其可以是巨大的)。

Another idea (untested) is to compute the shortest path between the centroid of each blob (regionprops can be used to compute the centroid) and see which perimeter pixel is intersected by the path. Of course, this might work if your centroid is within the blob, but things get messy with non-convex blobs. This reduces the complexity of your algorithm to the number of blobs as opposed to the number of perimeter pixels (which can be huge).

另外,如果建议2 对你的作品,你可以使用的弗洛伊德-沃肖尔来计算图像中的所有的斑点之间的最短路径。

Also, if Suggestion 2 works for you, you can use Floyd-Warshall to compute the shortest paths between all the blobs in the image.

 
精彩推荐
图片推荐