将凸包转换为二元掩模
我想生成一个二进制掩码,其中 1 表示内部的所有体素,0 表示体积外部的所有体素。体积由一组 3D 坐标周围的凸包定义(<100;一些坐标位于体积内部)。
我可以使用 CONVHULLN 获得凸包,但是如何将其转换为二进制掩码?
如果没有好的方法可以通过凸包,您还有其他想法如何创建二进制掩码吗?
I want to generate a binary mask that has ones for all voxels inside and zeros for all voxels outside a volume. The volume is defined by the convex hull around a set of 3D coordinates (<100; some of the coordinates are inside the volume).
I can get the convex hull using CONVHULLN, but how do I convert that into a binary mask?
In case there is no good way to go via the convex hull, do you have any other idea how I could create the binary mask?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用 DelaunayTri 解决此问题类 和pointLocation方法。下面是一个示例:
上面的示例为跨越单位体积(每个维度为 0 到 1)的 101×101×101 网格创建了一个逻辑掩码,凸包内的网格点为 1(真) 3-D 点集。
You can solve this problem using the DelaunayTri class and the pointLocation method. Here's an example:
The above example creates a logical mask for a 101-by-101-by-101 mesh spanning the unit volume (0 to 1 in each dimension), with a 1 (true) for the mesh points inside the convex hull of the 3-D point set.
现在已经很晚了,所以只有一个非常粗略的建议:
我预计这会非常慢,并且有更好的解决方案,如果有一个出现在我的梦想中,我明天会再次发布。
It's late here, so only a very sketchy suggestion:
I expect that this will be very slow, and that there are better solutions, if one comes in my dreams I'll post again tomorrow.
这是扫描转换问题。查看 3D 的第 8 节基于体素的图形的扫描转换算法。
您想要的算法是可靠的算法,并且稍微简单一些,因为您正在对一个面为三角形的凸多面体进行体素化 - 每个“体素”运行都以两个三角形为界。
This is a scan conversion problem. Check out section 8 of 3D Scan-Conversion Algorithms for Voxel-Based Graphics.
The algorithm you want is the solid one, and is slightly simpler since you are voxelizing a convex polyhedron whose faces are triangles - each "voxel" run is bounded by two triangles.