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

编程入门 行业动态 更新时间:2024-10-10 00:29:08
本文介绍了如何使用MATLAB找到两个斑点之间的最短路径(轮廓/闭合曲线)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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.

更多推荐

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

本文发布于:2023-11-30 15:11:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1650460.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:斑点   最短   如何使用   轮廓   路径

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!