Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/345.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将Kinect深度转换为png(python)_Python_Png_Point Cloud Library_Depth - Fatal编程技术网

将Kinect深度转换为png(python)

将Kinect深度转换为png(python),python,png,point-cloud-library,depth,Python,Png,Point Cloud Library,Depth,我试图验证分割算法,因此我需要一些好的数据。我想使用纽约大学深度V2数据集()。现在我想用点云库png2pcd方法创建一些pcd数据。但我需要一个颜色和深度的图像。彩色的没有问题,但深度保存为“以米为单位的浮动”。所以基本上是这样的价值观: [2.75201321 2.75206947 2.75221062 有没有可能将这些值保存在png文件中,而不在python中进行缩放?如果您想提取1449标记数据集的NYUv2子集,以下转换将起作用。我不确定原始深度值,因为我也有类似的问题,但我的深度值范

我试图验证分割算法,因此我需要一些好的数据。我想使用纽约大学深度V2数据集()。现在我想用点云库png2pcd方法创建一些pcd数据。但我需要一个颜色和深度的图像。彩色的没有问题,但深度保存为“以米为单位的浮动”。所以基本上是这样的价值观:

[2.75201321 2.75206947 2.75221062


有没有可能将这些值保存在png文件中,而不在python中进行缩放?

如果您想提取1449标记数据集的NYUv2子集,以下转换将起作用。我不确定原始深度值,因为我也有类似的问题,但我的深度值范围为0-2047。您知道一些保存方法吗这个是.png格式的吗

    for i, (image, depth) in enumerate(zip(f['images'], f['depths'])):
    print("SHAPE::", np.shape(image), np.shape(depth), np.max(depth),np.min(depth))
    ra_image = image.transpose(2, 1, 0)
    ra_depth = depth.transpose(1, 0)
    re_depth = (ra_depth/np.max(ra_depth))*255.0
    print("AFTER--", np.shape(image), np.shape(depth), np.max(re_depth), np.min(re_depth))
    image_pil = Image.fromarray(np.uint8(ra_image))
    depth_pil = Image.fromarray(np.uint8(re_depth))
    image_name = os.path.join("data", "nyu_datasets", "%05d.jpg" % (i))
    # image_pil.save(image_name)
    depth_name = os.path.join("data", "nyu_datasets", "%05d.png" % (i))
    # depth_pil.save(depth_name)

如果您询问提取1449标记数据集的NYUv2子集,以下转换将起作用。我不确定原始深度值,因为我也有类似问题,但我的深度值范围为0-2047。您知道如何将其保存为.png格式吗

    for i, (image, depth) in enumerate(zip(f['images'], f['depths'])):
    print("SHAPE::", np.shape(image), np.shape(depth), np.max(depth),np.min(depth))
    ra_image = image.transpose(2, 1, 0)
    ra_depth = depth.transpose(1, 0)
    re_depth = (ra_depth/np.max(ra_depth))*255.0
    print("AFTER--", np.shape(image), np.shape(depth), np.max(re_depth), np.min(re_depth))
    image_pil = Image.fromarray(np.uint8(ra_image))
    depth_pil = Image.fromarray(np.uint8(re_depth))
    image_name = os.path.join("data", "nyu_datasets", "%05d.jpg" % (i))
    # image_pil.save(image_name)
    depth_name = os.path.join("data", "nyu_datasets", "%05d.png" % (i))
    # depth_pil.save(depth_name)
是的。在OpenCV python中:

depthMap = numpy.array([your depth value array])
cv2.imwrite('xxx.png', depthMap)
是的。在OpenCV python中:

depthMap = numpy.array([your depth value array])
cv2.imwrite('xxx.png', depthMap)