iPhone 5前置摄像头-点按即可对焦? [英] iPhone 5 front camera - tap to focus?

查看:133
本文介绍了iPhone 5前置摄像头-点按即可对焦?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用AVFoundation框架,我可以使用以下代码来集中精力:

Using the AVFoundation framework, I have tap to focus using this code:

- (void) autoFocusAtPoint:(CGPoint)point{

NSArray *devices = [AVCaptureDevice devices];    


    for (AVCaptureDevice *device in devices) {
        [device unlockForConfiguration];

        if ([device hasMediaType:AVMediaTypeVideo]) {

            if([device isFocusPointOfInterestSupported] && [device isFocusModeSupported:AVCaptureFocusModeAutoFocus]) {

                if([device lockForConfiguration:nil]) {

                    [device setFocusPointOfInterest:point];
                    [device setFocusMode:AVCaptureFocusModeAutoFocus];
                    [device setExposurePointOfInterest:point];
                    [device setExposureMode:AVCaptureExposureModeContinuousAutoExposure];

                    [device lockForConfiguration:nil];

                }
            }
        }
    }

}

这应该同时经过前后摄像头设备并对其进行聚焦.它确实通过每个设备,但对于前置摄像头,它不会超过isFocusPointOfInterestSupported行.但是您可以使用iPhone 5轻按以将焦点对准前置摄像头.至少您可以在摄像头应用程序上进行聚焦.那是什么问题呢?

This should go through both the front and back camera devices and focus them. It does go through each device but for the front camera it does not get past the isFocusPointOfInterestSupported line. But you are able to tap to focus on the front camera using an iPhone 5. At least you are able to on the camera app. So what is the problem???

感谢您的帮助

推荐答案

我不知道iPhone 5是否支持前置摄像头对焦,但根据官方文档

i don't know whether iPhone 5 support front camera focus , but according to the official doc

iPhone 4的前置摄像头没有对焦模式.也许还有iPhone 4S

the iPhone 4's front camera have no focus mode. maybe iPhone 4S either

这篇关于iPhone 5前置摄像头-点按即可对焦?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆