【发布时间】:2011-12-08 23:04:02
【问题描述】:
我正在使用 AVFoundation 框架。在我的示例缓冲区委托中,我有以下代码:
-(void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection{
CVPixelBufferRef pb = CMSampleBufferGetImageBuffer(sampleBuffer);
CIImage *ciImage = [CIImage imageWithCVPixelBuffer:pb];
self.imageView.image = [UIImage imageWithCIImage:ciImage];
}
我可以使用 CIImage 来运行人脸检测器等,但它没有显示在 UIImageView 中……imageView 仍然是白色的。关于这个问题的任何想法? 我正在使用以下内容来设置我的会话:
self.session = [[AVCaptureSession alloc] init];
self.session.sessionPreset = AVCaptureSessionPreset640x480;
self.videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
self.videoInput = [AVCaptureDeviceInput deviceInputWithDevice:videoDevice error:nil];
self.frameOutput = [[AVCaptureVideoDataOutput alloc] init];
self.frameOutput.videoSettings = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:kCVPixelFormatType_32BGRA] forKey:(id)kCVPixelBufferPixelFormatTypeKey];
【问题讨论】:
标签: iphone ios avfoundation ios5 core-image