我是 iPhone 应用程序开发的新手。我开发了一个 iPhone 应用程序。在这个应用程序中,我想开发使用 iPhone 相机录制黑白视频。请帮助我如何开发它,然后也提供一些示例代码 url。
提前致谢。
您想使用 kCVPixelFormatType_420YpCbCr8BiPlanarFullRange 格式。
将此添加到您的视频输出中
OSType format = kCVPixelFormatType_420YpCbCr8BiPlanarFullRange;
videoOutput.videoSettings = [NSDictionary dictionaryWithObject:[NSNumber
numberWithUnsignedInt:format]
forKey:(id) kCVPixelBufferPixelFormatTypeKey];
并按照此将 Y 平面转换为灰度图像:
AVFoundation - 从 Y 平面获取灰度图像 (kCVPixelFormatType_420YpCbCr8BiPlanarFullRange)
或者如果您想将其保存为视频: