저는 iOS 8에 도입 된 새로운 API로 카메라의 수동 컨트롤을 제공하는 앱을 개발 중이며 참조 용으로 WWDC 2014의 sample app을 사용하고 있습니다.노출 지속 시간을 수정하고 AVCaptureExposureModeContinuousAutoExposure로 돌아간 후 이상한 동작이 발생했습니다.
그러나 이상한 bahaviour (내 5s와 6) : 노출 모드를 "custom"로 설정 한 다음 "auto"로 설정 한 후 노출 지속 시간이 영향을받지 않는 것처럼 이미지가 계속 지연됩니다. 이 변화.
- (IBAction)changeExposureMode:(id)sender
{
UISegmentedControl *control = sender;
NSError *error = nil;
AVCaptureExposureMode mode = (AVCaptureExposureMode)[self.exposureModes[control.selectedSegmentIndex] intValue];
if ([self.videoDevice lockForConfiguration:&error])
{
if ([self.videoDevice isExposureModeSupported:mode])
{
[self.videoDevice setExposureMode:mode];
}
else
{
NSLog(@"Exposure mode %@ is not supported. Exposure mode is %@.", [self stringFromExposureMode:mode], [self stringFromExposureMode:self.videoDevice.exposureMode]);
}
}
else
{
NSLog(@"%@", error);
}
}
- (IBAction)changeExposureDuration:(id)sender
{
UISlider *control = sender;
NSError *error = nil;
double p = pow(control.value, EXPOSURE_DURATION_POWER); // Apply power function to expand slider's low-end range
double minDurationSeconds = MAX(CMTimeGetSeconds(self.videoDevice.activeFormat.minExposureDuration), EXPOSURE_MINIMUM_DURATION);
double maxDurationSeconds = CMTimeGetSeconds(self.videoDevice.activeFormat.maxExposureDuration);
double newDurationSeconds = p * (maxDurationSeconds - minDurationSeconds) + minDurationSeconds; // Scale from 0-1 slider range to actual duration
if (self.videoDevice.exposureMode == AVCaptureExposureModeCustom)
{
if (newDurationSeconds < 1)
{
int digits = MAX(0, 2 + floor(log10(newDurationSeconds)));
self.exposureDurationValueLabel.text = [NSString stringWithFormat:@"1/%.*f", digits, 1/newDurationSeconds];
}
else
{
self.exposureDurationValueLabel.text = [NSString stringWithFormat:@"%.2f", newDurationSeconds];
}
}
if ([self.videoDevice lockForConfiguration:&error])
{
[self.videoDevice setExposureModeCustomWithDuration:CMTimeMakeWithSeconds(newDurationSeconds, 1000*1000*1000) ISO:AVCaptureISOCurrent completionHandler:nil];
}
else
{
NSLog(@"%@", error);
}
}
CGD 메인 스레드에서 두 가지 메소드 코드를 모두 추가하려고합니다. 도움이 될 수 있습니다 .... – hmdeep