Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempted to run rgbd_odometry.py but got segmentation fault #7070

Open
3 tasks done
sankalpkallakuri opened this issue Nov 22, 2024 · 2 comments
Open
3 tasks done

Attempted to run rgbd_odometry.py but got segmentation fault #7070

sankalpkallakuri opened this issue Nov 22, 2024 · 2 comments
Labels
bug Not a build issue, this is likely a bug.

Comments

@sankalpkallakuri
Copy link

Checklist

Describe the issue

I have been trying to run the rgbd_odometry example but ran into segmentation fault. The culprit function seems to be
target_pcd = o3d.geometry.PointCloud.create_from_rgbd_image(target_rgbd_image,pinhole_camera_intrinsic)
I have tried with the default as well as custom images. I have tried with custom images of 3channel RGB and 1 channel depth. Please advise.

Steps to reproduce the bug

import open3d as o3d

redwood_rgbd = o3d.data.SampleRedwoodRGBDImages()

pinhole_camera_intrinsic = o3d.io.read_pinhole_camera_intrinsic(
    redwood_rgbd.camera_intrinsic_path)
print(pinhole_camera_intrinsic.intrinsic_matrix)
source_color = o3d.io.read_image(redwood_rgbd.color_paths[0])
source_depth = o3d.io.read_image(redwood_rgbd.depth_paths[0])
target_color = o3d.io.read_image(redwood_rgbd.color_paths[1])
target_depth = o3d.io.read_image(redwood_rgbd.depth_paths[1])
source_rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(
    source_color, source_depth)
target_rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(
    target_color, target_depth)
target_pcd = o3d.geometry.PointCloud.create_from_rgbd_image(
    target_rgbd_image, pinhole_camera_intrinsic)

option = o3d.pipelines.odometry.OdometryOption()
odo_init = np.identity(4)
print(option)

[success_color_term, trans_color_term,
 info] = o3d.pipelines.odometry.compute_rgbd_odometry(
     source_rgbd_image, target_rgbd_image, pinhole_camera_intrinsic, odo_init,
     o3d.pipelines.odometry.RGBDOdometryJacobianFromColorTerm(), option)
[success_hybrid_term, trans_hybrid_term,
 info] = o3d.pipelines.odometry.compute_rgbd_odometry(
     source_rgbd_image, target_rgbd_image, pinhole_camera_intrinsic, odo_init,
     o3d.pipelines.odometry.RGBDOdometryJacobianFromHybridTerm(), option)

if success_color_term:
    print("Using RGB-D Odometry")
    print(trans_color_term)
    source_pcd_color_term = o3d.geometry.PointCloud.create_from_rgbd_image(
        source_rgbd_image, pinhole_camera_intrinsic)
    source_pcd_color_term.transform(trans_color_term)
    o3d.visualization.draw_geometries([target_pcd, source_pcd_color_term],
                                      zoom=0.48,
                                      front=[0.0999, -0.1787, -0.9788],
                                      lookat=[0.0345, -0.0937, 1.8033],
                                      up=[-0.0067, -0.9838, 0.1790])
if success_hybrid_term:
    print("Using Hybrid RGB-D Odometry")
    print(trans_hybrid_term)
    source_pcd_hybrid_term = o3d.geometry.PointCloud.create_from_rgbd_image(
        source_rgbd_image, pinhole_camera_intrinsic)
    source_pcd_hybrid_term.transform(trans_hybrid_term)
    o3d.visualization.draw_geometries([target_pcd, source_pcd_hybrid_term],
                                      zoom=0.48,
                                      front=[0.0999, -0.1787, -0.9788],
                                      lookat=[0.0345, -0.0937, 1.8033],
                                      up=[-0.0067, -0.9838, 0.1790])

Error message

python3.10 rgbd_odometry1.py
[[525. 0. 319.5]
[ 0. 525. 239.5]
[ 0. 0. 1. ]]
Segmentation fault (core dumped)

Expected behavior

No response

Open3D, Python and System information

- Operating system: Ubuntu 22.04
- Python version: Python 3.8 
- Open3D version: output from python: 0.18.0
- System architecture: x86 
- Is this a remote workstation?: no
- How did you install Open3D?: pip

Additional information

No response

@sankalpkallakuri sankalpkallakuri added the bug Not a build issue, this is likely a bug. label Nov 22, 2024
@rxba
Copy link
Contributor

rxba commented Nov 22, 2024

This could be related to #6874 . Are you using numpy>=2.0.0? If so try downgrading it to e.g. 1.26.4, or using the current development wheels or a build from source of Open3D.

@sankalpkallakuri
Copy link
Author

Thanks the issue was resolved after downgrading numpy to 1.26.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not a build issue, this is likely a bug.
Projects
None yet
Development

No branches or pull requests

2 participants