且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

有没有办法以编程方式将iOS设备的相机对焦设置为无限?

更新时间:2023-08-31 08:14:04

可悲的是,没有。正如Artem所说,您可以将相机设置为对焦锁定模式;进入自动对焦模式(对焦,然后锁定)或连续自动对焦模式,但不能给相机一个特定的距离来对焦。

我所能想到的***的(用于曝光和白平衡控制的,同样有限的)是让用户将摄像机指向适当的位置场景(在你的情况下,远离的东西),并让他/她推一个锁按钮。

捕获设备API的详细信息,如:
https://developer.apple.com/library/mac/ #documentation / AVFoundation / Reference / AVCaptureDevice_Class / Reference / Reference.html


I am creating an app that locks the camera focus for video recording purposes. I want to lock the focus to infinity without having the user manually adjust the focus. Is this possible? Thanks!

Sadly, no. You can set the camera into focus-locked mode, as Artem said; put into autofocus mode (focus, then lock), or continuous autofocus mode, but you can't give the camera a specific distance to focus at.

The best I've been able to come up with (for exposure and white balance control, which are similarly limited) is to have the user point the camera at an appropriate scene (in your case, something far away) and have him/her push a lock button.

Details on the capture device API, such as it is: https://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html