Get from the camera projection matrix to screen coordinates

Aug 19, 2011 at 4:31 PM
Edited Aug 19, 2011 at 4:39 PM

I'm working with the windows phone 7 sample, and I wanted to figure out where the center of the projected object is in screen coordinates (x,y). Its been a while since I've worked with linear algebra and any help would be much appreciated! 



 // Calculate the complete transformation matrix based on the first detection result

var world = centerAtOrigin * scale * randomizedTranslation * dr[0].Transformation;                   

// Calculate the final transformation matrix by using the camera projection matrix                    

var m = Matrix3DFactory.CreateViewportProjection(world, Matrix3D.Identity, arDetector.Projection, viewport);



Thanks in advance!


Feb 4, 2012 at 9:05 PM

The upper left corner of the marker in screen space is:

x = m.OffsetX / m.M44;

y = m.OffsetY / m.M44;

This formula will also give you the position of the marker's center, if you first remove the centerAtOrigin term from your world calculation.