【问题标题】:Coverting point cloud data (.ply) into a range image将点云数据 (.play) 转换为范围图像
【发布时间】:2021-04-13 06:44:17
【问题描述】:

我有一个带有 XYZ 数据的点云,我已经使用 pyntcloud 读取了 .ply 文件并将其转换为一个 numpy 数组 (553181,3)

我想转换点云,例如成一个 800x600x3 的矩阵,该矩阵也可以被视为 RGB 图像。为此,我将 XY 坐标缩放到 [0,800] 和 [0,600] 范围。

到目前为止 ->

  1. 我已将 x 和 y 坐标标准化为 (0,800) 和 (0,600) 的范围
  2. 我创建了大小为 800 和 600 的数据仓,并存储了各自的 x 和 y 坐标点
  3. 我不知道如何映射这些点以获得范围图像

我是 python 新手,非常感谢您的帮助和指导

【问题讨论】:

    标签: python image range point-clouds


    【解决方案1】:

    我不明白您如何处理 2d 图像中的 3d 点云。如果您有 RGB 数据,您可以使用任何方式使用open3d 来可视化您的点云并将其存储在 .xyzrgb 文件中,这似乎您没有,因为您将文件转换为具有 3 列必须为 x 的 NumPy 数组, y 和 z 值。因此,您可能需要 RGB 值或为点云提供随机值。一个很好的方法是使用pptk,它允许您在点云上生成 RGB 颜色并在内置查看器上渲染图像(屏幕截图)(我认为这是您需要的)。

    一个简单的工作流程可能是这样的:

    import pptk 
    xyz = pptk.rand(100, 3) #generates a 3dimensions array or it could be a 
                            #numpy array - your (553181,3) array
    v = pptk.viewer(xyz)
    rgb = pptk.rand(100, 3) #same here, must be same size as what you used
    
    #or you can create a single random color of the shape you need
    import random
    r = np.full(shape=100, fill_value=random.randint(1,255))
    g = np.full(shape=100, fill_value=random.randint(1,255))
    b = np.full(shape=100, fill_value=random.randint(1,255))
    rgb = np.dstack((r,g,b))
    colors = rgb/256  #you are going to need to convert the values in 
                      #0-1 interval
    
    v.attributes(colors)
    v.capture('screenshot.png')
    

    也许您想阅读此massive-3d-point-clouds-visualization-in-python。它或多或少地描述了我在我制作的示例中的内容,这只是其中的“简短形式”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-09-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-08
      • 2017-04-02
      相关资源
      最近更新 更多