使用Opencv示例从相机保存图像

我已经使用IOS示例中的 代码 。 并试图保存从相机的图像。 问题是,图像正在保存,但蓝色色调如下。

在这里输入图像说明

下面是我用来保存图像的代码。

- (void)processImagecv::Mat&image { ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; UIImage * convertedImage = [ViewController imageWithCVMat:image]; [library writeImageToSavedPhotosAlbumconvertedImage CGImage] orientationALAssetOrientation)[convertedImage imageOrientation] completionBlock:^(NSURL *assetURL, NSError *error){ if (error) { // TODO: error handling } else { // TODO: success handling NSLog(@"Success"; } }]; TS(DetectAndAnimateFaces); faceAnimator->detectAndAnimateFaces(image); TE(DetectAndAnimateFaces); } 

在一个给定的图像顺序的渠道是相反的,即从opencv默认代表BGR图像具有表示RGB,即通道红色和蓝色交换。