-
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 do I get the angle between the camera and a pixel point in an aligned frame? #9297
Comments
Hi @ydixon The links below discuss methods of using mathematics to obtain the angle of an object observed by a RealSense camera. |
Thanks for the links @MartyG-RealSense.
By this formula, if my object is in the middle of the screen. The angle will be zero. |
In another case where the camera was mounted in an elevated position and tilted downwards towards objects on the floor instead of facing straight ahead, a RealSense user provided the following advice: "If the floor and camera plane is parallel, then the depth should be same. The depth calculated through stereo disparity always gives perpendicular distance to camera plane. So it won't matter if the pixel is at the center or at the edge of the image". |
Sorry, I'm confused after reading the comment and the thread. I don't understand how it's related to my question. My goal is to find for any pixel point in the depth frame, it's distance from the ground (height), given that I know the exact height of the camera. I have the depth value (distance from camera) for a point. If I have the camera's angle to the object, I can calculate the object's height by trig rules. After reading the formula above from the link you shared, I wanted to point out a counter example. So I used center pixel as example. If my camera is 2 meter height above the ground, tilted downward. For #6800 (comment) |
The intention of the quote was to highlight some of the complexities of the maths that can be involved in performing calculations from the elevated and tilted camera perspective that you are using. The online calculator in the link below for finding the height of an object by providing distance and angle may be helpful in developing a calculation. https://www.calctool.org/CALC/math/trigonometry/height This page states: "The height of an object is calculated by measuring the distance from the object and the angle of elevation of the top of the object. The tangent of the angle is the object height divided by the distance from the object. Thus, the height is found". As an example, providing the calculator with an angle of 36 degrees and a distance from the object of 2 meters resulted in a calculated height for the object of 1.45309 meters. I believe that if you wanted to measure in the opposite direction (diagonally downwards from a point elevated above the object instead of diagonally upwards from the ground), you could subtract '180' from the angle - for example so that 36 degrees becomes -144 degrees. Or alternatively, 216 degrees (36+180). Checking this method in the online calculator, 216 degrees angle and 2 meters distance to object also resulted in an object height of 1.45309 meters. More information on the maths of angle to height conversion can be found by googling for convert angle to height |
Thanks for the detailed response. I've reread the threads and rethink about it again. In the #5553, it's calculating only the angle of pixel from the camera, from the camera perspective. If I use the angles from above directly, it won't be right, since I didn't include the angle of camera tilted downward. So do I have to measure the angle tilted when I setup the camera and combine the angle(Theta_v) from FOV to get the real theta? |
I'm not quite sure what it means when you say the camera is looking straight ahead. We have a d435 attached to ceiling, slightly tilted downward roughly around 45 degrees. When you mention "straight ahead", do you mean the camera direction is parallel to the floor or it's always aiming toward the object? A sample use case, would be trying to detect the height(distance from ground) of the person's head |
I meant that the calctool online calculator likely makes the assumption that the viewpoint is pointing straight ahead and that if you were to use a similar height calculation formula with your RealSense camera then tilting the camera probably would not have much impact on the final calculated object height. |
Hi @ydixon Do you require further assistance with this case, please? Thanks! |
Hi @MartyG-RealSense. I ended up using a different approach. Thank you for your assistance! Btw, the point cloud on the floor(flat ground) looks curvey / wavey. Is there any built-in functionality to deal with it? |
Hi @ydixon That's great to hear that you found a solution that worked for you! Regarding the waviness of the point cloud, moving the camera further back from the floor may reduce waviness. If that is not possible, you could try using the Medium Density camera configuration preset to sharpen curved / blobby edges. You can test this quicky by selecting Medium Density from the drop-down selector in the options side-panel of the RealSense Viewer. If the preset does not resolve your waviness problem then a discussion in the link below (and the list of cases at the bottom of that discussion) look at the phenomenon of 'ghost noise' that can cause waviness. |
Which RealSense SDK version are you experiencing the preset-changing error in, please? |
Hi @ydixon Do you require further assistance with this case, please? Thanks! |
@MartyG-RealSense Sorry, I wasn't able to get remote access to the machine till now. I can't find the installer. It should be 2.16.2? |
SDK version 2.16.2 is very old, dating from October 2018. The current version at the time of writing this is 2.48.0. https://github.com/IntelRealSense/librealsense/releases/tag/v2.48.0 If you wish to use 2.48.0 and you have a Windows computer then you can use an automated installer file in the Assets file list at the bottom of the version information listing. Otherwise, if you are using Linux then you can either build the latest SDK from Debian packages: https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md Or you can build the SDK from source code, also available in the Assets list. https://github.com/IntelRealSense/librealsense/blob/master/doc/installation.md Use of special instructions will be required if you are using a Raspberry Pi or Nvidia Jetson board. |
@MartyG-RealSense Thank you. Closing the issue. |
Hello, I'm newbie with camera maths and configuration. My goal is find a object's height (distance from ground), knowing the camera height. I was thinking I could probably calculate it if I can obtain the angle between the camera and the object with triangle rules.
I have Hc, the height of the camera. Do, distance of the object given by aligned depth frame.
I'm trying to find Ho in the diagram. Is there a method to achieve this?
The text was updated successfully, but these errors were encountered: