【发布时间】:2016-05-02 00:14:33
【问题描述】:
根据https://forums.developer.apple.com/thread/21694
iPhone 6s 和 6s Plus 都可以拍摄 12 兆像素的照片 (4032x3024) 通过 AVCaptureStillImageOutput 在后置摄像头上,并且可以 通过以下方式为您的流程提供高达 30 fps 的 12 MP 帧 AVCaptureVideoData 输出。当您使用 AVCaptureSessionPresetPhoto 作为 您的 AVCaptureSession 的 -sessionPreset,12 兆像素“420f”格式 默认选择。
所以我尝试使用以下代码:
self.captureSession.sessionPreset = AVCaptureSessionPresetPhoto;
AVCaptureVideoDataOutput* videoOutput = [[AVCaptureVideoDataOutput alloc] init];
videoOutput.alwaysDiscardsLateVideoFrames = YES;
[videoOutput setSampleBufferDelegate:self queue:dispatch];
[self.captureSession addOutput:videoOutput];
我的设备的活动格式设置为:
设备格式:AVCaptureDeviceFormat: 0x12c684630 'vide'/'420f' 4032x3024, { 3- 30 fps}, fov:57.716, 最大变焦:189.00 (upscales @1.00), 自动对焦系统:2,ISO:23.0-1840.0,SS:0.000013-0.333333
看起来不错。
但是,我在captureOutput 回调中添加了以下代码:
CVPixelBufferLockBaseAddress(imageBufferRef,0);
size_t width = CVPixelBufferGetWidth(imageBufferRef);
size_t height = CVPixelBufferGetHeight(imageBufferRef);
CVPixelBufferUnlockBaseAddress(imageBufferRef,0);
NSLog(@"ImageCameraSource:\n width:%zu\n height:%zu\n", width, height);
然后输出
ImageCameraSource: 宽度:1000 身高:750
为什么回调中的分辨率不是4032x3024?
【问题讨论】:
-
我感觉到你的痛苦,男人......
-
我一直在调查这个。您是否尝试从
captureOutput(captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer: CMSampleBuffer!, fromConnection connection: AVCaptureConnection!)或stillImageCaptureOutput.captureStillImageAsynchronouslyFromConnection(videoConnection)获取 4032x3024 帧? -
来自 captureOutput。为什么?这是错的吗?
-
我在我的应用中发现使用 AVCaptureSessionPresetPhoto 时,
didOutputSampleBuffer缓冲区为 1000x750,但从captureStillImageAsynchronouslyFromConnection返回的缓冲区输出为 3264x2448。我通过查看会话默认 AVCaptureDeviceFormat 上的 highResolutionImageDimensions 发现了这一点:developer.apple.com/library/prerelease/ios/documentation/… -
如果我不得不猜测一下,我会说 API 在照片预设中以 30/秒的速度返回 1000x750 缓冲区以用于视频预览,并期望人们在需要时会抓取静止帧
captureStillImageAsynchronouslyFromConnection
标签: ios iphone avcapturesession avcapture avcaptureoutput