Open3D icon indicating copy to clipboard operation
Open3D copied to clipboard

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

Open ghost opened this issue 7 years ago • 17 comments

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)

ghost avatar Jun 15 '19 06:06 ghost

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

nikhilkoditala avatar Jun 18 '19 05:06 nikhilkoditala

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

ghost avatar Jun 18 '19 05:06 ghost

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

nikhilkoditala avatar Jun 19 '19 04:06 nikhilkoditala

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

ghost avatar Jun 19 '19 11:06 ghost

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

nikhilkoditala avatar Jun 19 '19 11:06 nikhilkoditala

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

ghost avatar Jun 19 '19 11:06 ghost

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.

nikhilkoditala avatar Jun 19 '19 11:06 nikhilkoditala

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

ghost avatar Jun 19 '19 11:06 ghost

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

nikhilkoditala avatar Jun 19 '19 11:06 nikhilkoditala

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

ghost avatar Jun 19 '19 11:06 ghost

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.

4rtemi5 avatar Jun 27 '19 06:06 4rtemi5

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 avatar Jul 03 '19 04:07 Resays

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

ghost avatar Jul 03 '19 11:07 ghost

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.

neel112358 avatar Jul 25 '19 09:07 neel112358

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

  • master branch's docs at: http://www.open3d.org/docs/latest/
  • 0.7.0 docs: http://www.open3d.org/docs/release/
  • 0.6.0 docs: http://www.open3d.org/docs/0.6.0/

yxlao avatar Jul 25 '19 22:07 yxlao

from open3d.open3d.geometry import create_rgbd_image_from_color_and_depth

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

ChambinLee avatar Jul 30 '20 09:07 ChambinLee

the problem is with the dimension it should be same

like if your color image = 640x720 and depth image = 640x720 -----------------> No error

if your color image = 640x720 and depth image = 720x640 -------> error if your color image = 640x720 and depth image = 720x640 -------> error

ashishsingh2210 avatar Sep 08 '21 08:09 ashishsingh2210