Created
May 25, 2016 10:14
-
-
Save quangtqag/d3533d9a6b0afa7c874dc56af1bf8afb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func ciImageFromSampleBuffer(sampleBuffer: CMSampleBuffer) -> CIImage { | |
let pixelBuffer : CVPixelBufferRef = CMSampleBufferGetImageBuffer(sampleBuffer)! | |
let attachments : CFDictionaryRef = CMCopyDictionaryOfAttachments(kCFAllocatorDefault, pixelBuffer, CMAttachmentMode( kCMAttachmentMode_ShouldPropagate))! | |
let ciImage = CIImage(CVPixelBuffer: pixelBuffer, options: attachments as? [String : AnyObject]) | |
return ciImage | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment