有什么办法可以迅速使用AVCaptureSession对象来逐帧获取图像吗? [英] Is there any way to get frame by frame using AVCaptureSession object in swift?

查看:115
本文介绍了有什么办法可以迅速使用AVCaptureSession对象来逐帧获取图像吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须使用我的c ++函数处理iPhone相机捕获的帧.因此,我使用startRunning()函数开始数据流,但是我可以用什么方式处理每一帧?

I have to process frames which are captured by iPhone camera using my c++ functions. So I use startRunning() function to start the flow of data, but in what way I can process each frame?

推荐答案

是的,这很简单.您需要

Yes, it is pretty straight forward. You need to

  1. 创建一个AVCaptureVideoDataOutput对象以生成视频帧
  2. 为AVCaptureVideoDataOutput对象实现委托以处理视频帧
  3. 在委托类中,实现方法(
  1. Create an AVCaptureVideoDataOutput object to produce video frames
  2. Implement a delegate for the AVCaptureVideoDataOutput object to process video frames
  3. In the delegate class, implement the method (captureOutput:didOutputSampleBuffer:fromConnection:) that is called when a sample buffer is written.

有关更多信息,您可以

For more information you can read this part of the AVFoundation Programming Guide. The code samples are in Objective-C not swift but i think you get the idea.

这篇关于有什么办法可以迅速使用AVCaptureSession对象来逐帧获取图像吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆