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

PointCloud interoperability between cupoch and Open3D #130

Open
dlzou opened this issue Aug 29, 2024 · 0 comments
Open

PointCloud interoperability between cupoch and Open3D #130

dlzou opened this issue Aug 29, 2024 · 0 comments

Comments

@dlzou
Copy link

dlzou commented Aug 29, 2024

Firstly, thanks for the effort put into this great library!

I have some Python code that uses cupoch for ICP registration. Afterward, it calls get_information_matrix from Open3D API. Currently, the code does this to convert from cupoch.geometry.PointCloud to open3d.geometry.PointCloud:

import cupoch as cph
import open3d as o3d

...

cloud_A = cph.geometry.PointCloud()
cloud_B = cph.geometry.PointCloud()
cloud_A.points = cph.utility.Vector3fVector(pts_A)
cloud_B.points = cph.utility.Vector3fVector(pts_B)

tfB2A = cph.registration.registration_icp(
    cloud_B,
    cloud_A,
    ...
)

# Conversion
cloud_A_cpu = o3d.geometry.PointCloud()
cloud_B_cpu = o3d.geometry.PointCloud()
pts_A_cpu = np.asarray(cloud_A.points.cpu()).astype(float, copy=False)
cloud_A_cpu.points = o3d.utility.Vector3dVector(pts_A_cpu)
pts_B_cpu = np.asarray(cloud_B.points.cpu()).astype(float, copy=False)
cloud_B_cpu.points = o3d.utility.Vector3dVector(pts_B_cpu)

information_icp = (
    o3d.pipelines.registration.get_information_matrix_from_point_clouds(
        cloud_B_cpu,
        cloud_A_cpu,
        INFORMATION_MATRIX_CORRESPONDENCE_DISTANCE,
        tfB2A,
    )
)

From timing the section commented as "Conversion" I suspect it's doing some unnecessary copying. Is there a faster way to do this conversion?

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

1 participant