以编程方式确定可用的 iPhone 相机分辨率
看起来当我使用 UIImagePickerControllerQualityTypeMedium
拍摄视频时,在 iPod Touch 上它的分辨率为 480x360,但在 iPhone 4 上它的分辨率更高(不能说具体是什么,因为我手边没有分辨率) iPad 2 上的情况可能与 iPad 4 相同,如果不是又有所不同的话。
我想在所有设备上拍摄相同的质量 - 我必须添加一些帧和标题,如果我只需针对一种分辨率进行编码,这将使我的生活变得更加轻松。有没有办法确定不同的 UIImagePickerControllerQualityType
值在运行时对应的内容? (除了使用每个视频拍摄视频然后检查结果之外。)
或者是我唯一选择使用 UIImagePickerControllerQualityType640x480 ?
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
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您在 iOS 上需要更多的自定义/功能,而不是您希望的更高级别对象,例如 UIImagePickerController,建议在下一个较低级别工作:AV Foundation Framework 。苹果有一些 有关 AV Foundation 编程的优秀文档 对于此目的应该会派上用场。
不幸的是,即使在那里,如果您确实希望在所有设备上都采用标准分辨率,您也只能以 640x480 进行捕获。然而,有一个 很棒的图表可在同一链接中找到(但文档中的锚点已损坏,因此 Ctrl+F 可以“捕获静态图像”),其中列出了特定质量下各种设备的所有分辨率指令。
假设 640x480 太小,您最可靠的选择是制定某种缩放算法,允许您根据整体分辨率进行缩放。
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.