【发布时间】:2019-05-15 08:26:32
【问题描述】:
我正在使用 AVCaptureDevice setFocusModeLocked 来实现从 A 点到 B 点的对焦斜坡。我这样做的方法是将 delta 定义为 0.03 之类的值,然后反复调用 API 来设置 lensPosition。
device.setFocusModeLocked(lensPosition: pointA, completionHandler: {[weak self] (time) in
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now(), execute: { [weak self] in
if pointA == pointB {
device.unlockForConfiguration()
return
}
var beginPoint = fmax(currentLensPosition + delta),Float(0))
let endPoint = fmin(pointB, Float(1.0))
self?.focusRampRecursive( beginPoint,
pointB:endPoint,
delta: delta,
device: device)
})
})
问题是斜坡不平滑。斜坡发生时可以看到跳跃。我怎样才能使它顺利?
【问题讨论】:
标签: ios avfoundation avcapturesession avcapturedevice