Reputation: 37627
I need to know the field of view of the camera of the phone to make an augmented reality app, for calculate where i have to write on the camera view the name of a gps located Point of interest of a city on the correct coordinates of the screen, pointing the point of interest.
for example:
distance 5 meters: 6 meters (from left to right FOV)
distance 10 meters: 12 meters (from left to right FOV)
How to calculate it?
Upvotes: 3
Views: 3717
Reputation: 11
The question is pretty old but I came across similar problem and I think there is quite reasonable solution mentioned here, at least it worked for me:
fov = 2 * atan2(cropW * sensorW / (2 * zoomRatio * activeArrayW), focalLength)
It is possible to access lens info (focal length, physical size) through camera manager from java or native code. In my case I collected necessary values using ACameraMetadata_getConstEntry
with ACAMERA_LENS_INFO_AVAILABLE_FOCAL_LENGTHS
and ACAMERA_SENSOR_INFO_PHYSICAL_SIZE
parameters. I hope it may help somebody.
Upvotes: 1
Reputation: 8787
I think you will never match the FOV definition for every device. (Compare this answer for iPhone.)
Every device is different when using android. Take your device, do the math (or take the results from anywhere else) and decide yourself to choose a reasonable FOV angle.
Maybe you could take account of Camera.Parameters.getSupportedPictureSizes() for getting the camera ratio, but that should be all you can do.
Upvotes: 2