views:

43

answers:

2

I'm trying to determine the degree size of the field-of-view of a Droid Incredible smartphone's camera. I need to know this value for an application that I'm developing. Does anyone know how I can find out/calculate it programmatically?

+1  A: 

Unless there's some API call for that (I'm not an Android programmer, I wouldn't know), I would just snap a picture of a ruler from a known distance away, see how much of the ruler is shown in the picture, then use trigonometry to find the angle. Then you can hard-code it as a constant in your program. (A named constant, of course, so it'd be easy to change :-p)

David Zaslavsky
Better yet, make it user-configurable so people who don't have a Droid Incredible can adjust/calibrate it.
EboMike
This value would change with zoom level, of course.
emddudley
@emddudley: true, I never thought about the phone having a zoom level. Although given the view angle at any one zoom level, it should be possible to calculate it at any other zoom level.
David Zaslavsky
A: 

I have a Droid Incredible as well. Android 2.2 introduced the functions you are looking for. In my code, I have:

public double getHVA() {
    return camera.getParameters().getHorizontalViewAngle();
}

public double getVVA() {
    return camera.getParameters().getVerticalViewAngle();
}

However, these require that you have the camera open. I'd be interested to know if there is a "best practices" way to not have to open the camera each time to get those values.

@David Zaslavsky - how? What is the mathematical relationship between the zoom levels? I can't find it anywhere (I asked in this question: http://stackoverflow.com/questions/3682149/what-do-the-android-camera-zoom-numbers-mathematically-represent)

Max