pythongoogle-colaboratoryopen3d

open3d.geometry function does not work in my local environment but works in Google Colab


I am using open3d to process 3D data, but the following code does not produce any output in my local environment. There is no error output, but no result is printed either. Interestingly, the same code works perfectly fine in Google Colab.

import open3d as o3d
import numpy as np

# Rotation angle (in radians)
rotation_angle = np.pi / 4  # 45 degrees

# Rotation axis (normalized)
rotation_axis = np.array([0, 0, 1], dtype=float)  # z-axis
rotation_axis /= np.linalg.norm(rotation_axis)  # Normalize

# Rotation vector in axis-angle form
rotation_vector = rotation_angle * rotation_axis

# Generate the rotation matrix
R = o3d.geometry.get_rotation_matrix_from_axis_angle(rotation_vector)
print("Rotation matrix:\n", R)

I have confirmed that the rotation_vector is being calculated correctly.

Here are some details about my local environment:

open3d version: 0.18.0 Python version: 3.10.11

I have tried the following without success:

Reinstalling open3d Verifying that open3d is up-to-date Could someone help me understand why this behavior is occurring?


Solution

  • The changes to make Open3D with numpy version 2.x has been recently merged. You can either downgrade numpy version to use 1.x or use latest development builds. Version 0.18 or less wont work well with numpy 2.x.