//CMSampleBufferRef=>UIImage
- (UIImage *)imageConvert:(CMSampleBufferRef)sampleBuffer
{
if (CMSampleBufferIsValid(sampleBuffer)) {
return nil;
}
CVPixelBufferRef pixelBuffer = (CVPixelBufferRef)CMSampleBufferGetImageBuffer(sampleBuffer);
CIImage *ciImage = [CIImage imageWithCVPixelBuffer:pixelBuffer];
UIImage *image = [UIImage imageWithCIImage:ciImage];
return image;
}
网友评论