【问题标题】:AVCaptureSession with videoDataOuput and stillImageOutput带有 videoDataOutput 和 StillImageOutput 的 AVCaptureSession
【发布时间】:2012-12-01 19:00:45
【问题描述】:

我正在编写一个应用程序,我使用 AVCaptureSession 和 AVCaptureVideoDataOutput 来获取样本缓冲区,进行一些点检测并实时显示它。

用户还可以捕获图像。

问题在于,因为我使用的是同一个会话,所以用于捕获静止图像的图像质量与用于视频的图像质量相同。

我使用 captureOutput:didOutputSampleBuffer:fromConnection: 委托方法来捕获帧和 captureStillImageAsynchronouslyFromConnection: 来捕获静止图像

我想知道是否有办法在 AVCaptureSessionPresetMedium 中捕获帧,并在捕获图像时切换到 AVCaptureSessionPresetPhoto?

【问题讨论】:

    标签: objective-c ios video camera avfoundation


    【解决方案1】:

    您可以在会话运行时更改会话的sessionPreset 属性。

    在捕获图像之前将其更改为AVCaptureSessionPresetPhoto,然后在captureStillImageAsynchronouslyFromConnection:completionHandler:的完成块中将其更改为AVCaptureSessionPresetMedium

    请注意,更改预设会使相机在切换时短暂空白,因此可能难以立即捕捉特定帧的照片,但由于AVCaptureStillImageOutputcaptureStillImageAsynchronouslyFromConnection: 完成,因此从来没有真正的保证当它完成时。 :)

    【讨论】:

      猜你喜欢
      • 2012-04-09
      • 2018-04-01
      • 1970-01-01
      • 2015-11-02
      • 1970-01-01
      • 2017-06-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多