I\'m having some problems getting a UIIMage from a CVPixelBuffer. This is what I am trying:
CVPixelBufferRef pixelBuffer = CMSampleBufferGetImageBuffer(imag
Another way to get an UIImage. Performs ~10 times faster, at least in my case:
int w = CVPixelBufferGetWidth(pixelBuffer);
int h = CVPixelBufferGetHeight(pixelBuffer);
int r = CVPixelBufferGetBytesPerRow(pixelBuffer);
int bytesPerPixel = r/w;
unsigned char *buffer = CVPixelBufferGetBaseAddress(pixelBuffer);
UIGraphicsBeginImageContext(CGSizeMake(w, h));
CGContextRef c = UIGraphicsGetCurrentContext();
unsigned char* data = CGBitmapContextGetData(c);
if (data != NULL) {
int maxY = h;
for(int y = 0; y