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

How to get absolute depth values for each pixel? #38

Open
anilesec opened this issue Jan 3, 2024 · 3 comments
Open

How to get absolute depth values for each pixel? #38

anilesec opened this issue Jan 3, 2024 · 3 comments

Comments

@anilesec
Copy link

anilesec commented Jan 3, 2024

Hello,

Provided depth images "aligned_depth_to_color_xxxxxx.png" is float32 type. Is it possible to obtain absolute depth values in the camera coordinate frame?

The values of the in-depth image range from 0.0 to 1.0. Are they normalized? How to unnormalize to obtain the absolute depth values for each pixel?

Thanks in advance!

@ychao-nvidia
Copy link
Collaborator

You can look at the examples in the Visualizing Sequences section, where we convert the depth images into point clouds. See here and here for getting the depth values in meters in the camera frame.

As mentioned above, depth values are in meters, not normalized.

@anilesec
Copy link
Author

anilesec commented Jan 4, 2024

Thanks, @ychao-nvidia for the response. I looked in the visualization code

depth = cv2.imread(depth_file, cv2.IMREAD_ANYDEPTH) --> gives depth values in 0-65535 range (uint16) and,

depth = depth.astype(np.float32) / 1000. --> gives depth values in 0-65.535 range (float32). Since you are dividing by 1000, this indicates that the raw depth is in mm(millimetres).

After performing the above operation, if I compute average depth values over all pixels, I get around 2.97 meters and a max of 65.35 meters. This seems unrealistic for the sequence.

@ychao-nvidia
Copy link
Collaborator

All your interpretation is correct. Depth from RealSense could be noisy and unreliable when it is beyond certain distance, so I won't trust the depth readings there. 65535 (mm) is just the upper bound of depth.

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