检测任意形状

发布于 2024-10-11 09:02:47 字数 158 浏览 8 评论 0原文

您好,

我们有一组代表 3d 物体和水平面的交点的点。我们想要检测代表身体横截面的 2D 形状。可以有一个或多个这样的形状。我们找到了讨论如何使用霍夫变换对图像进行操作的文章,但我们可能有数千个这样的点,因此转换为图像是非常浪费的。有没有更简单的方法来做到这一点?

谢谢

Greetings,

We have a set of points which represent an intersection of a 3d body and a horizontal plane. We would like to detect the 2D shapes that represent the cross sections of the body. There can be one or more such shapes. We found articles that discuss how to operate on images using Hough Transform, but we may have thousands of such points, so converting to an image is very wasteful. Is there a simpler way to do this?

Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

醉南桥 2024-10-18 09:02:47

在将 3D 模型转换为一组点时,您已经丢弃了查找相交形状所需的信息。遍历 3D 模型的边面连接图,按顺序找到边平面交点。

假设您拥有或可以构建 3D 模型地形(一定数量的顶点、顶点之间的边、由边绑定的面):

  1. 迭代边列表,直到找到与测试平面相交的边,将其添加到列表中
  2. 选择一个共享该边的面的
  3. 迭代该面的其他边以找到下一个交点,将其添加到列表中
  4. 对共享该边的其他面重复该操作,直到回到起始边

您已构建了一个有序列表与平面相交的边的数量 - 对每条边进行线性插值以按顺序找到形成相交形状的交点是很简单的。请注意,此过程假设面多边形是凸的,在您的情况下它们是凸的。
如果您的体积是凹形的,您将有多个离散的交叉形状,因此您需要重复此过程,直到检查了所有边缘。

有一些java代码可以执行此操作 此处

In converting your 3D model to a set of points, you have thrown away the information required to find the intersection shapes. Walk the edge-face connectivity graph of your 3D model to find the edge-plane intersection points in order.

Assuming you have, or can construct, the 3d model topography (some number of vertices, edges between vertices, faces bound by edges):

  1. Iterate through the edge list until you find one that intersects the test plane, add it to a list
  2. Pick one of the faces that share this edge
  3. Iterate through the other edges of that face to find the next intersection, add it to the list
  4. Repeat for the other face that shares that edge until you arrive back at the starting edge

You've built an ordered list of edges that intersect the plane - it's trivial to linearly interpolate each edge to find the intersection points, in order, that form the intersection shape. Note that this process assumes that the face polygons are convex, which in your case they are.
If your volume is concave you'll have multiple discrete intersection shapes, and so you need to repeat this process until all edges have been examined.

There's some java code that does this here

冰魂雪魄 2024-10-18 09:02:47

当平面与凹面的某些顶点相交时,所接受答案中的算法/代码不适用于复杂的特殊情况。在这种情况下,贪婪地“行走”边面连接图可以提前关闭一些多边形。

发生的情况是,由于平面与顶点相交,因此在遍历图形时的某一点,下一条边有两种可能性,选择哪一种确实很重要。

一种可能的解决方案是实现图遍历算法(例如深度优先搜索),并选择包含起始边的最长循环。

The algorithm / code from the accepted answer does not work for complex special cases, when the plane intersects some vertices of a concave surface. In this case "walking" the edge-face connectivity graph greedily could close some of the polygons before time.

What happens is, that because the plane intersects a vertex, at one point when walking the graph there are two possibilities for the next edge, and it does matter which one is chosen.

A possible solution is to implement a graph traversal algorithm (for instance depth-first search), and choose the longest loop which contains the starting edge.

旧街凉风 2024-10-18 09:02:47

看起来您想使用一些检测或霍夫变换将交点组合回连接的图形。

更简单、更可靠的方法是不仅立即获取交叉点,还立即获取 3D 身体的轮廓(平面切割它的位置)。

要在三角形网格给定的主体上构造轮廓,请将每个网格顶点中的值定义为等于距平面的有符号距离(平面一侧为正值,另一侧为负值)。 isovalue=0 的行进方块算法可以是用于提取轮廓线段:

行进三角形

即使平面穿过网格的顶点或边,该算法也能正常工作。

为了更好地了解平面部分的结果,请观看这​​个简短的视频< /a>.通过那里的链接,人们也可以找到实现。

It looks like you wanted to combine intersection points back into connected figures using some detection or Hough Transform.

Much simpler and more robust way is to immediately get not just intersection points, but contours of 3D body, where the plane cuts it.

To construct contours on the body given by triangular mesh, define the value in each mesh vertex equal to signed distance from the plane (positive on one side of the plane and negative on the other side). The marching squares algorithm for isovalue=0 can be then applied to extract the segments of the contours:

Marching triangles

This algorithm works well even when the plane passes through a vertex or an edge of the mesh.

To better understand what is the result of plane section, please take a look at this short video. Following the links there, one can find the implementation as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文