AVCaptureSession低预览质量

时间:2016-04-14 21:19:24

标签: ios avcapturesession

我的应用使用视频录制,因此我使用AVCaptureSession。但是,当我看到捕获会话预览时,我注意到质量较低,特别是在将相机指向电视或计算机屏幕上的文本时。如何提高Capture Session的质量,以便更清晰地在计算机屏幕上显示文本?这是我的代码中涉及视频质量的部分。

self.CaptureSession = [[AVCaptureSession alloc] init];
self.CaptureSession.automaticallyConfiguresApplicationAudioSession = NO;
[self.CaptureSession setSessionPreset:AVCaptureSessionPresetHigh];
//----- ADD INPUTS -----

//ADD VIDEO INPUT
self.VideoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if ([self.VideoDevice hasTorch] == YES){
    self.flashSet.hidden = NO;
    self.flashOverlayObject.hidden = NO;
}
[self.VideoDevice lockForConfiguration:nil];
[self.VideoDevice setAutoFocusRangeRestriction:AVCaptureAutoFocusRangeRestrictionNear];
[self.VideoDevice setFocusMode:AVCaptureFocusModeContinuousAutoFocus];
[self.VideoDevice setExposureMode:AVCaptureExposureModeContinuousAutoExposure];
[self.VideoDevice setWhiteBalanceMode:AVCaptureWhiteBalanceModeContinuousAutoWhiteBalance];
if(self.VideoDevice.lowLightBoostSupported){
    self.VideoDevice.automaticallyEnablesLowLightBoostWhenAvailable = YES;
}
[self.VideoDevice unlockForConfiguration];
if (self.VideoDevice)
{
    NSError *error;
    self.VideoInputDevice = [AVCaptureDeviceInput deviceInputWithDevice:self.VideoDevice error:&error];
    if (!error)
    {
        if ([self.CaptureSession canAddInput:self.VideoInputDevice])
            [self.CaptureSession addInput:self.VideoInputDevice];
    }

}

0 个答案:

没有答案
相关问题