Log in or register to post comments

The proper way to get the coordinates of a position on a tracker

November 19, 2012 - 1:40am #5

Hello, everyone!

I 'd like to know,

is it easy to realize the following effect?

1.A tracker big enough to be a platform;

2.several smaller trackers with different 3D object attached;

3.when the smaller trackers appear in fixed positions on the big tracker(platform),the 3d Object attached will give a reaction.

To do this, I need a "if then" to judge if the coordinates of the smaller tracker realative to the platform is within the fixed position, 

so is there a way to return  the coordinates of a tracker realative to another? and what's the measuring unit, cm, mm or others?

can any kinds of trackers(image, frame, etc) do this?

Looking forward to your replies!

 

The proper way to get the coordinates of a position on a tracker

November 19, 2012 - 3:48am #4

Hi,

first thing: I don't know if that fits your app use case entirely, but you may want to have a look at the MultiTargets sample of Vuforia sample distribution;

there you can specify multiple ImageTargets positioned and oriented with respect to a common reference frame (also have a look at the DevGuide and PAI reference for further information on the MultiTargets feature);

otherwise, more specifically on your questions:

1- about returning the coordinates of one trackable with respect to another:
technically this can be done with a few Matrix operations:
knowing that each trackable Pose represents the tranfromation from the tracker reference frame to the camera reference frame, you can write some code similar to the following:

 QCAR::Matrix44F trackable1_to_camera = QCAR::Tool::convertPose2GLMatrix( trackable1->getPose() );

 QCAR::Matrix44F trackable2_to_camera = QCAR::Tool::convertPose2GLMatrix( trackable2->getPose() );

 //compute the camera_to_trackable1 matrix by inverting the trackable1_to_camera

 QCAR::Matrix44F camera_to_trackable1 = SampleMath::Matrix44FInverse ( trackable1_to_camera );

  //here we compute the relative pose of trackable2 with respect to the trackable1 reference frame
 QCAR::Matrix44F trackable2_to_trackable1 = trackable2_to_camera * camera_to_trackable1;
      

Note that you can then extract the position part (if you are not interested in the orientation) from the matrix via this code:

float x = matrix.data[12];
float y = matrix.data[13];
float z = matrix.data[14];

2- About the unit of measure, that's just the unit that you choose implicitly when you set the targets size (for instance in the ImageTargets sample that's in millimeteres as the size of targets in the DataSet xml is specified in millimieters with the assumption that you print the target on an A4 paper)

Of course, the above can work equally well with Markers and ImageTargets, as they are all "Trackables" in the end.

The proper way to get the coordinates of a position on a tracker

November 19, 2012 - 8:19pm #3

AlessandroB wrote:

Hi,

first thing: I don't know if that fits your app use case entirely, but you may want to have a look at the MultiTargets sample of Vuforia sample distribution;

there you can specify multiple ImageTargets positioned and oriented with respect to a common reference frame (also have a look at the DevGuide and PAI reference for further information on the MultiTargets feature);

otherwise, more specifically on your questions:

1- about returning the coordinates of one trackable with respect to another:
technically this can be done with a few Matrix operations:
knowing that each trackable Pose represents the tranfromation from the tracker reference frame to the camera reference frame, you can write some code similar to the following:

 QCAR::Matrix44F trackable1_to_camera = QCAR::Tool::convertPose2GLMatrix( trackable1->getPose() );

 QCAR::Matrix44F trackable2_to_camera = QCAR::Tool::convertPose2GLMatrix( trackable2->getPose() );

 //compute the camera_to_trackable1 matrix by inverting the trackable1_to_camera

 QCAR::Matrix44F camera_to_trackable1 = SampleMath::Matrix44FInverse ( trackable1_to_camera );

  //here we compute the relative pose of trackable2 with respect to the trackable1 reference frame
 QCAR::Matrix44F trackable2_to_trackable1 = trackable2_to_camera * camera_to_trackable1;
      

Note that you can then extract the position part (if you are not interested in the orientation) from the matrix via this code:

float x = matrix.data[12];
float y = matrix.data[13];
float z = matrix.data[14];

2- About the unit of measure, that's just the unit that you choose implicitly when you set the targets size (for instance in the ImageTargets sample that's in millimeteres as the size of targets in the DataSet xml is specified in millimieters with the assumption that you print the target on an A4 paper)

Of course, the above can work equally well with Markers and ImageTargets, as they are all "Trackables" in the end.

Thank you very much, for your detailed explanation

and I'm glad to know it's possible,  I will try it in my app!

The proper way to get the coordinates of a position on a tracker

November 20, 2012 - 12:58am #2

You're welcome. If you have specific questions or you get stuck somewhere, do not hesitate to share your questions.

How does vuforia detect a particular object ?which lines of code suggests this.

January 4, 2017 - 1:17am #1

Hello everyone,

1.How does vuforia detect a particular object ?which lines of code suggests this.

2.can we detect two objects simultaneously?

3.Can we detect two different object and pass two different color respectively?

 

thanks

 

Log in or register to post comments