【发布时间】:2020-09-15 19:26:39
【问题描述】:
如 Open3D 的documentation 所示,您可以使用get_view_control.rotate() 函数来旋转查看器内的对象。但它没有指定类型(度数、弧度等)。如果我使用 2100 左右的值,它看起来像一个完整的转弯,但是在将它们放入循环之后,事实证明这不是转弯 360 度 的确切值。我也没有在 Open3D 的文档中看到任何地方提到它。
我想以不同的角度拍摄 360 度 (x,y,z) 的深度图像。这是我的一段代码:
class Viewer:
def __init__(self, on, of, fd): #objectname, objectFile and folderdirectory
self.index = 0
self.objectName = on
self.objectFile = of
self.folderDirectory = fd
self.vis = o3d.visualization.Visualizer()
self.view = o3d.visualization.ViewControl()
self.pcd = o3d.io.read_triangle_mesh(self.folderDirectory + self.objectFile)
def depthFullCapture(self, times):
self.numberOfTimes = times
def captureDepth(vis):
print('Capturing')
self.depth = vis.capture_depth_float_buffer(False)
plt.imsave((self.folderDirectory + 'images/' + self.objectName + '_{:05d}.png'.format(self.index)),np.asarray(self.depth), dpi = 1)
np.savetxt((self.folderDirectory + 'text/' + self.objectName + '_{:05d}.txt'.format(self.index)),self.depth,fmt='%.2f',delimiter=',')
vis.register_animation_callback(rotate)
def rotate(vis):
print('Rotating')
ctr = vis.get_view_control()
if(self.index % 25 == 0):
self.vis.reset_view_point(True)
ctr.rotate(0,((2100/25)*(self.index/25)))
else:
ctr.rotate(84, 0)
ctr.set_zoom(0.75)
self.index += 1
if not (self.index == 625):
vis.register_animation_callback(captureDepth)
else:
vis.register_animation_callback(None)
vis.destroy_window()
self.vis.create_window(width = 200, height = 200)
self.vis.add_geometry(self.pcd)
self.vis.register_animation_callback(captureDepth)
self.vis.run()
那么任何人都可以解释转动某个角度的正确值/类型吗?还是有另一种/更好的方法来做到这一点?提前致谢!有什么不清楚的请追问:)
【问题讨论】:
标签: python python-3.x arguments open3d