ios - 有什么方法可以快速使用 AVCaptureSession 对象逐帧获取?

标签 ios swift avfoundation avcapturesession

我必须使用我的 C++ 函数处理 iPhone 相机捕获的帧。所以我使用 startRunning() 函数来启动数据流,但是我可以用什么方式处理每一帧?

最佳答案

是的,它非常简单。你需要

  1. 创建一个 AVCaptureVideoDataOutput 对象来生成视频帧
  2. 为 AVCaptureVideoDataOutput 对象实现一个委托(delegate)来处理视频帧
  3. 在委托(delegate)类中,实现写入样本缓冲区时调用的方法 ( captureOutput:didOutputSampleBuffer:fromConnection: )。

更多信息您可以read this part AVFoundation 编程指南。代码示例在 Objective-C 中不是很快,但我想你明白了。

关于ios - 有什么方法可以快速使用 AVCaptureSession 对象逐帧获取?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35255580/

相关文章:

ios - 当另一个 UIViewController(在 UINavigationController 内)显示时,UIViewController 不调整内容插入

ios - 检测 CAShapeLayer 中点击的位置

ios - SwiftUI 垂直 ScrollView 弹起并且不显示其中的所有 View

objective-c - iOS AVFoundation : How do I fetch artwork from an mp3 file?

ios - 获取所有包含 TextFields 的 TableView Cell 的数据(包括隐藏 View )

ios - 在 iOS8 中禁用 interactivePopGestureRecognizer

swift - 文档时间戳字段在展开为时间戳时抛出错误

objective-c - NSControl 对象内的日文字体渲染不正确

iphone - 如何将视频从应用程序文档目录移动到相机胶卷?

iphone - 立即卡住 AVCaptureSession