【问题标题】:What is the Argument Type for get_view_control.rotate() in Open3D?Open3D 中 get_view_control.rotate() 的参数类型是什么?
【发布时间】: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


    【解决方案1】:

    Open3D Docs 的示例中我知道(另请参见this link),get_view_control.rotate() 采用 4 个参数:xyxoyo,它们都是以度为单位的浮点值。

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

    【讨论】:

    • 你是什么意思,以度为单位的浮点值?对我来说,当我使用ctr.rotate(90,0,0,0) 时,它会转动几度(围绕 y 轴)。使用ctr.rotate(2100,0,0,0) 时,它几乎转了一圈(360°)。自从提出问题以来还没有修复它。
    猜你喜欢
    • 2022-12-12
    • 2017-02-12
    • 2019-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多