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

Deformable Registration on downsampled point cloud cannot be applied on original point cloud with different size #86

Closed
AkeelMedina22 opened this issue Jul 20, 2023 · 2 comments

Comments

@AkeelMedina22
Copy link

Describe the bug
When using DeformableRegistration and registering on a downsampled point cloud, I want to apply the registration parameters on the much larger, original point cloud. This works for Rigid and Affine registration, but not for Deformable.

To Reproduce

def cpd(target_pcd, source_pcd, downsample):
    down_t = o3d.geometry.PointCloud()
    down_s = o3d.geometry.PointCloud()

    down_t.points = o3d.utility.Vector3dVector(np.asarray(target_pcd.points)[np.random.randint(len(np.asarray(target_pcd.points)), size=downsample)][:,:])
    down_s.points = o3d.utility.Vector3dVector(np.asarray(source_pcd.points)[np.random.randint(len(np.asarray(source_pcd.points)), size=downsample)][:,:])

    reg = DeformableRegistration(X=np.asarray(
        down_t.points), Y=np.asarray(down_s.points))

    reg.register()

    points = reg.transform_point_cloud(Y=np.asarray(source_pcd.points))

    deformed_pcd = o3d.geometry.PointCloud()
    deformed_pcd.points = o3d.utility.Vector3dVector(points[:, 0:3])
    return deformed_pcd

And the error is:

line 68, in transform_point_cloud
    return Y + np.dot(self.G, self.W)
ValueError: operands could not be broadcast together with shapes (155201,3) (2500,3)

It says in the comments of the source code "Best for predicting on new points not used to run initial registration", so how can I do this? Any advice for now would be appreciated.

@gattia
Copy link
Collaborator

gattia commented Jul 20, 2023

Below link is a link to an example that uses deformable registration on a subset of the points.

If you’ve installed using pip it might be that pop doesn’t have the latest version. Try installing from source.

https://github.com/siavashk/pycpd/blob/master/examples/fish_deformable_3D_register_with_subset_of_points.py

@AkeelMedina22
Copy link
Author

This worked, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants