"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

Error projecting point on the screen.

Hi, I'm trying to project marker coordinates and to export them to java. I think there's something on camera calibration and pose matrix I don't understand. When i try to project the frame vertices of the marker with this code, there's always a variable offset: it seems like I'm not using correct camera calibration, perhaps. Only when the device is normal to the frame i get the marker correctly framed. [CODE] const QCAR::Tracker& tracker = QCAR::Tracker::getInstance(); const QCAR::CameraCalibration& cameraCalibration = tracker.getCameraCalibration(); QCAR::Vec2F mrkrsize = marker->getSize(); float mposx = mrkrsize.data[0]; float mposy= mrkrsize.data[1]; QCAR::Vec2F screenPoint1 = QCAR::Tool::projectPoint(cameraCalibration, trackable->getPose(), QCAR::Vec3F(0, +mposy/2, 0)); QCAR::Vec2F screenPoint2 = QCAR::Tool::projectPoint(cameraCalibration, trackable->getPose(), QCAR::Vec3F(0, -mposy/2, 0)); QCAR::Vec2F screenPoint3 = QCAR::Tool::projectPoint(cameraCalibration, trackable->getPose(), QCAR::Vec3F(mposx, posy/2, 0)); QCAR::Vec2F screenPoint4 = QCAR::Tool::projectPoint(cameraCalibration, trackable->getPose(), QCAR::Vec3F(mposx, -mposy/2, 0));[/CODE]

It looks like the projectPoint method doesn't work as advertised. It projects a point to camera space, not screen space. You should have all the information you need to take this point from camera to screen space, however.

[QUOTE=ksiva]...Here's a method that should work for landscape mode, let us know if you need help adapting it to portrait... - Kim[/QUOTE] I am interested in the portrait mode version, ty :)

Sorry for the delay, here's a version that works in either orientation: [CODE] QCAR::Vec2F cameraPointToScreenPoint(QCAR::Vec2F cameraPoint) { QCAR::VideoMode videoMode = QCAR::CameraDevice::getInstance().getVideoMode(QCAR::CameraDevice::MODE_DEFAULT); QCAR::VideoBackgroundConfig config = Q

Hi,

I'm using this code to get the center point of the trackable and I'm having trouble with the landscape mode.

It's always moved a little to the bottom left :-(

I'm testing this on an iPad 2 BTW

DavidBeard

Thu, 09/20/2012 - 01:59

Here's another approach you can try that's specific to iOS. - (CGPoint) projectCoord:(CGPoint)coord inView:(const QCAR::CameraCalibration&)cameraCalibration andPose:(QCAR::Matrix34F)pose withOffset:(CGPoint)offset andScale:(CGFloat)scale { CGPoint converted; QCAR::Vec3F vec(coord.x