Raw data from CVImageBuffer without rendering?

I get CVImageBufferRef from my AVCaptureSession, and I would like to take this image buffer and download it over the network. To save space and time, I would like to do this without rendering the image in CIImage and NSBitmapImage, which is the solution I've seen everywhere (for example: How can I get raw data from a CVImageBuffer object ).

This is due to the fact that I got the impression that CVImageBuffer can be compressed, which is surprising for me, and if I draw it, I have to unzip it into a full raster file and then load the entire raster image. I would like to take the compressed data (realizing that one compressed frame may be inaccessible later on its own) just as it is inside CVImageBuffer. I think this means that I want the CVImageBuffer database pointer and its length, but there is no way to get this in the API. Does anyone have any ideas?

+5
source share
1 answer

CVImageBuffer . CVPixelBuffer, CVOpenGLBuffer, CVOpenGLTexture. , .

, GetTypeID:

CVImageBufferRef image = …;
CFTypeID imageType = CFGetTypeID(image);

if (imageType == CVPixelBufferGetTypeID()) {
  // Pixel Data
}
else if (imageType == CVOpenGLBufferGetTypeID()) {
  // OpenGL pbuffer
}
else if (imageType == CVOpenGLTextureGetTypeID()) {
  // OpenGL Texture
}
+8

All Articles