多くのオンライン参照に基づいて、解像度を変更する方法は次のコードを使用することです。
NSDictionary * pixelBufferAttr = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:320], kCVPixelBufferWidthKey,
[NSNumber numberWithInt:240], kCVPixelBufferHeightKey,
[NSNumbernumberWithBool:YES],
(id)kCVPixelBufferOpenGLCompatibilityKey,
[NSNumber
numberWithUnsignedInt:kCVPixelFormatType_422YpCbCr8],
(id)kCVPixelBufferPixelFormatTypeKey,
nil];
NSArray *outputsConnected = [mCaptureSession outputs];
QTCaptureVideoPreviewOutput * previewOutput = [outputsConnected objectAtIndex:1];
[previewOutput setDelegate:self];
[previewOutput setPixelBufferAttributes:pixelBufferAttr];
ただし、解像度を変更した後captureView
は、別のものが表示されますが、コードを使用して解像度を確認するのは正しくありません。
デバイスの解像度を変更する方法を知っている人はいますか?
皆さんありがとう!