isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
11.43k stars 2.31k forks source link

colored ICP registration error #1649

Closed FelipeDelgadoR closed 2 years ago

FelipeDelgadoR commented 4 years ago

Hello everyone, I'm trying to execute the colored icp registration example with Open3D 0.8.0 The only thing that has changed is the source and target point clouds but right after the script is over I get this

3-1. Downsample with a voxel size 0.04
3-2. Estimate normal.
3-3. Applying colored point cloud registration

Process finished with exit code -1073741819 (0xC0000005)

I'm wondering if the voxel size is something that I have to change, but I've been trying with a lot of values with no results...

Thanks in advance!

syncle commented 4 years ago

Consider the scale of your point cloud - 0.04 voxel downsampling and normal estimation is all related to the scale of the input point cloud. The example code assumes point set is in metric scale (1 means 1m).

FelipeDelgadoR commented 4 years ago

One thing that I've just realized is that the point cloud that I'm using has no color information! I didn't noticed at first because I got a "complete point cloud" with color information, and then I crop the point cloud and I was "allegedly" saving the color and normals information from the point cloud, but I've just realized that I'm actually not saving this information, my script looks like this:

`points = np.asarray(point_cloud.points) # Converts the point cloud information into an array

indices_to_keep = []  # Creates array of the points that we need
for i, p in enumerate(points):
    d = np.sum((p - center) ** 2)  # Distance between the point and the center
    if d < radius ** 2:  # If the point it's inside the radius...
        indices_to_keep.append(i)  # ... keep it

# Keep the listed indices
point_cloud.points = o3d.utility.Vector3dVector(points[indices_to_keep, :])
if point_cloud.has_colors():
    point_cloud.colors = o3d.utility.Vector3dVector(np.asarray(point_cloud.colors)[indices_to_keep, :])
if point_cloud.has_normals():
    point_cloud.normals = o3d.utility.Vector3dVector(np.asarray(point_cloud.normals)[indices_to_keep, :])`

but the function has_colors and has_normals always returns False for some reason... any idea on how to do this?

theNded commented 2 years ago

has_colors and has_normals assert that they are of the same length as the points. In your case you have changed points in-place, so they are inconsistent with the colors and normals, resulting in False. I would recommend constructing new point cloud instead of modifying in-place.