Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CVPixelBuffer vs. CVImageBuffer, and Buffers in general

What's the difference between CVImageBuffer which is returned by CMSampleBufferGetmageBuffer and CVPixelBuffer? I just want to retrieve the image planes (RGBA) but I can't figure out how to retrieve this information from CVImageBuffer. I'm using Swift.

Thanks.

like image 698
Carpetfizz Avatar asked Mar 30 '18 04:03

Carpetfizz


People also ask

What is CVPixelbuffer?

A Core Video pixel buffer is an image buffer that holds pixels in main memory. Applications generating frames, compressing or decompressing video, or using Core Image can all make use of Core Video pixel buffers.

What is CVImageBuffer?

An interface for managing different types of image data.


1 Answers

They are identical in swift. If you look at the definition underneath, you will see this:

public typealias CVPixelBuffer = CVImageBuffer

which means that you can use you can use the methods here if you want to find the image planes(I don't know what that means exactly). But CVPixelBuffer is a concrete implementation of the abstract class CVImageBuffer. There are two types of CVImageBuffers in use at the moment-CVPixelBuffers and OpenGLBuffers. You can choose to break the abstraction if you know for certain that your CVImageBuffer is a CVPixelBuffer.

like image 119
btomtom5 Avatar answered Sep 25 '22 12:09

btomtom5