Open3d: open3d.open3d.geometry.RGBDImage has no attribute "create_from_color_and_depth"

Created on 15 Jun 2019  ·  16Comments  ·  Source: intel-isl/Open3D

IMPORTANT: Please use the following template to report the bug.


Describe the bug
Hi! I tried to create an RGBD image using a depth and color image using the open3d.geometry.RGBDImage.create_from_color_and_depth() method. But when I try to run this program it shows the following error:

AttributeError: type object 'open3d.open3d.geometry.RGBDImage' has no attribute 'create_from_color_and_depth'

To Reproduce

  1. cd program_dir
  2. python3 trial.py
  3. AttributeError: type object 'open3d.open3d.geometry.RGBDImage' has no attribute 'create_from_color_and_depth'

Expected behavior
The RGBD image to be returned from the function called.

Environment (please complete the following information):

  • OS: Ubuntu 18.04 LTS
  • Python version: 3.6.7
  • Open3D version: 0.6.0.0
  • Is this remote workstation?: yes
  • How did you install Open3D?: pip

EDIT
The script is as shown below:

from poseEstimation import pose_estimation
import open3d

def read_rgbd_image(color, depth):
color_image = open3d.io.read_image(color)
depth_image = open3d.io.read_image(depth)

rgbd_image = open3d.geometry.RGBDImage.create_from_color_and_depth(color_image, depth_image, depth_scale = 1000.0, depth_trunc = 3.0, convert_rgbd_to_intensity = False)

return rgbd_image

if __name__ == "__main__":

intrinsic = open3d.io.read_pinhole_camera_intrinsic("dataset/camera_intrinsic.json")
source_image = read_rgbd_image("dataset/color/000000.jpg " , "dataset/depth/000000.png ")
target_image = read_rgbd_image("dataset/color/000001.jpg " , "dataset/depth/000001.png ")

success, odo_init = pose_estimation(source_image, target_image, intrinsic)

print(odo_init)
possible bug

Most helpful comment

It depends on the Open3D version:

  • In current master (after 0.7.0), use open3d.geometry.PointCloud.create_from_rgbd_image. See here.
  • In 0.7.0 or before, use open3d.geometry.create_point_cloud_from_rgbd_image. See here.

In general, you can get

All 16 comments

Hey Abhijay, I am also facing the same issue. Did you find any fix?

@nikhilkoditala. The method works if you call it using create_rgbd_image_from_color_and_depth(). But there are issues with that too.

@abhijaysingh Instead of pip if we install from source I think these errors will not be there.

@nikhilkoditala I compiled from source but I continue to face the issue. Did it work for you?

Ya it's working for me now. Did you uninstall the pip version before compiling from source.

@nikhilkoditala Yes, I did. Some warnings popped up when I was compiling from source.

warning: inline declaration of ‘void pybind11::pybind11_fail(const string&)’ follows declaration with attribute noinline [-Wattributes]

I think you can ignore that warning.
If you have python 2 and 3 running in your system, while running cmake command did you use this argument(-DPYTHON_EXECUTABLE) to set your target python path.

I removed python 2 because I was encountering this problem but the issue is still there.

Then i think it should work, if possible try running the cmake command again with the above argument
and make sure you use sudo before make commands

Okay, it worked. I'll close this issue now. Thank you @nikhilkoditala

I was able to solve this in the conda version with:
from open3d.open3d.geometry import create_rgbd_image_from_color_and_depth
and by removing open3d.geometry.RGBDImage.

Hope it helps somebody.

I'm using this code:

import open3d as o3d
import matplotlib.pyplot as plt
from open3d.open3d.geometry import create_rgbd_image_from_color_and_dept

if __name__ == "__main__":
    print("Read Redwood dataset")
    color_raw = o3d.io.read_image("00000.jpg")
    depth_raw = o3d.io.read_image("00000.png")
    rgbd_image = create_rgbd_image_from_color_and_depth(color_raw, depth_raw)
    print(rgbd_image)

    plt.subplot(1, 2, 1)
    plt.title('Redwood grayscale image')
    plt.imshow(rgbd_image.color)
    plt.subplot(1, 2, 2)
    plt.title('Redwood depth image')
    plt.imshow(rgbd_image.depth)
    plt.show()

    pcd = o3d.geometry.PointCloud.create_from_rgbd_image(
        rgbd_image,
        o3d.camera.PinholeCameraIntrinsic(
            o3d.camera.PinholeCameraIntrinsicParameters.PrimeSenseDefault))
    # Flip it, otherwise the pointcloud will be upside down
    pcd.transform([[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]])
    o3d.visualization.draw_geometries([pcd])

and Now I'm getting this error:

AttributeError: type object 'open3d.open3d.geometry.PointCloud' has no attribute 'create_from_rgbd_image'

What should I do ? is there any solution?

@Resays
AttributeError: type object 'open3d.open3d.geometry.PointCloud' has no attribute 'create_from_rgbd_image'

Try it out with this -
open3d.geometry.create_point_cloud_from_rgbd_image(image, intrinsic, extrinsic=(with default value))

I was able to solve this in the conda version with:
from open3d.open3d.geometry import create_rgbd_image_from_color_and_depth
and by removing open3d.geometry.RGBDImage.

Hope it helps somebody.

This seems to have worked for me when I installed it from pip as well.
Go to the make_fragments file and edit the existing "create_from_rgbd_image" function to "create_rgbd_image_from_color_and_depth" after import said file.

It depends on the Open3D version:

  • In current master (after 0.7.0), use open3d.geometry.PointCloud.create_from_rgbd_image. See here.
  • In 0.7.0 or before, use open3d.geometry.create_point_cloud_from_rgbd_image. See here.

In general, you can get

from open3d.open3d.geometry import create_rgbd_image_from_color_and_depth

thanks!!!
I solved this problem on my pc by your idea.👍

Was this page helpful?
0 / 5 - 0 ratings