Open3d: Image and depth to RGBD, Image has unrecognized bytes_per_channel.

Created on 10 Sep 2018  路  12Comments  路  Source: intel-isl/Open3D

Hey,
I am trying to open an image and its depth to a rgbd image using Open3D, but I face the error

[CreateRGBDImageFromColorAndDepth] Unsupported image format.
Color image : 0x0, with 0 channels.
Depth image : 0x0, with 0 channels.
Use numpy.asarray to access buffer data.
terminate called after throwing an instance of 'std::runtime_error'
  what():  Image has unrecognized bytes_per_channel.

I tried to open it using the read function of Open3D or opening it in a numpy array before giving it to open3D but the same error pops up. What I do is the following :

color_raw = img.open("./08_54_36_127/rgb_8UC3.png")
color_raw = np.asarray(color_raw)

depth_raw = img.open("./08_54_36_127/depth_16UC1.png")
depth_raw = np.asarray(depth_raw)

image = Image( (color_raw).astype(np.float32))
depth = Image( (depth_raw).astype(np.float32))

rgbd_image = create_rgbd_image_from_color_and_depth(image,depth)

I can open and see the images using matplotlib before transforming them in the open3D and after.

Any idea ?

Ubuntu 16.04
compiled from source

possible bug

Most helpful comment

Oh ok indeed now the depth aligned and scale to the RGB, it is read correctly.
Thanks a lot for the help.

All 12 comments

Can you upload the files to dropbox and share them here?

https://www.dropbox.com/sh/djpqres4knf30m3/AAA6KsxwvJ_GTaLjn6jLJflaa?dl=0
Here the link to the Data.
I coded the transformation from depth to point cloud myself, and it seems to be working, but would prefer to have the RGBD to pointcloud feature of Open3D.

BTW I changed the "astype" type as uint.

@syncle I know you are on vacation, but I need you to help me on this, :)

Hi @lelouedec, you don't have to explicitly change the type. Can you try something like

    color_raw = read_image("../../TestData/RGBD/color/00000.jpg")
    depth_raw = read_image("../../TestData/RGBD/depth/00000.png")
    rgbd_image = create_rgbd_image_from_color_and_depth(
        color_raw, depth_raw);

Hi @syncle, thank you for your help.
I tried what you said an got

    depth_raw = read_image(SB_file_depth)
    color_raw = read_image(SB_file_color)
    print("images read")
    rgbd_image = create_rgbd_image_from_color_and_depth(color_raw, depth_raw);

images read
[CreateRGBDImageFromColorAndDepth] Unsupported image format.

Can you check the color image is: 8bit 1channel or 8bit 3channel, and depth image is: 16bit 1channel image? By default Open3D regard value 1000 in depth image as 1000mm, or 1m.

The depth image is indeed 16bit and its values are 1000 = 1m.
And the color image is 8 bit 3channels
Images informations

Depth :
{'greyscale': True, 'alpha': False, 'planes': 1, 'bitdepth': 16, 'interlace': 0, 'size': (1280, 720)}

Color :
{'greyscale': False, 'alpha': False, 'planes': 3, 'bitdepth': 8, 'interlace': 0, 'size': (1920, 1080)}

Aha, depth and color images should be aligned and in the same image size. Can you align your color and depth image and try again?

Oh ok indeed now the depth aligned and scale to the RGB, it is read correctly.
Thanks a lot for the help.

@lelouedec Hi! Could you share your method to aligned the depth and color images in the same image size?

@syncle Hi syncle. I am having an issue regarding Volumetric Reconstruction using codes provided in open3d documentation. Error is -- [Open3D ERROR] [ScalableTSDFVolume::Integrate] Unsupported image format.

Depth Dataset Prop - {560 * 400 | Bit Depth- 24 | File size(appx.)- 258KB}
Image Dataset Prop - {560 * 400 | Bit Depth- 24 |File size(appx.)- 330KB}

All images and depth are in .png format and aligned properly.
The code is throwing traceback error.
Can I get a solution at the earliest.

@syncle Hi, I am trying to capture depth and color image from point cloud and the convert image to point cloud, The method is work when i pass directly open3d image and depth but when i use convert_to_intensity = False i can not use directly open3d image and depth and I have to save image and depth image and then pass the to creat_rgbd_from_color_and_depth which give me low quality point cloud data? any suggestion? thank you very much in advance

Was this page helpful?
0 / 5 - 0 ratings