知道AVCaptureSession的会话预设的解决方案 [英] Knowing resolution of AVCaptureSession's session presets

查看:131
本文介绍了知道AVCaptureSession的会话预设的解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在iOS中访问相机并使用会话预设:

I'm accessing the camera in iOS and using session presets as so:

captureSession.sessionPreset = AVCaptureSessionPresetMedium;

相当标准的东西。但是,我想提前知道由于这个预设而我将获得的视频分辨率(特别是因为取决于设备它会有所不同)。我知道有在线表格可以查看(例如: http://cmgresearch.blogspot.com/2010/10/augmented-reality-on-iphone-with-ios40.html )。但是我希望能够以编程方式获得这个,这样我就不仅仅依赖于幻数了。

Pretty standard stuff. However, I'd like to know ahead of time the resolution of the video I'll be getting due to this preset (especially because depending on the device it'll be different). I know there are tables online you can look this up (such as here: http://cmgresearch.blogspot.com/2010/10/augmented-reality-on-iphone-with-ios40.html ). But I'd like to be able to get this programmatically so that I'm not just relying on magic numbers.

所以,这样的事情(理论上):

So, something like this (theoretically):

[captureSession resolutionForPreset:AVCaptureSessionPresetMedium];

可能会返回{宽度:360,高度:480}的CGSize。我还没有找到任何这样的API,到目前为止我不得不求助于等待获取我的第一个捕获的图像然后查询它(由于我的程序流程中的其他原因并不好)。

which might return a CGSize of { width: 360, height: 480}. I have not been able to find any such API, so far I've had to resort to waiting to get my first captured image and querying it then (which for other reasons in my program flow is not good).

推荐答案

根据Apple的说法,没有API。很糟糕,我遇到了同样的问题。

According to Apple, there's no API for that. It sucks, I've had the same problem.

这篇关于知道AVCaptureSession的会话预设的解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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