【发布时间】:2017-01-22 19:05:34
【问题描述】:
我看到 iOS 10 引入了 AVCapturePhotoOutput 作为处理照片捕获的新类,并且能够通过将两个缓冲区传递给 AVCapturePhotoCaptureDelegate 方法 capture 来在主图像旁边创建预览/缩略图图像。
然后可以通过jpegPhotoDataRepresentation 将其表示为 JPEG 数据,但是我很感兴趣并且无法找出预览图像是如何存储然后访问的。我猜UIImageView 会根据视图边界自动选择任一图像?您将如何手动选择任一图像?
let imageData = AVCapturePhotoOutput.jpegPhotoDataRepresentation(forJPEGSampleBuffer: photoSampleBuffer, previewPhotoSampleBuffer: previewPhotoSampleBuffer)
captureImageView.image = UIImage(data: imageData)
【问题讨论】:
-
查看这个帖子的答案:stackoverflow.com/questions/37869963/…
标签: ios swift swift3 avfoundation avcaptureoutput