Log in or register to post comments

The distance from the trackable to the camera

May 19, 2020 - 6:28pm #1

Hi,

 

I am new to Vuforia so I started with the SampleApplication in Android with Java. What I am trying to achieve is to recognize some object and compute the position of the object to the camera. Like how far is this object to the device. 

 

When I looked into the code for the SampleApplication.Object Reco, I see that it renders a bounding box on the object in scene and the size of the box is changing when the object moves away from the camera. I notice that the App uses the getPose() API on the trackableResult and get a modelViewMatrix. But I couldn't fully understand the math behind the scene and figure out how to compute the distance. My idea is that if I can get the size of the object on screen, combinded with the size of the object in database, I can know the difference in distance.

 

Thank you in advance for any help.

 

 

The distance from the trackable to the camera

May 24, 2020 - 2:47pm #3

I am not too familiar with the pipeline of OpenGL and the math of modelViewMatrix. Is there a straighforward way to compute the distance from the tracked object to the camera given the size of the object?

Or it does not have to accurate, something close or calibrated result should be fine..

The distance from the trackable to the camera

May 22, 2020 - 2:27am #2

Hi,

Here is more information regarding the camera projection Matrix: https://library.vuforia.com/content/vuforia-library/en/articles/Solution/Working-with-the-Camera.html#How-To-Use-the-Camera-Projection-Matrix

Thank you.

Vuforia Engine Support

Log in or register to post comments