xcode AVFoundation 捕获 UIImage

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10115716/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 23:57:10  来源:igfitidea点击:

AVFoundation capture UIImage

objective-ciosxcodeavfoundation

提问by La bla bla

I'm trying to capture one or more UIImages programmatically using AVFoundation. I set up the sessions and input devices and everything, but when I try to find explanations on how to actually take the photos, all I get is buffeled information about connections and what not. I couldn't find a single example of actually taking photos and saving it to UIImage for further processing. All the example use a constant kCGImagePropertyExifDictionaryWhich doesn't seems to exist in iOS 5 SDK..

我正在尝试使用 AVFoundation 以编程方式捕获一个或多个 UIImages。我设置了会话和输入设备以及所有内容,但是当我试图找到有关如何实际拍摄照片的解释时,我得到的只是有关连接的模糊信息,而不是连接信息。我找不到一个实际拍摄照片并将其保存到 UIImage 以供进一步处理的示例。所有示例都使用了一个常量kCGImagePropertyExifDictionary,而 iOS 5 SDK 中似乎不存在该常量。

Can someone please provide me with a code or an explanation from top to bottom on how to take and save an image from the front facing camera to a UIImage using AVFoundation?

有人可以向我提供有关如何使用 AVFoundation 从前置摄像头拍摄图像并将其保存到 UIImage 的代码或从上到下的解释吗?

Thanks alot!

非常感谢!

回答by Chris McGrath

To use kCGImagePropertyExifDictionary, you should #import <ImageIO/ImageIO.h>.

要使用kCGImagePropertyExifDictionary,你应该#import <ImageIO/ImageIO.h>

All of the other information you seek is inside the AVFoundation Programming guide - particularly the Media Capturesection.

您需要的所有其他信息都在 AVFoundation 编程指南中 - 特别是媒体捕获部分。