isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
11.37k stars 2.29k forks source link

Image and depth to RGBD, Image has unrecognized bytes_per_channel. #544

Closed lelouedec closed 6 years ago

lelouedec commented 6 years ago

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

qianyizh commented 6 years ago

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

lelouedec commented 6 years ago

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.

qianyizh commented 6 years ago

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

syncle commented 6 years ago

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);
lelouedec commented 6 years ago

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.

syncle commented 6 years ago

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.

lelouedec commented 6 years ago

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)}

syncle commented 6 years ago

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?

lelouedec commented 6 years ago

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

Magicyu-2015 commented 5 years ago

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

Sumit564 commented 4 years ago

@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.

SMohammadi89 commented 4 years ago

@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

pratheeka171 commented 3 years ago

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.

Hi, @lelouedec @lelouedec

Could you please share the transformation from depth to point cloud. I have some doubts regarding the input of camera intrinsic parameters to point cloud transformation so it will be of great help.

thanks in advance

sagartyagi2003 commented 1 year ago

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

how did you do that can you show code snippet please

Sumit564 commented 1 year ago

Dear concerned, Your issue is resolved right? I would be unable to share my code snippet as this is something novel. I can guide you for your bugs. Regards,

On Sun, Jun 25, 2023 at 11:51 PM sagartyagi2003 @.***> wrote:

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

how did you do that can you show code snippet please

— Reply to this email directly, view it on GitHub https://github.com/isl-org/Open3D/issues/544#issuecomment-1606210050, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJS5HOAXMHTWROHULYP75YLXNB6TRANCNFSM4FUGLVHQ . You are receiving this because you commented.Message ID: @.***>

-- Regards, Dr. Sumit Hazra, B.Tech (CSE), M.Tech (CSE), PhD (CSE, NIT Rourkela), Assistant Professor, Computer Science & Engineering Department, KL University, Hyderabad (Aziznagar campus). Contact:(+91)9830770461.