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
Expected behavior
The RGBD image to be returned from the function called.
Environment (please complete the following information):
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)
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:
0.7.0), use open3d.geometry.PointCloud.create_from_rgbd_image. See here.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/from open3d.open3d.geometry import create_rgbd_image_from_color_and_depth
thanks!!!
I solved this problem on my pc by your idea.👍
Most helpful comment
It depends on the Open3D version:
0.7.0), useopen3d.geometry.PointCloud.create_from_rgbd_image. See here.0.7.0or before, useopen3d.geometry.create_point_cloud_from_rgbd_image. See here.In general, you can get
masterbranch's docs at: http://www.open3d.org/docs/latest/0.7.0docs: http://www.open3d.org/docs/release/0.6.0docs: http://www.open3d.org/docs/0.6.0/