0

I'm trying to understand how does CMSampleBuffer works. Eventually i'm looking for the most efficient way to change the CMSampleBuffer pixels (which are at kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange format), into grayScale pixels.

The final result would be (fast)grayscale live video stream.

I have tried the following :

 CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
    CVPixelBufferLockBaseAddress(imageBuffer, kCVPixelBufferLock_ReadOnly);
    char *baseBuffer = (char *)CVPixelBufferGetBaseAddress(imageBuffer);

Which somehow suppose to indicate about the pixels. But from there i'm kind of lost. Any suggestions folks?

Roi Mulia
  • 5,626
  • 11
  • 54
  • 105
  • There is this method [CIImage imageWithCVPixelBuffer: imageBuffer] which gives you the CIImage to do the processing stuff (imageBuffer is your CVImageBufferRef) – Xcoder May 31 '16 at 16:13
  • @Xcoder Hey. Thank you for commenting! I'm aware of this type of approach, but i'm using openCV & dlib(C++ Libraries) , for future processing, and the only way to handle this kind of thing is thru the pixels(there are extra use-cases). – Roi Mulia May 31 '16 at 16:14
  • sorry man.my knowledge is limited to simple stuff on core image filtering. you can use this ans if it is of any help http://stackoverflow.com/questions/5176209/what-is-the-best-fastest-way-to-convert-cmsamplebufferref-to-opencv-iplimage – Xcoder May 31 '16 at 16:20
  • @Xcoder Appreciate the help buddy, I did checked this answer , it helped but still much more to learn – Roi Mulia May 31 '16 at 16:30

0 Answers0