我们有一张ZMap (也就是深度图)图片,是用激光和相机进行三维三角测量得到的。我们知道每个像素的深度值和相机的分辨率(每个像素与一个以毫米为单位的3d坐标相关联)。我们的目标是将Zmap可视化为一个2d表面,所以我们想创建一个点云,生成一个网格,并用一些3D库显示它。我们认为vtk可能是正确的选择,但我们遇到了一些问题。
首先,我们尝试了无组织结构(vtkPolyData),通过3dDalaunay三角剖分生成网格。但是当点数小于50k时,代码可以正常工作。我们的三维重建是由480k个点组成的,计算时间实在太长了。
然后我们切换到有组织(point with connections)。这个额外的信息应该会减少创建网格的计算时间,但是我们不能理解如何创建一个"vtkStructuredGrid“,并用我们的Z值给它提供一个2D网格曲面。
这是正确的做法吗?有没有人从来没有试过?
提前感谢
发布于 2015-09-29 15:17:04
如果您的点是在2D格网中组织的(扫描时),则不需要复杂且缓慢的三角测量算法
- something like this:
- 
- the grey squares are the points
- so point `x,y` axises are parallel to table/grid `u,v` indexes
- if your data is not yet organized in this manner then sort the points so it does
- store in something like: `double pnt[maxU][maxV][3];`
- in case `x,y` are directly aligned to grid then you need to store just the Z coordinate to spare some memory
- in 3D scanned pointcloud organized like this is easy
- just join together all neighboring points with Z coordinate difference smaller then treshold
- the colored point squares in my image
- the gray points are the background out of range Z coordinates now
- so add structure like: `int obj[maxU][maxV];`
- set all background/out of range points as obj[u][v]=-1;
- set the rest with unique obj index like `(u*maxV+v)`
- now process each line and if points near have near Z coordinate reindex one of them (so object is growing)
- when done process all lines and try to merge reindex adjacen objects
- loop until no merge ocur
- this is way faster then flood-fill based segmentation (if used proper speed up structures for the line merging)
- process the tab quad by quad
- if all 4 points belong to same object from segmentation add quad to mesh
- if just 3 add the triangle (4 combinations)
- if 1 or 2 do not add anything
- the result is the colored areas
https://stackoverflow.com/questions/32829340
复制相似问题