How to capture the black and white video

孤者浪人 提交于 2019-12-02 15:35:56

问题


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. Please help me how to develop this and then give some example code url also.

Thanks in advance.


回答1:


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?



来源:https://stackoverflow.com/questions/10975758/how-to-capture-the-black-and-white-video

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!