1

如Open3D的文档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()

那么任何人都可以解释转动一定程度的正确值/类型吗?还是有另一种/更好的方法来做到这一点?提前致谢!如果有什么不清楚的,请询问:)

4

1 回答 1

0

正如我从Open3D Docs中的示例(另请参见此链接)中知道的那样,get_view_control.rotate() 采用 4 个参数:xyxoyo,它们都是以度为单位的浮点值。

当然这个答案来得太晚了,可以扩展,也许你可以告诉我们你学到了什么!

于 2021-06-09T13:54:21.753 回答