我正在开发一个适用于 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?
发布评论
评论(1)
相机的分辨率和屏幕的分辨率不再真正相关。你说
,但我认为这实际上不是真的(并且可能因设备而异)。 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
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.