How to capture the black and white video

后端 未结 1 725
北荒
北荒 2021-01-25 23:46

I am new in iPhone application development. I develop one iPhone application. In this application i want to develop record the black and white video using iPhone camera. Pleas

相关标签:
1条回答
  • 2021-01-26 00:30

    You want to use the kCVPixelFormatType_420YpCbCr8BiPlanarFullRange format.

    adding this to your videooutput

    OSType format = kCVPixelFormatType_420YpCbCr8BiPlanarFullRange;
    
        videoOutput.videoSettings = [NSDictionary dictionaryWithObject:[NSNumber 
                                                                        numberWithUnsignedInt:format]
                                                                forKey:(id) kCVPixelBufferPixelFormatTypeKey];
    

    and following this to convert the Y plane to grayscale to images:

    AVFoundation - Get grayscale image from Y plane (kCVPixelFormatType_420YpCbCr8BiPlanarFullRange)

    or if you want to save it as video:

    How do I convert the live video feed from the iPhone camera to grayscale?

    0 讨论(0)
提交回复
热议问题