菜鸟教程小白 发表于 2022-12-12 18:20:56

IOS Capture 12 MP Video (iPhone 6s) 产生 1000x750


                                            <p><p>根据<a href="https://forums.developer.apple.com/thread/21694" rel="noreferrer noopener nofollow">https://forums.developer.apple.com/thread/21694</a> </p>

<blockquote>
<p>Both iPhone 6s and 6s Plus can capture 12 megapixel photos (4032x3024)
on the rear-facing camera via the AVCaptureStillImageOutput, and can
deliver up to 30 fps 12 MP frames to your process via
AVCaptureVideoDataOutput.When you use AVCaptureSessionPresetPhoto as
your AVCaptureSession’s -sessionPreset, the 12 megapixel ‘420f’ format
is chosen by default.</p>
</blockquote>

<p>所以我尝试使用以下代码:</p>

<pre><code>self.captureSession.sessionPreset = AVCaptureSessionPresetPhoto;
AVCaptureVideoDataOutput*   videoOutput = [ init];
videoOutput.alwaysDiscardsLateVideoFrames = YES;
;
;
</code></pre>

<p>我的设备的事件格式设置为:</p>

<blockquote>
<p>device format: AVCaptureDeviceFormat: 0x12c684630 &#39;vide&#39;/&#39;420f&#39;
4032x3024, { 3- 30 fps}, fov:57.716, max zoom:189.00 (upscales @1.00),
AF System:2, ISO:23.0-1840.0, SS:0.000013-0.333333</p>
</blockquote>

<p>看起来不错。</p>

<p>但是,我在 <code>captureOutput</code> 回调中添加了以下代码:</p>

<pre><code>CVPixelBufferLockBaseAddress(imageBufferRef,0);
size_t width = CVPixelBufferGetWidth(imageBufferRef);
size_t height = CVPixelBufferGetHeight(imageBufferRef);
CVPixelBufferUnlockBaseAddress(imageBufferRef,0);
NSLog(@&#34;ImageCameraSource:\n   width:%zu\n   height:%zu\n&#34;, width, height);
</code></pre>

<p>然后输出</p>

<blockquote>
<p>ImageCameraSource:
width:1000
height:750</p>
</blockquote>

<p>为什么回调中的分辨率不是4032x3024?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>尝试使用 <code>AVCaptureSessionPreset3840x2160</code> 实时获取最高分辨率的帧</p>

<pre><code>self.captureSession.sessionPreset = AVCaptureSessionPreset3840x2160;
AVCaptureVideoDataOutput*   videoOutput = [ init];
videoOutput.alwaysDiscardsLateVideoFrames = YES;
;
;
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于IOS Capture 12 MP Video (iPhone 6s) 产生 1000x750,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/34996797/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/34996797/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: IOS Capture 12 MP Video (iPhone 6s) 产生 1000x750