我目前的设置如下(基于Brad Larson的ColorTrackingCamera项目):
我正在使用一个AVCaptureSession集合AVCaptureSessionPreset640x480,我让输出通过OpenGL场景作为纹理运行.然后由片段着色器操纵该纹理.
我需要这种"低质量"预设,因为我想在用户预览时保持高帧率.然后我想在用户拍摄静态照片时切换到更高质量的输出.
首先,我认为我可以改变它sessionPreset,AVCaptureSession但这会迫使相机重新聚焦,这会破坏可用性.
[captureSession beginConfiguration];
captureSession.sessionPreset = AVCaptureSessionPresetPhoto;
[captureSession commitConfiguration];
Run Code Online (Sandbox Code Playgroud)
目前我正在尝试向AVCaptureStillImageOutputAVCaptureSession 添加第二个,但我得到一个空像素缓冲,所以我觉得我有点卡住了.
这是我的会话设置代码:
...
// Add the video frame output
[captureSession beginConfiguration];
videoOutput = [[AVCaptureVideoDataOutput alloc] init];
[videoOutput setAlwaysDiscardsLateVideoFrames:YES];
[videoOutput setVideoSettings:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:kCVPixelFormatType_32BGRA] forKey:(id)kCVPixelBufferPixelFormatTypeKey]];
[videoOutput setSampleBufferDelegate:self queue:dispatch_get_main_queue()];
if ([captureSession canAddOutput:videoOutput])
{
[captureSession addOutput:videoOutput];
}
else
{
NSLog(@"Couldn't add video output");
}
[captureSession commitConfiguration];
// Add still output
[captureSession beginConfiguration];
stillOutput = [[AVCaptureStillImageOutput alloc] init];
if([captureSession canAddOutput:stillOutput]) …Run Code Online (Sandbox Code Playgroud)