Log in or register to post comments

Problem with getting screen coordinates of trackable

June 11, 2013 - 2:27pm #1

Hi, in my app (which uses the imageTargets functionality) I have the pose matrix of a trackable being converted all the way to screen coordinates. The way I am doing this is:

1) Get cameraCalibration

const QCAR::CameraCalibration& cameraCalibration =  QCAR::CameraDevice::getInstance().getCameraCalibration();

2) Getting the camera point

QCAR::Vec2F cameraPoint = QCAR::Tool::projectPoint(cameraCalibration, result->getPose(), QCAR::Vec3F(0, 0,0));

3) Converting "cameraPoint" to "screenPoint"

QCAR::Vec2F screenPoint = cameraPointToScreenPoint(cameraPoint);

 

Step 1 is outside the main 'for' loop in renderFrame. Steps 2 and 3 are done inside the 'for' loop. And the function 'cameraPointToScreenPoint' is a direct copy from y'alls FAQ section.

 

The problem is that on some devices the screen coordinates returned are not matched to the target being tracked. I have a View class that displays some information about the target being tracked that needs to be right on top of this. On a Motorola Droid 4, this works perfectly, but on an HTC Thunderbolt, the X/Y coordinates returned are off by an exact factor of 2 (I have to multiply the returned coordinates by 2 to get it to work on the HTC). I can't locate the cause of this problem.

Problem with getting screen coordinates of trackable

April 22, 2016 - 12:48am #8

This link shouws how to convert target coordinates to screen coordinates:

https://developer.vuforia.com/forum/faq/technical-how-can-i-project-target-point-screen

 

Problem with getting screen coordinates of trackable

April 21, 2016 - 9:19pm #7

Hi AlessandroB,

is there new link? the link is no longer avaliable.

Problem with getting screen coordinates of trackable

June 13, 2013 - 3:14am #6

Hi, this line:

LOG("Something %d, and something else %d", rotatedX, rotatedY);

should work normally.

there is also a similar line of code (which works) in the ImageTargets sample:

LOG("Configure Video Background : Video (%d,%d), Screen (%d,%d), mSize (%d,%d)", videoMode.mWidth, videoMode.mHeight, screenWidth, screenHeight, config.mSize.data[0], config.mSize.data[1]);
 
So, not sure what is wrong in your case...
 

Problem with getting screen coordinates of trackable

June 12, 2013 - 1:50pm #5

I have been, but the log results are giving my large results or overflow values which indicates that I am seeing addresses in memory. However, I try dereferencing them "(int *)" which do not do anything (I should not have to dereferece non pointers). But the main format I have been trying is something along the lines of:

LOG("Something something something=%d, and something else=%d", rotatedX, rotatedY);

 

Problem with getting screen coordinates of trackable

June 12, 2013 - 1:39pm #4

Have you tried debugging it by adding some Logs to print out the values of the screen width/height and the video width/height ? That would help you understand what goes wrong and what are the differences between the devices showing different behaviours... 

 

Problem with getting screen coordinates of trackable

June 12, 2013 - 6:14am #3

Yes I have. The section that applies directly to my needs in that article is the "Target space to screen space". I have copied the provided function 'cameraPointToScreenPoint()' into the imagetargets code and calculated the screen points as stated earlier. I do not know where the discrepancy is.

Problem with getting screen coordinates of trackable

June 11, 2013 - 11:16pm #2

Hi, have you checked this article from our Knowledge Base section:

https://developer.vuforia.com/resources/dev-guide/screen-coordinates

 

Log in or register to post comments