### Author Topic: Augmented Reality : how to set camera intrinsics parameters ?[AR]  (Read 611 times)

#### lightrack

• byte
• Posts: 2
##### Augmented Reality : how to set camera intrinsics parameters ?[AR]
« on: April 11, 2016, 06:16:54 pm »
Hi,

I'm planning to use JPCT-AE for an Android AR application.
So I need that the projection of my scene fit accurately with the camera intrinsics parameters (in the sense of https://ksimek.github.io/2013/08/13/intrinsic/).
Basically, I have a K matrix (obtained through an external camera calibration process) :
[ fx 0 x0
0  fy y0
0  0  1 ]

Where fx,fy are focal lengths, and [x0, y0] the principal point (which is near the center of frame, but still present a significant offset from that center so that I'm forced to take it into account to stay accurate for the projections and reverse projections).

This post http://www.jpct.net/forum2/index.php/topic,3366.msg24313.html#msg24313 discussed about that question but didn't resolve the issue of the principal point (ox, oy in the post).

For fx/fy, I can use them to set FOVx and FOVy (with setFOV() and setYFOV()), but how can I inject the offset of the principal point ?

I maybe miss something but I didn't see any direct way to do this. So I hesitate between 2 ways to achieve my goal to use a complete matrix of camera intrinsics :

1/ setFrustumOffset() ? but it only acts on Y axis and there is no method similar method for X axis ?

2/ set FOV values, then retrieve projection matrix with getProjectionMatrix(), inject x0 and y0 at the right place into it and dump the modified projection matrix into the former with setDump().

I understand "projection matrix" in the sense of http://www.codinglabs.net/article_world_view_projection_matrix.aspx so that it's only responsible to transform view space into frustum space and I assume it's the same for getProjectionMatrix().

I hope I'm clear enough.

Any hints are welcome,

#### EgonOlsen

• Administrator
• quad
• Posts: 11895
##### Re: Augmented Reality : how to set camera intrinsics parameters ?[AR]
« Reply #1 on: April 11, 2016, 07:22:01 pm »
2) won't work. The projection matrix doesn't exist as an instance inside the engine. It's calculated on demand. Setting it to something else has no direct effect on anything.

I've uploaded a new jar that extends the setFrustumOffset()-method so that it takes offsets in both directions as parameters. Maybe that helps: http://jpct.de/download/beta/jpct_ae.jar

#### lightrack

• byte
• Posts: 2
##### Re: Augmented Reality : how to set camera intrinsics parameters ?[AR]
« Reply #2 on: April 12, 2016, 11:07:02 am »
Ok, thanks a lot ; I'll check that.