Log in or register to post comments

Can we get the vertical FOV of the physical camera/camera image?

March 9, 2012 - 5:56am #1


Qualcomm is probably putting in a lot of effort to gather the calibration data for all of the Android devices out there. Vuforia may be the only AR library that has so much information about all of these.

Now, we would like to add an innovative extension to the marker tracking that is being done, and for that we need the field of view of the physical camera (and/or the modified FOV of the image that appears on screen, in case it is clipped when the aspect ratio of the camera is different from that on the screen).

This cannot be retrieved from the FOV property of the ARCamera, since this always stays the same. Instead, Vuforia modifies the projection matrix of the camera directly...

So my question is: is it possible for us to retrieve the mentioned FOV(s) from (an undocumented) API function?

Or can we recompute it based on the values of the projection matrix? Perhaps by computing the angle between the normals of the side-planes of the view-frustrum? (at the moment I have no idea on how to actually do that though.. but since Daniel W would probably need all of five minutes to whip up some formulas, I thought I'd ask here :-)


Re: Can we get the vertical FOV of the physical camera/camera im

March 9, 2012 - 7:05am #3

Hey, that's a clever trick!

Thanks! :)


Re: Can we get the vertical FOV of the physical camera/camera im

March 9, 2012 - 6:57am #2

You have the right idea! Here's how to determine the FOV by finding the angle between the outer edges of the view frustum:

// Create a ray along the upper edge of the view frustum, centered on X
Ray ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width / 2.0f, Screen.height, 0));

// Find the angle between this ray and the camera forward direction
float angle = Vector3.Angle(Camera.main.transform.forward, ray.direction);

// Multiply by two and you have the fov!
float fov = angle * 2.0f;

Note this isn't the same as the camera FOV. QCAR renders the camera to a viewport that is slightly larger than the screen, as the camera aspect ratio doesn't typically match the screen aspect ratio. Unity renders to the standard screen viewport, however, and the projection matrix that Unity uses has been adjusted to take this into account. The FOV above is probably the one you want.

- Kim

Log in or register to post comments