I am learning Open3D 0.18.0 from the documentation, and I copied and pasted the code from the website. But the code is not working. The point clouds are visualized fine. But if I perform any operations on them, like transforms, paint, etc., I am getting the error [Done] exited with code=3221225477. Also, the function ‘o3d.visualization.draw_geometries’ is not working when I pass camera parameters to it.
Here is the code:
import open3d as o3d
import numpy as np
import matplotlib.pyplot as plt
import os
import sys
def draw_registration_result(source, target, transformation):
#source_temp = copy.deep_copy(source)
#target_temp = copy.deepcopy(target)
source.paint_uniform_color([1, 0.706, 0])
target.paint_uniform_color([0, 0.651, 0.929])
#source.transform(transformation)
o3d.visualization.draw_geometries([source, target])
def preprocess_point_cloud(pcd, voxel_size):
print(":: Downsample with a voxel size %.3f." % voxel_size)
pcd_down = pcd.voxel_down_sample(voxel_size = voxel_size)
radius_normal = voxel_size * 2
radius_feature = voxel_size * 5
print(":: Estimate normal with search radius %.3f." % radius_normal)
pcd_down.estimate_normals(o3d.geometry.KDTreeSearchParamHybrid(radius = radius_normal, max_nn = 30))
print(":: Compute FPFH feature with search radius %.3f." % radius_feature)
pcd_fpfh = o3d.pipelines.registration.compute_fpfh_feature(pcd_down,
o3d.geometry.KDTreeSearchParamHybrid(radius = radius_feature, max_nn = 100))
return pcd_down, pcd_fpfh
def prepare_dataset(voxel_size):
print(":: Load two point clouds and disturb initial pose.")
demo_icp_pcds = o3d.data.DemoICPPointClouds()
source = o3d.io.read_point_cloud(demo_icp_pcds.paths[0])
target = o3d.io.read_point_cloud(demo_icp_pcds.paths[1])
transformation = np.asarray([[0.0, 0.0, 1.0, 0.0], [1.0, 0.0, 0.0, 0.0],
[0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 0.0, 1.0]])
source.transform(transformation)
draw_registration_result(source, target, np.identity(4))
source_down, source_fpfh = preprocess_point_cloud(source, voxel_size)
target_down, target_fpfh = preprocess_point_cloud(target, voxel_size)
return source, target, source_down, target_down, source_fpfh, target_fpfh
voxel_size = 0.05
source, target, source_down, target_down, source_fpfh, target_fpfh = prepare_dataset(voxel_size)
As soon as I comment all the following lines:
source.transform(transformation)
source.paint_uniform_color([1, 0.706, 0])
target.paint_uniform_color([0, 0.651, 0.929])
The code works and the point clouds are visualized. But the code shows the same error if I uncomment any one of the lines.
In VS code I am getting the following error:
[Running] python -u "d:pythonOpen3DPractice.py"
:: Load two point clouds and disturb initial pose.
[Done] exited with code=3221225477 in 2.787 seconds
Here is the system, open3d and python information:
`- Operating system: Windows 10 64-bit
- Python version: Python 3.11.9 / output from
import sys; print(sys.version)
- Open3D version: output from python:
print(open3d.__version__)
- System architecture: x64-based processor
- Is this a remote workstation?: no
- Open3D installation method?: pip`
I tried to run the code in virtual environment but still it didn’t worked. The same lines when I commented them then the code started to work. Also I tried different installation commands but still the problem was same. Here are the commands:
pip install open3d
pip3 install open3d
pip install --user open3d
Abhishek Mahato is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.