isl-org / Open3D

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

failed to load jpg and png file #460

Closed wzx16 closed 6 years ago

wzx16 commented 6 years ago

I use opencv2's imwrite function to save color and depth image, the depth image is CV_16UC1 and color image is CV_8UC4. My environment is python3.6

After I run the sample rgbd-redwood with replaced file path. open3d shows: [CreateRGBDImageFromColorAndDepth] Unsupported image format. RGBDImage of size Color image : 0x0, with 0 channels. Depth image : 0x0, with 0 channels. Use numpy.asarray to access buffer data.

Could you please help me fix this?

syncle commented 6 years ago

Can you share one pair of image? Let me quick check.

wzx16 commented 6 years ago

00000 00000

Here they are, I don't know will they be compressed.

syncle commented 6 years ago

This is not because of image format.

color_raw = read_image("color.jpg")
depth_raw = read_image("depth.png")
print(color_raw)
print(depth_raw)

Outputs

Image of size 1920x1080, with 3 channels.
Use numpy.asarray to access buffer data.
Image of size 512x424, with 1 channels.
Use numpy.asarray to access buffer data.

The issue arose from create_rgbd_image_from_color_and_depth because it only takes color and depth image that are in same size. This issue is actually duplicate of #44.

wzx16 commented 6 years ago

I saw #44, thank you.

wzx16 commented 6 years ago

So, if I have 1080p color image and 424p depth image, should I resize color image to 424p or crop a 424p image from the original one?

syncle commented 6 years ago

Actually, color and depth cameras need to be calibrated, and need to be aligned in the same image domain. It will be not just cropping or resizing, but like mapping pixels to new domain using extrinsic/intrinsic calibration information. Aligning color and depth image domain is necessary for some applications: reconstruction system and color map optimization and so on.

Most of the depth sensor API shall provide this functionality, and you don't have to do it by yourself. Please check with your depth camera API.

wzx16 commented 6 years ago

Thank you!

syncle commented 6 years ago

Good to hear. Let me close this issue. Please open again if necessary.