【发布时间】:2013-04-05 16:00:53
【问题描述】:
我正在使用基于 Apple 的 AppCam 应用示例的 AVCaptureSession 克隆 Apple 的相机应用。 问题是我在视频预览屏幕中看不到焦点矩形。 我使用以下代码设置焦点,但仍然没有显示焦点矩形。
AVCaptureDevice *device = [[self videoInput] device];
if ([device isFocusModeSupported:focusMode] && [device focusMode] != focusMode) {
NSError *error;
printf(" setFocusMode \n");
if ([device lockForConfiguration:&error]) {
[device setFocusMode:focusMode];
[device unlockForConfiguration];
} else {
id delegate = [self delegate];
if ([delegate respondsToSelector:@selector(acquiringDeviceLockFailedWithError:)]) {
[delegate acquiringDeviceLockFailedWithError:error];
}
}
}
当我使用 UIImagePickerController 时,默认支持自动对焦,点击对焦,并且可以看到焦点矩形。 有没有办法使用 AVCaptureSession 在视频预览层显示焦点矩形?
【问题讨论】:
-
嗯,这个好像没人知道。
标签: iphone avcapturesession autofocus