从 3d 数组获取边界信息
嘿,我目前正在尝试从 3d 数组中提取信息,其中每个条目代表一个坐标,以便从中绘制一些内容。问题是数组大得离谱(而且有几个),这意味着我实际上无法绘制所有数组。
那么我想要完成的只是绘制外部坐标的表示,如果您愿意的话,可以是数组的外壳。该数组未满,可能具有仅设置几个像素的较大空白空间,或者具有分组在一起的大量像素数据簇。我不知道需要什么样的形状(可能是一个简单的立方体,或者一个复杂的凹面网格),并且正在努力想出一种有效提取边界的算法。该数组有效地存储 3d 空间中的一组点。
我想到创建 6 个 2d 网格(3d 数组的每一侧各一个),并获取每个位置可以找到的最浅点,然后分别绘制它们。然而,正如我所说,这个 3D 形状可能是凹的,这会给这种方法带来问题。想象一个顶部有一个圆的圆锥体(该圆比圆锥体的底部大)。虽然顶部和侧面网格会从形状中获得正确的深度信息,但底部网格会通过垂直线将底座连接到圆圈,使我有效地松开圆锥形状。
然后我想到逐片分析数组,并从切片数据创建 2 个网格。我相信这应该适用于任何类型的形状,但是我正在努力寻找一种算法来准确地为我提供每个切片的边界信息。再说一遍,如果您只是尝试从切片创建高度图,如果它们有任何凹陷,您就会遇到问题。我还通过了某种边缘跟踪算法,但是该数组不提供连续数据,并且几乎可以肯定沿着每个切片没有连续边缘。
我尝试研究医学成像等领域使用的体积渲染,因为它处理与我遇到的类似的问题,但找不到任何我可以使用的东西。
如果有人对此类问题有任何经验,或者有任何宝贵的意见,请给我指出正确的方向。
PS 我更喜欢获得外壳的封闭表示,因此是我之前的 2d 网格方法。然而,一种只给我外壳点的方法,它们之间没有任何联系,这仍然非常有帮助。
谢谢你, 泽
Hey, I'm currently trying to extract information from a 3d array, where each entry represents a coordinate in order to draw something out of it. The problem is that the array is ridiculously large (and there are several of them) meaning I can't actually draw all of it.
What I'm trying to accomplish then, is just to draw a representation of the outside coordinates, a shell of the array if you'd like. This array is not full, can have large empty spaces with only a few pixels set, or have large clusters of pixel data grouped together. I do not know what kind of shape to expect (could be a simple cube, or a complex concave mesh), and am struggling to come up with an algorithm to effectively extract the border. This array effectively stores a set of points in a 3d space.
I thought of creating 6 2d meshes (one for each side of the 3d array), and getting the shallowest point they can find for each position, and then drawing them separetly. As I said however, this 3d shape could be concave, which creates problems with this approach. Imagine a cone with a circle on top (said circle bigger than the cone's base). While the top and side meshes would get the correct depth info out of the shape, the bottom mesh would connect the base to the circle through vertical lines, making me effectivelly loose the conical shape.
Then I thought of annalysing the array slice by slice, and creating 2 meshes from the slice data. I believe this should work for any type of shape, however I'm struggling to find an algorithm which accuratly gives me the border info for each slice. Once again, if you just try to create height maps from the slices, you will run into problems if they have any concavities. I also throught of some sort of edge tracking algorithm, but the array does not provide continuous data, and there is almost certainly not a continuous edge along each slice.
I tried looking into volume rendering, as used in medical imaging and such, as it deals with similar problems to the one I have, but couldn't really find anything that I could use.
If anyone has any experience with this sort of problem, or any valuable input, could you please point me in the right direction.
P.S. I would prefer to get a closed representation of the shell, thus my earlier 2d mesh approach. However, an approach that simply gives me the shell points, without any connection between them, that would still be extremely helpful.
Thank you,
Ze
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我将首先检查您的数据结构。正如您所观察到的,该数组不维护点之间任何明显的空间关系。八叉树是您所描述的数据的一个很好的表示。根据点集的复杂性,您也许可以仅使用八叉树找到地壳 - 假设您在附近点之间有一些连接。
或者,您可以转向更严格的算法,例如光线投射或行进立方体。
I would start by reviewing your data structure. As you observed, the array does not maintain any obvious spatial relationships between points. An octree is a pretty good representation for data like you described. Depending upon the complexity of you point set, you may be able to find the crust using just the octree - assuming you have some connectivity between near points.
Alternatively, you may then turn to more rigorous algorithms like raycasting or marching cubes.
我猜,现在对您真正有用有点晚了,但作为参考,我想说这是体积建模的完美场景(正如您自己猜测的那样)。只要您知道点云的边界框,您就可以将这些坐标映射到体素空间并增加每个数据点的每个体素的密度(值)。完全定义体积后,您可以使用行进立方体算法来生成 3D 表面给定阈值(iso 值)的网格。所得到的表面不需要是连续的,但会包裹所有值 > 的体素。内部等值。 2D 等效项是热图...您可以通过调整iso阈值(越高意味着越紧)和体素分辨率。
由于您使用的是 Java,因此您可能想看看我的 有毒libsvolumeutils 库,它还附带 几个示例(对于处理)显示一般方法...
Guess, it's a bit late by now to be truly useful to you, but for reference I'd say this is a perfect scenario for volumetric modeling (as you guessed yourself). As long as you know the bounding box of your point cloud, you can map these coordinates to a voxel space and increase the density (value) of each voxel for each data point. Once you have your volume fully defined, you can then use the Marching cubes algorithm to produce a 3D surface mesh for a given threshold value (iso value). That resulting surface doesn't need to be continuous, but will wrap all voxels with values > isovalue inside. The 2D equivalent are heatmaps... You can refine the surface quality by adjusting the iso threshold (higher means tighter) and voxel resolution.
Since you're using Java, you might like to take a look at my toxiclibs volumeutils library, which also comes with sevaral examples (for Processing) showing the general approach...
即使像这样简单的示例也无法手动重建,更不用说通过算法了。您的数据代表具有圆锥形孔的圆柱体的可能性与代表顶部附有圆盘的圆锥体的顶点的可能性一样。
同样,如果没有关于如何生成数据的更多信息,以立方体形式排列的 8 个顶点也可能代表 2 个交叉的正方形。如果您知道数据是由以下生成的,则例如,某种旋转 3D 扫描仪,那么这至少是一个开始。
Even an example as simple as this would be impossible to reconstruct manually, let alone algorithmically. The possibility of your data representing a cylinder with a cone shaped hole is as likely as the vertices representing a cone with a disk attached to the top.
Again, without further information on how the data was generated, 8 vertices arranged in the form of a cube might as well represent 2 crossed squares. If you knew that the data was generated by, for example, a rotating 3d scanner of some sort then that would at least be a start.