如何捕获黑白视频 [英] How to capture the black and white video
问题描述
我是iPhone应用程序开发的新手.我开发了一个iPhone应用程序.在此应用程序中,我想使用iPhone相机开发记录黑白视频的记录.请帮助我如何开发此方法,然后再提供一些示例代码url.
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.
谢谢.
推荐答案
您要使用kCVPixelFormatType_420YpCbCr8BiPlanarFullRange格式.
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];
然后按照以下步骤将Y平面从灰度转换为图像:
and following this to convert the Y plane to grayscale to images:
AVFoundation-从Y平面获取灰度图像(kCVPixelFormatType_420YpCbCr8BiPlanarFullRange)
,或者如果您要将其另存为视频:
or if you want to save it as video:
这篇关于如何捕获黑白视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!