Saturday, 21 July 2018

Accurate and current FieldOfView of AVCaptureDevice

From AVFoundation objects like AVCaptureDevice I can read a value of fieldOfView using

captureDevice.activeFormat.videoFieldOfView

And this gives me a value of about 58 degrees on iPhone 6s. But what I need is to get current value of actual fieldOfView displayed in current frame while AVCaptureSession is running. What I mean by this is that the value read from activeFormat does not reflect real fieldOfView when lens is moved to get image in focus. For example when I point camera at a distant object, lens moves to keep in focus, and fieldOfView increases a little bit, to about 61 degrees. You can observe this behavior in ARKit camera - even when camera is catching focus displayed objects are getting bigger and smaller focusing along with the camera preview. I would like to know how can I achieve such behavior and adjust fieldOfView to current lens position. I need to apply this to SceneKit camera.

In shortcut: How to find current exact FieldOfView of camera taking into consideration current focus position (or lens position)

To help understand what I mean please look at this gif:

Focusing on iPhone

At the beginning you can see it focusing, and video kinda like zoomes in/out a little to catch correct lens position. So when this lens moves actual visible fieldOfView is getting a little different.



from Accurate and current FieldOfView of AVCaptureDevice

No comments:

Post a Comment