gpt4 book ai didi

ios - iphone 上相机应用程序的 AVFoundation AVCaptureDevice 设置是什么?

转载 作者:可可西里 更新时间:2023-11-01 06:15:03 27 4
gpt4 key购买 nike

我想知道 iPhone 上相机应用程序的 AVCaptureDevice 设置是什么。特别是 AVCaptureExposureMode、AVCaptureFocusMode 和 AVCaptureWhiteBalanceMode。我正在尝试制作自定义相机,但出于某种原因,我无法让照片的光线在对焦时正确改变。我为我的相机设置了 ExposurePointOfInterest 和 FocusPointOfInterest,但出于某种原因,相机似乎正确对焦,但照明没有聚焦在我点击的地方。当我点击黑暗区域时,它不会像在相机应用程序中那样变亮。有没有我忘记设置的设置?这是我的相机对焦代码。

CGPoint touchPoint = [gesture locationInView:collectView];
float focus_x = touchPoint.x / collectView.frame.size.width;
float focus_y = touchPoint.y / collectView.frame.size.height;
NSError *tError = nil;
NSLog(@"previous: %.2f, %.2f", backCamera.focusPointOfInterest.x, backCamera.focusPointOfInterest.y);
if (isFrontCamera) {
focus_x = collectView.frame.size.width - focus_x; //the view is mirrored for the front camera
if ([frontCamera lockForConfiguration:&tError]) {
if ([frontCamera isExposurePointOfInterestSupported]) {
[frontCamera setExposurePointOfInterest:CGPointMake(focus_x, focus_y)];
if ([frontCamera isExposureModeSupported:AVCaptureExposureModeAutoExpose]) {
[frontCamera setExposureMode:AVCaptureExposureModeAutoExpose];
}
}
if ([frontCamera isFocusPointOfInterestSupported]) {
[frontCamera setFocusPointOfInterest:CGPointMake(focus_x, focus_y)];
if ([frontCamera isExposureModeSupported:AVCaptureExposureModeAutoExpose]) {
[frontCamera setExposureMode:AVCaptureExposureModeAutoExpose];
}
}
if ([frontCamera isWhiteBalanceModeSupported:AVCaptureWhiteBalanceModeAutoWhiteBalance]) {
[frontCamera setWhiteBalanceMode:AVCaptureWhiteBalanceModeAutoWhiteBalance];
}
[frontCamera unlockForConfiguration];
}
else {
NSLog(@"Couldn't change focus point:%@",tError);
}
}
else {
if ([backCamera lockForConfiguration:&tError]) {
if ([backCamera isExposurePointOfInterestSupported]) {
[backCamera setExposurePointOfInterest:CGPointMake(focus_x, focus_y)];
if ([backCamera isExposureModeSupported:AVCaptureExposureModeAutoExpose]) {
[backCamera setExposureMode:AVCaptureExposureModeAutoExpose];
}
}
if ([backCamera isFocusPointOfInterestSupported]) {
[backCamera setFocusPointOfInterest:CGPointMake(focus_x, focus_y)];
if ([backCamera isFocusModeSupported:AVCaptureFocusModeAutoFocus]) {
[backCamera setFocusMode:AVCaptureFocusModeAutoFocus];
}
}
if ([backCamera isWhiteBalanceModeSupported:AVCaptureWhiteBalanceModeAutoWhiteBalance]) {
[backCamera setWhiteBalanceMode:AVCaptureWhiteBalanceModeAutoWhiteBalance];
}
[backCamera unlockForConfiguration];
}
else {
NSLog(@"Couldn't change focus point:%@",tError);
}
}

最佳答案

This document里面有很多东西,会部分回答你的问题。

希望这对您有所帮助,因为我们无法告诉相机应用程序的每个属性的值。

关于ios - iphone 上相机应用程序的 AVFoundation AVCaptureDevice 设置是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24347839/

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