gpt4 book ai didi

ios - GPUImage 前置摄像头点击对焦为什么不起作用?

转载 作者:行者123 更新时间:2023-11-29 01:19:53 28 4
gpt4 key购买 nike

我已经实现了下面的代码来启用点击对焦相机。它在后置摄像头上工作正常,但在使用前置摄像头时失败,因为_videoCamera.inputCamera.isFocusPointOfInterestSupported 为假。

错了为什么?请帮助我。

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

UITouch *touch = [touches anyObject];
CGPoint touchPoint = [touch locationInView:self.view];

if([_videoCamera.inputCamera isFocusPointOfInterestSupported]&&[_videoCamera.inputCamera isFocusModeSupported:AVCaptureFocusModeAutoFocus])
{

if([_videoCamera.inputCamera lockForConfiguration :nil])
{
[_videoCamera.inputCamera setFocusPointOfInterest :touchPoint];
[_videoCamera.inputCamera setFocusMode :AVCaptureFocusModeLocked];

if([_videoCamera.inputCamera isExposurePointOfInterestSupported])
{ CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
CGFloat screenHeight = screenRect.size.height;
double focus_x = touchPoint.x/screenWidth;
double focus_y = touchPoint.y/screenHeight;
[_videoCamera.inputCamera setExposurePointOfInterest:CGPointMake(focus_x,focus_y)];
[_videoCamera.inputCamera setFocusMode:AVCaptureFocusModeAutoFocus];
if ([_videoCamera.inputCamera isExposureModeSupported:AVCaptureExposureModeAutoExpose]){
[_videoCamera.inputCamera setExposureMode:AVCaptureExposureModeAutoExpose];
}

}
[_videoCamera.inputCamera unlockForConfiguration];
}
}

}

最佳答案

前置摄像头是定焦的。没有自动对焦,不关注兴趣点。这正是 iOS 在您调用 isFocusPointOfInterestSupported 时通过返回 NO 告诉您的内容。

关于ios - GPUImage 前置摄像头点击对焦为什么不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34743586/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com