以编程方式确定可用的iPhone相机分辨率 [英] Programmatically determine available iPhone camera resolutions

查看:183
本文介绍了以编程方式确定可用的iPhone相机分辨率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看起来当我用 UIImagePickerControllerQualityTypeMedium 拍摄视频时,在iPod Touch上出现480x360,但在iPhone 4上它是更高的东西因为我目前没有一个方便),而在iPad 2大概和4相同,如果不是一样不同的。



我想在所有设备上拍摄相同的质量 - 我必须添加一些帧和标题,这将使我的生活很容易,如果我只需要编写一个分辨率。有什么方法来确定不同的 UIImagePickerControllerQualityType 值在运行时对应吗? (除了用每个人拍摄视频然后检查结果)



或者是我唯一的选择使用 UIImagePickerControllerQualityType640x480

解决方案

如果你需要更多的自定义/强大的iOS比你希望更高级的对象, code> UIImagePickerController ,建议在下一个较低级别工作: AV Foundation Framework 。 Apple有一些 AV基础编程的优秀文档,应该为此目的派上用场。



不幸的是,如果您确实希望在所有设备上都能使用该功能,那么即使您只限于在640x480下进行拍摄。但是,有一个伟大的图表,但在同一链接(但锚点在文档中打破,因此Ctrl + F到捕获静态图像)列出了某些质量下各种设备的所有分辨率指令。



你最坚实的下注,假设640x480太小,是制定一些缩放算法,允许你根据整体分辨率缩放。 / p>

It looks like when I shoot video with UIImagePickerControllerQualityTypeMedium, on an iPod Touch it comes out 480x360, but on an iPhone 4 it's something higher (can't say just what as I don't have one handy at the moment) and on an iPad 2 presumably the same as the 4, if not something different again.

I'd like to shoot the same quality on all devices -- I have to add some frames and titles, and it'll make my life a lot easier if I just have to code that for one resolution. Is there any way to determine what the different UIImagePickerControllerQualityType values correspond to at run time? (Apart from shooting video with each and then examining the result, that is.)

Or is my only choice to use UIImagePickerControllerQualityType640x480?

解决方案

If you need more customization/power on iOS than you get wish the higher level objects, such as UIImagePickerController, it is recommended to work at the next lower level: AV Foundation Framework. Apple has some excellent documentation on AV Foundation programming that should come in handy for that purpose.

Unfortunately, even there you are limited to capturing at 640x480 if you do want it standard across all devices. There, however, is a great chart available at the same link (but anchors are broken in the docs, so Ctrl+F to "Capturing Still Images") that lists all the resolutions for various devices under certain quality directives.

Your most solid bet, assuming 640x480 is too small, is to work out some sort of scaling algorithm that would allow you to scale according to the overall resolution.

这篇关于以编程方式确定可用的iPhone相机分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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