0
$\begingroup$

Rosanswers logo

Hi,

I am using deep learning to detect an object and after I got the detection work, I made boxes around this object and I calculated the mid point of the box. Now I want to measure the distance and the angle between the camera and the mid point of the box around the object. I manged to get the coordinates of the mid point x,y in a frame but still don't know to calculate the distance and bearing. Thanks for advance. ps: I am using realsense camera D435.

Jad


Originally posted by Jad on ROS Answers with karma: 75 on 2018-08-15

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You should be able to find this information with a tangent function. With the pose of the camera and pose of the box in some global, identical frame (could even be camera frame) you can use the change in Y and change in X to pull out the azimuth angle if you're looking for 2D. You can use the change in Z as well to pull out azimuth and elevation angles.

It sounds like you already have distance, so that's a good start!


Originally posted by stevemacenski with karma: 8272 on 2018-08-15

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Jad on 2018-08-16:
Thanks ! . Yes I got the distance so now I can measure the distance but need to figure out how to get the angle. I will try to apply what you have said. :)

Comment by stevemacenski on 2018-08-16:
Awesome, can you mark the answer as correct then to close it out for maintainers?

Comment by Delbina on 2022-08-05:
@Jad, hi, would you please share your code with me as wwll? i have the same problem, get the distance and bearing of the nearest object

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.