-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 distance in python #9939
Comments
Hi @Karin-Sugi Your code looks fine to me, so I am not sure why it is erroring. Does the error still occur if you specifically define width and height as being int values? dist = depth.get_distance(int(width/2), int(height/2)) |
Hi @MartyG-RealSense Your code did work!! I could get the data. Thanks. On the other hand, in my search, some people use depth_scale * depth_frame to get distance data. What is the difference between them? |
The camera produces raw pixel depth values in a format called uint16_t. Multiplying the uint16_t value by the depth unit scale of the camera provides a distance value in meters. For example, the default depth scale of the 400 Series cameras is 0.001 (meters). If the raw uint16_t pixel depth value was 4500 then multiplying it by a depth unit scale of 0.001 would give 4500 x 0.001 = 4.5 (meters distance). depth.get_distance though is an alternative way to obtain the distance in meters without having to use the above 'uint16_t x depth scale' formula. There is a discussion at #7264 where the two methods are compared. |
Hi @Karin-Sugi Do you require further assistance with this case, please? Thanks! |
Thanks for your assistance!! |
You are very welcome, @Karin-Sugi - thanks for the update! |
Hi, i'm trying to get distance with realsense D435i in python. However, i could find little python example codes which get distance data, not image.
Now, I got an error saying
I think this supported argument type is not what i mean...
I know it's too basic question, but can any one tell me how to get distance of the point (x,y) or get distance of all the frame in python??
I put my code below as well.
The text was updated successfully, but these errors were encountered: