8

Is there a way to find out or calculate the field of view (FOV) an iPhone camera has through calls to the APIs? Or is it something you have to physically and manually find out for yourself?

If it cannot be fetched or calculated with the APIs, but instead has to be hard-coded into an app, then what's the best way to find out what kind of device an app is running on? Different devices have different FOV (iPhone 4 has larger FOV than previous versions.) Also, how big are the FOVs of each device, exactly?

I'm asking because I'm thinking of making an augmented reality app, and knowing the FOV is essential.

quano
  • 18,812
  • 25
  • 97
  • 108

5 Answers5

4

I took a photo of a piece of paper that i had measured from a distance that i also measured. I then looked at the ratio of the size of the piece of paper to its image in the photo.

My values were at 56 cm you can fully photograph (i.e. so that it takes up exactly the screen size) an object that is about 40cm x 60cm

Using that i did some simple trig and arrived at: Vertical FOV: 2*atan(58.5/2 / 56.5) -> ~55 degrees Horizontal FOV: 2*atan(21.5/2 /56.5) -> 42 degrees

twerdster
  • 4,977
  • 3
  • 40
  • 70
  • I used an iPhone 4 which has a camera aspect ration of 4/3 which agrees quite well with 55/42 – twerdster Oct 05 '10 at 19:51
  • Vertical FOV: 2*atan(58.5/2 / 56.5) -> ~55 degrees ??? There's something wrong with this math... – Duck Apr 20 '11 at 07:40
  • @Digital Robot - The answer you will get might be in radians so you need to convert it to degrees. So 2*atan(58.5/2/56.5)/2/pi*360 ~ 55 degrees. – twerdster Apr 20 '11 at 13:10
2

This answer uses some math and camera info to determine a value.

Looking at ARKit it hardcodes .7392 radians (42.35 degrees). When I was researching AR I just held the phone camera up and lined the edges up with some landmarks and then measured the angle. My estimation on a 3GS was 48 degrees in landscape and 39 degrees in portrait. My estimation on a iPhone 4 is 58 in landscape and 48 degrees in portrait.

Searching around on the internet there seem to be wildly varying claims. This might be explained by people having different models of the phone. I have found no official source of information on this topic from apple.

If I were to do this again I would borrow the various phone models and use a system of measuring against landmarks on the horizon. Nothing can beat hard numbers you measured yourself.

My method for estimation is as follows: Stand 10 feet from a wall and look at the image on screen. Note the points on the wall at the left and right side of the image and measure the distance. Then use trigonometry to calculate the angle. If a is the distance from the wall and o is the length measured along the wall then tan(A) = (o/2)/a, which is half the angle.

UPDATE: I fixed some incorrect calculations and added the iPhone 4 and how I measured.

Community
  • 1
  • 1
Jon Steinmetz
  • 4,104
  • 1
  • 23
  • 21
  • I too have noticed the different claims, and I was thinking the same thing, but would like to avoid the hassle of getting hold of devices if I could. – quano Sep 05 '10 at 18:01
  • 1
    Your values are incorrect : .7392 rad != 133 degrees ... it is around 42 degrees. How do you com up with 95deg for 3GS ?! A fov of 95 means that the device would have an incredibly wide angle. – rockeye Aug 01 '11 at 09:16
  • You are correct, I made a mistake in my angle calculations. I have corrected these, included my methods, and added my data for the iPhone 4. Thanks. – Jon Steinmetz Aug 02 '11 at 15:40
1

I get 47.1539 degrees in the long dimension on an iPhone 3gs.

Gene
  • 11
  • 1
0

You can simply ask:

AVCaptureDevice *device = [...]
NSLog(@"FOV: %lf", device.activeFormat.videoFieldOfView);

Remember this is the horizontal FOV and well now, for newcomers, you have the ARKit.

Rémy Blanc
  • 313
  • 2
  • 9
0

If I get you question right, and you need to have the fov under ARKit configuration - this is how you can get it:

(look at field geometricDistortionCorrectedVideoFieldOfView)

private func getAVCaptureDevice() -> AVCaptureDevice? {
    session.configuration?.videoFormat.value(forKey: "device") as? AVCaptureDevice
}

private func setupAVCaptureDeviceFormatWithHighestFOV() {
    
    guard let avDevice = getAVCaptureDevice() else { return }
    do {
        let activeFormat = avDevice.activeFormat
        
        var formats = avDevice.formats
        formats.sort(by: ({ $0.geometricDistortionCorrectedVideoFieldOfView > $1.geometricDistortionCorrectedVideoFieldOfView }))
        let wantedFormatWithHighestFOV = formats.first(where: ({$0.corresponds(to: activeFormat)}))
        
        // Continue from here
    } catch {
        logger.error("error: \(error)")
    }
}
Nativ
  • 3,092
  • 6
  • 38
  • 69