美文网首页iOS
CMSampleBufferRef转UIImage

CMSampleBufferRef转UIImage

作者: 和谐共处 | 来源:发表于2017-01-09 11:37 被阅读57次
    //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;
    }
    

    相关文章

      网友评论

        本文标题:CMSampleBufferRef转UIImage

        本文链接:https://www.haomeiwen.com/subject/wszcbttx.html