2012-06-11 59 views
0

我是iPhone應用程序開發新手。我開發了一款iPhone應用程序。在這個應用程序中,我想開發使用iPhone攝像頭錄製黑白視頻。請幫助我如何開發這個,然後給一些示例代碼網址也。如何捕捉黑白視頻

在此先感謝。

+0

可能的d重複http://stackoverflow.com/questions/7113639/recording-video-in-black-and-white – Maulik

回答

0

您想要使用kCVPixelFormatType_420YpCbCr8BiPlanarFullRange格式。

添加以下內容到videooutput

OSType format = kCVPixelFormatType_420YpCbCr8BiPlanarFullRange; 

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

並按照此轉換的Y平面到灰度到圖片:

AVFoundation - Get grayscale image from Y plane (kCVPixelFormatType_420YpCbCr8BiPlanarFullRange)

,或者如果你想將其保存爲視頻:

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