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

Depth map and intrinsic #25

Closed
jzhzhang opened this issue Dec 7, 2021 · 9 comments
Closed

Depth map and intrinsic #25

jzhzhang opened this issue Dec 7, 2021 · 9 comments

Comments

@jzhzhang
Copy link

jzhzhang commented Dec 7, 2021

Thanks for your amazing dataset!

I encountered some weird results (as shown below) when planning to back project the depth map to generate the point cloud. The intrinsic matrix is obtained by @liuyuan in issue#4, and the depth map is directly from the car/106_12650_23736/depths/frame000001.jpg.geometric.png. It seems the intrinsic matrix is not related to the depth map.

Can you give me some quick advice or references?

GIF 2021-12-7 20-52-01

@jzhzhang
Copy link
Author

jzhzhang commented Dec 8, 2021

The vaule of the depth map car/106_12650_23736/depths/frame000001.jpg.geometric.png range from [16490-22649], which indicates the camera center is far from the object.

The color map of the depth (scaled by 1e-3):
Screenshot from 2021-12-07 18-47-25

@davnov134
Copy link
Contributor

Hi, we provide tooling for operating with the depth maps loaded using the Co3DDataset object.
Specifically, this function

point_cloud = get_rgbd_point_cloud(
contains an example of loading depth maps and converting to point clouds. Can you try to use it to unproject your depth maps? There are few more examples in /tests/test_dataset_visualize.py

@jzhzhang
Copy link
Author

jzhzhang commented Dec 8, 2021

Thanks. I will follow the scripts and let you know how it turns out.

@jzhzhang
Copy link
Author

@colesbury Sorry to bother you agiain. I want to know some details about the depth maps.

Do the depth maps directly come from the COLMAP? Have you made any post-processing modifications to the depth maps?

@jzhzhang
Copy link
Author

I guess i found the resaon why the depth map is not working.

The depth value in the depth maps should be loaded as 16 bit float number. The same as the _load_16bit_depth

def _load_16big_png_depth(depth_png):

This is how it looks:
snapshot00

@AlexisStdp
Copy link

I guess i found the resaon why the depth map is not working.

The depth value in the depth maps should be loaded as 16 bit float number. The same as the _load_16bit_depth

def _load_16big_png_depth(depth_png):

This is how it looks: snapshot00

Hello, this projection is exactly what I need in my current project. However I didn't fully understand how you obtained it, I tried quite a few provided functions in this repository but it's a bit unclear how to use them. Please, could you tell us what steps you followed and which functions you used to get this nice point cloud?

For example, loading depth as 16 bit had a similar result as your first projection.

@shapovalov
Copy link
Contributor

@AlexisStdp Did you use the provided function to load depth? Please note the files are not a standard 16-bit PNG; the function reinterprets binary 16-bit values as floats.

@AlexisStdp
Copy link

@shapovalov Thank you very much for your answer! I indeed used some of the provided functions to load depth, and to load RGB image. And some functions to get the frame_annotations.
Ideally if I could have the following setting it would be perfect: given an RGB image and a depth image (and the .jgz annotations), we load RGB and depth, we get the intrinsic (and maybe scale adjustment), and we backproject to get the partial point cloud.

In the provided code, it seems that the function "get_rgbd_point_cloud" is exactly that, but I'm unfortunately unable to make it work because I'm not sure how to get the argument "camera: CamerasBase" (is there a simple way I could get it?).
There is a function "get_co3d_sequence_pointcloud" which I tried to use in order to get this "camera" (because it itself uses "get_rgdp_point_cloud"), but inside of it the Dataloader didn't work for various reasons.

Is there maybe an alternative approach? - I tried using open3d for example but this gives me a "flat" point cloud (where all points seem to lie on a 2D plane).

Thanks in advance, and happy new year!

@shapovalov
Copy link
Contributor

@AlexisStdp Co3dDataset should load the data in the required format. In particular, frame_data.camera is in PyTorch3D format, which should be compatible with get_rgbd_point_cloud. If that does not work for you, could you share more details?

If you want to dig deeper, this is the code that reads the Cameras object: https://github.com/facebookresearch/co3d/blob/main/dataset/co3d_dataset.py#L490

Note that the camera is in NDC coordinate system. Please refer to PyTorch3D documentation for details: https://pytorch3d.org/docs/cameras

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

4 participants