Created
December 28, 2015 07:45
-
-
Save caojianhua/b3fef5a2674898ee3fed to your computer and use it in GitHub Desktop.
Create CVPixelBuffer from memory
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
CVPixelBufferRef pxbuffer = NULL; | |
CVPixelBufferCreateWithBytes(kCFAllocatorDefault,width,height,kCVPixelFormatType_32ARGB,data,4 * width, NULL, NULL, NULL, &pxbuffer); | |
CIImage* tmpImage = [CIImage imageWithCVPixelBuffer:pxbuffer]; | |
UIImage* newImage = [UIImage imageWithCIImage:tmpImage]; | |
NSLog(@"imageSize:%@",NSStringFromCGSize(newImage.size)); | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
imageView.image = newImage; | |
imageView.frame = CGRectMake(0, 0, width/5, height); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you provide I420 formart initialize code sample?