iOS 全屏 AVCaptureSession

发布于 2024-12-29 02:05:04 字数 917 浏览 3 评论 0 原文

我正在开发一个适用于 iOS 5 的实时视频处理应用程序。视频流尺寸需要与设备的屏幕尺寸相匹配。我目前只有 iPhone 4 可供开发。对于 iPhone 4,我将 AVCaptureSession 预设设置为 AVCaptureSessionPresetMedium:

AVCaptureSession *session = [AVCaptureSession new];
[session setSessionPreset:AVCaptureSessionPresetMedium];

捕获的图像(通过 CMSampleBufferRef)具有屏幕的大小。

我的问题:使用 AVCaptureSessionPresetMedium 会话预设捕获的图像在 iPhone 4s 和 iPad2 上也具有全屏设备尺寸的假设是否正确?不幸的是我自己无法证实这一点。

我查看了苹果文档:

http://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/AVCaptureSession_Class/Reference/Reference.html#//apple_ref/doc/constant_group/Video_Input_Presets

但我找不到 1024/768 的 ipad2 尺寸预设,并且希望避免实时调整图像大小的性能损失。

推荐的路线是什么?

I am developing a realtime video processing app for iOS 5. The video stream dimensions need to match the screen size of the device. I currently only have a iPhone 4 to develop against. For the iPhone 4 I set the AVCaptureSession preset to AVCaptureSessionPresetMedium:

AVCaptureSession *session = [AVCaptureSession new];
[session setSessionPreset:AVCaptureSessionPresetMedium];

The captured images (via CMSampleBufferRef) have the size of the screen.

My question: Is the assumption correct that the images captured with a session preset of AVCaptureSessionPresetMedium have the full screen device dimensions on iPhone 4s and iPad2 as well? I unfortunately cannot verify that myself.

I looked at the apple documentation:

http://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/AVCaptureSession_Class/Reference/Reference.html#//apple_ref/doc/constant_group/Video_Input_Presets

but I cannot find a ipad2 dimension preset of 1024/768 and would like to save me the performance penalty of resizing images in real time.

Whats the recommended path to go?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼中杀气 2025-01-05 02:05:04

相机的分辨率和屏幕的分辨率不再真正相关。你说

捕获的图像(通过 CMSampleBufferRef)的大小为
屏幕

,但我认为这实际上不是真的(并且可能因设备而异)。 iPad 2 和 iPhone 4s 上的中等捕捉尺寸为 480x360。请注意,这甚至与手机或 iPod 屏幕的宽高比不同:相机为 4x3,但屏幕为 3x2。

The resolution of the camera and the resolution of the screen aren't really related anymore. You say

The captured images (via CMSampleBufferRef) have the size of the
screen

but I don't think this is actually true (and it may vary by device). A medium capture on an iPad 2 and an iPhone 4s is 480x360. Note this isn't even the same aspect ratio as the screen on a phone or iPod: the camera is 4x3 but the screen is 3x2.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文