Calculating the Angular View of an iPhone

I have a new iPhone. You know I am going to use this for both videos and images that can be analyzed. It’s just what I do. So, before I need it I am going to measure the angular field of view for this phone. Oh sure, I could just look it up somewhere but […]
Screenshot 5 9 13 3 15 pm
Image: Rhett Allain. Corridor inside Pursley Hall, Southeastern Louisiana University

I have a new iPhone. You know I am going to use this for both videos and images that can be analyzed. It's just what I do. So, before I need it I am going to measure the angular field of view for this phone. Oh sure, I could just look it up somewhere but I don't always trust these values. It's more fun to do it yourself.

Why does angular field of view even matter? Well, suppose you take a picture of something a known distance away. If you knew the angular size of this object, you could easily calculate the actual size. This diagram might help.

Screenshot 5 9 13 3 26 pm

If you know θ and r, you can find the length L. But here is the problem. If you have an image and an object is 500 pixels wide, what angle does that represent? If you know the angular field of view for the whole image, you can determine the angular size for each pixel. So, this is what I need to do for the iPhone 5 camera.

You could make this quite simple. Take a picture of a known object a known distance away. Then you will have L and r that can be used to solve for θ. This will give you the pixel to angle ratio - which is what you really need.

Let me take this one step further. What if I looked at the pixel size of some object at several different distances? Wouldn't that be better? I can re-write the the angular size equation to take into account the pixel size of the object in the image. I will call the pixel size s.

Screenshot 5 10 13 10 18 am

I introduced another constant, k. This is the angular field of view of the camera in radians per pixel. Also, I rearranged the equation so that I could see what to plot. I will measured r (distance from camera) and s (pixel size). Instead of taking a whole bunch of pictures, I will just take one - the shot of the hallway above. Each square is pretty close to being 12 inches by 12 inches. All I need to do is to measure the image size of the side black lines at different distances. The best way to do this is with Tracker Video Analysis (even though it is not a video).

Here is my data, if you want to use it for yourself - iPhone 5 camera data.

Now that I have data for r and s, I can plot r vs. 1/s. This should be a linear function. Here is what that looks like. Oh, in case you didn't notice, I recorded s not in pixel size but as a fraction of the screen size (where the screen width is 1).

Screenshot 5 10 13 11 08 am

That looks nice. But there is something important here. The distance to the object is not the distance to the object. The values I reported are from counting squares on the ground. However, the camera wasn't on the ground but rather in my hand. This means that there is some extra distance that should be added. The cool part is that it doesn't matter really. This is what gives the linear fit a non-zero y-intercept (in this case -9.60 feet). Actually, I can use this to determine how high I was holding the camera since I am pretty sure I was standing 9 feet away from one of the black markers. Here is a diagram.

xkcd

school of art.

Using the pythagorean theorem, I get a camera height of about 3.3 feet. That seems about right.

But no one cares about the camera height. What about the angular field of view? The slope of the linear fit to the data is 4.72 feet. I can use this to solve for k since I know that L is 5 feet.

Screenshot 5 10 13 12 02 pm

Since I had s as a percent of the total width, this k is indeed the angular field of view of the camera in radians - so about 60.69 degrees. I suspect this is off just a little bit - but I am happy using an angular field of view of 60°.

What about the video camera on the iPhone 5? Here is the same view using both the still and video cameras. This shows the two views together.

Screenshot 5 10 13 12 10 pm

A quick measurement shows that the video size is 0.848 that of the still image. That would make this have an angular field of view of about 50.9°. That's it. Mission accomplished. I'm sure someone will look up the actual specs for the camera and tell me I am slightly off. That's ok with me.