Ios 从CVImageBufferRef创建CIImage
我正在尝试从Ios 从CVImageBufferRef创建CIImage,ios,Ios,我正在尝试从CVPixelBuffer创建一个CIImage对象,直到第3步,一切都进行得很顺利 但在步骤4: [[CIImage alloc] initWithCVPixelBuffer:imageBuffer options:(__bridge_transfer NSDictionary *)attachments] 返回零。 所以,请为我的问题提供解决方案……提前谢谢 CMSampleBufferRef sampleBufferRef = [readerVideoTrackOutput
CVPixelBuffer
创建一个CIImage
对象,直到第3步,一切都进行得很顺利
但在步骤4:
[[CIImage alloc] initWithCVPixelBuffer:imageBuffer options:(__bridge_transfer NSDictionary *)attachments]
返回零。所以,请为我的问题提供解决方案……提前谢谢
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];
你在模拟器上运行这个吗?