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

Why depth is divided by 5000 in slambook2/ch7/pose_estimation_3d2d.cpp in PnP Code implemantation? #53

Open
fettahyildizz opened this issue Feb 3, 2022 · 5 comments

Comments

@fettahyildizz
Copy link

In order to find 3d feature points coordinates in world, we divide depth by 5000. What is the reason for that? What are the units of 3d coordinates (mm, cm, m) ? I want to implement PnP algorithm using Intel RealSense D435 but I am not sure how much it should be divided by?

@nicolasrosa
Copy link
Collaborator

If I remember, this value is the conversion value between the depth values (float, metric) and the values saved on the PNG (16-bits, int, [0, 65535]) from TUM Dataset.

@fettahyildizz
Copy link
Author

I have a depth value int, milimeter. When the point is 1 meter away from camera, it gives me 1000 depth value. What kind of conversion do I need?
@nicolasrosa

@nicolasrosa
Copy link
Collaborator

nicolasrosa commented Feb 4, 2022

Was this the value read directly from the 16-bit png image? In your case, I believe you already are in the metric system, I can do the calculation in millimeters if you want. I would not recommend that for numeric reasons (avoid calculation with large numbers).

Just pay attention during the conversion process of pixel coordinates to metric coordinates. Besides, always check the units of the calibration parameters of the dataset you are using.

The following link may help you.

https://vision.in.tum.de/data/datasets/rgbd-dataset/file_formats

@gaoxiang12
Copy link
Owner

@fettahyildizz
The depth unit of the example picture used in our book is 5000 so we should divide the depth reading by 5000 here. The image is from TUM rgb-d dataset, which is captured by Kinect 1.
Most of the rgb-d cameras have depth unit settings in their API/SDK, and most of them use 1000 as the depth unit. I'm not sure the exact unit of RealSense, please check its datasheet or documents.

@fettahyildizz
Copy link
Author

@nicolasrosa @gaoxiang12 Thanks for such a quick response. I am really grateful for your effort.
After dividing by 1000, my 3dpoints vector holds values for 3d coordinates in meter unit. For example if a point is 1 meter away from camera and point is in same x and y plane from camera, it gives me [0, 0, 1] point, which I assume this value is correct for calculations.

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

3 participants