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

point cloud reconstruction from time of flight camera depth image #23

Open
Baehn opened this issue Aug 11, 2024 · 1 comment
Open

point cloud reconstruction from time of flight camera depth image #23

Baehn opened this issue Aug 11, 2024 · 1 comment

Comments

@Baehn
Copy link

Baehn commented Aug 11, 2024

I have a time of flight camera, that is I get a depth image as raw data from my camera, after calibration, is mrcal.unprocject the supposed way to compute the corresponding point cloud, e.g. like this?:

import numpy as np
import mrcal

model = mrcal.cameramodel(filename)
depth_image = ...  # load depth image
width, height = depth_image.shape
x, y = np.mgrid[0:width, 0:height]
points = np.stack((x, y), axis=-1).reshape(-1, 2)
upts = mrcal.unproject(points, *model.intrinsics(), normalize=True)

points_3d = (upts.T * depth_image.flatten()).T
@dkogan
Copy link
Owner

dkogan commented Aug 13, 2024

From a high-level, that's right: you mrcal.unproject() to get directions, and scale them up with the ranges. If it doesn't work, tell me.

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