从CVImageBufferRef创建CIImage

时间:2014-01-24 13:17:27

标签: ios

我正在尝试从CIImage创建一个CVPixelBuffer对象,一切顺利到第3步。

但在第4步:

[[CIImage alloc] initWithCVPixelBuffer:imageBuffer options:(__bridge_transfer NSDictionary *)attachments] 

返回nil。
所以请给我解决我的问题....提前致谢。

CMSampleBufferRef sampleBufferRef = [readerVideoTrackOutput copyNextSampleBuffer];

CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);

CFDictionaryRef attachments = CMCopyDictionaryOfAttachments(kCFAllocatorDefault,        
                            sampleBuffer, kCMAttachmentMode_ShouldPropagate);
CIImage *image = [[CIImage alloc] initWithCVPixelBuffer:imageBuffer options:(__bridge_transfer NSDictionary *)attachments];

0 个答案:

没有答案