Log in or register to post comments

I am getting distance fine but values as cm?, millimeters? which format

August 13, 2012 - 7:14am #1

Hi 

 i am able to getting distance but that values are too big, is that values in pixel format, or millimeeters or  ?

 

regards

Nagaraju

I am getting distance fine but values as cm?

August 15, 2012 - 9:01am #7

This is something that you'll have to develop your own calculations for, but it's relatively easy. The scene units are defined using the width value that you provide to the TMS when creating your trackable. So if you have a target that's 10cm wide and define the trackable width as 10, then your scene unit is equivalent to a cm for that target. If you define the trackable width using another unit, such as pixels, you'll need to determine the conversion between pixels and cm for a given target - which would be pixel_width / 10 in this example. 

 

from my comments below..

To get the real-world distance of the device from the target you would need to know the printed size of the target. Then you could find the ratio between the defined width of the target and the printed width of the target and use this as a multiplier for the distance. Note that Vuforia has no way of determining the real-world size of the target it is tracking. A 10 inch-wide target and a 5 inch-wide target might track equally well, and look identical to the tracker when the device is moved so the target fills the screen.

distance fine but values as cm?, millimeters?

August 14, 2012 - 11:17pm #6

thanx

but i need real world distance not in scene units, so can you past finding real world distance code please.

 

regards

Nagaraju

distance fine but values as cm?, millimeters?

August 14, 2012 - 11:17pm #5

thanx

but i need real world distance not in scene units, so can you past finding real world distance code please.

 

regards

Nagaraju

I am getting distance fine but values as cm?

August 14, 2012 - 8:51am #4

Here you go ..

#include <math.h>;  
...
 
QCAR::Matrix34F pose = trackable->getPose();
QCAR::Vec3F position(pose.data[3], pose.data[7], pose.data[11]);
float distance = sqrt(position.data[0] * position.data[0] + position.data[1] * position.data[1] + position.data[2] * position.data[2]);

LOG("distance: %f", distance);

getting distance fine but values as cm?, millimeters?

August 14, 2012 - 2:40am #3

Can you past that code dude, finding distance with realworld values

I am getting distance fine but values as cm

August 13, 2012 - 10:19am #2

When calculating distance from the pose data, your result will be in scene units which are established by the value that you define for the width of your target.

To get the real-world distance of the device from the target you would need to know the printed size of the target. Then you could find the ratio between the defined width of the target and the printed width of the target and use this as a multiplier for the distance. Note that Vuforia has no way of determining the real-world size of the target it is tracking. A 10 inch-wide target and a 5 inch-wide target might track equally well, and look identical to the tracker when the device is moved so the target fills the screen.

Log in or register to post comments