# How to transform Projection matrix

In my project, I use the ARTK+ Tracker node and get a projection matrix, which goes to the Renderer’s projection pin (like in the ARTK+ Tracker’s help patch). However it is a projection matrix for a camera, but I also use a projector.

Using some toolkit for Matlab, we calibrated the camera with the projector and got various parameters, including translation (in milimeters) and rotation (in radians) for X, Y, Z axis.

How should I use these parameters to transform the projection matrix to get the projector’s view, not the camera’s? Simply using Translate and Rotate nodes doesn’t work right, as I guess the matrix is transformed in relation to the wrong coordinates system.

In ARToolkit documentation I’ve found information, that the projection matrix is OpenGL-style, so I found this article: OpenGL Projection Matrix
The matrix I get from ARTK+ seems to be similar to the “OpenGL Perspective Projection Matrix” shown there, with two exceptions - it is transposed, and the parameter in italics has the opposite sign:

2.5878 0.0000 0.0000 0.0000
0.0000 3.3699 0.0000 0.0000
(-0.0375) 0.0375 1.0020 1.0000
0.0000 0.0000 -2.0020 0.0000

yes, these are the pleasures of right handed (openGL/math textbook) vs. left handed (vvvv/directX) coordinate systems.

so first you need to know which matrix is defined for which coordinate system. and find out where you need to convert (transpose and invert z).

concerning the view matrix for the projector, you need to build it like you did with translate and rotate (note that vvvv uses cycles instead of radian for angles) and then use the right side input pin of the node Inverse (Transform) to invert the matrix before you put it into the view of the renderer.

also have a look at the help patch of Projector (EX9).

Ok, so do I understand you correctly? (I think I don’t…)
I don’t connect my matrix to those translation/rotation nodes directly (Version II in the attached patch), but to the Inverse node (Version I)?
Or should this Inverse node be used some other way?

Like, perhaps the matrix should be transposed before applying that translation and rotation, and then transposed once again?

Unfortunately I don’t have the access to the projector and my scene with AR markers right now, and I’m not able to try it out.

projection.v4p (27.6 kB)

if i understand your setup, you got two matrices:

• camera projection: this matrix describes the field of view of the camera?
• projector transformation values: this describes the offset from the camera to the projector (i.e. the homography between them)?

if that is true, this means you are missing the projection matrix from the projector. you need to know the field of view of the projector as well to reconstruct the view of the projector. you can look the projector parameters up in the internet.

In the ARTK+ Tracker help file, the first matrix is used as the input to renderer’s “Projection” pin, but we also have a camera configuration file (LogitechPro4000.dat). There is no “View” matrix connected to the renderer.

What I want to do in my project:
I have a box with AR markers on it, which is placed 1.5-2 meters from the camera. The camera is placed on a projector, and according to translation values we got from the calibration with Matlab, there is approx. 20 centimeters between them on the Y axis (and about 1 cm on the X and Z axis), which looks about right. I guess this is the offset from the camera to the projector, as you said.

So, the camera detects the markers, and then I want to display something on them through the projector - so I have another renderer for the projector (“projection renderer”), with some quads and textures, and all I need is the projection matrix for this new renderer.
Or maybe both, the projection matrix and the view matrix?

(The quads are placed perfectly on the markers in my “preview” renderer, which has the video stream from the camera in the background, and uses that first projection matrix from ARTK+ Tracker node. But I also need the projector’s “point of view” for the projection renderer.)

Will I need to use the Projector node to set those projector’s parameters, and connect it to both pins, View and Projection like in the node’s help file?
And what about those Translate, Rotate and Inverse nodes then?

ARTK+Tracker help.v4p (21.2 kB)

Ok, so I’m getting familiar with that Projector node (thanks tonfilm!), and it might help. Especially with the addition of AxisAndGrid and Camera nodes.
But I was wondering, how can I set the Projector node to have the same view as the camera’s?

I know that my questions might sound stupid, but I’m still very new to vvvv. Maybe someone could give me a link to an old thread on the forum, or something?