我用过this code来自 IOS examples .并试图从相机中保存图像。问题是图像正在保存,但带有蓝色调,如下所示。
下面是我用来保存图片的代码。
- (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);
}
最佳答案
在给定的图像中, channel 的顺序是相反的,即从 opencv 默认表示 BGR 图像具有表示 RGB,即 channel 红色和蓝色被交换。
关于ios - 使用 Opencv 示例从相机保存图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23753787/