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

标签 ios iphone objective-c opencv ios5

我用过this code来自 IOS examples .并试图从相机中保存图像。问题是图像正在保存,但带有蓝色调,如下所示。

enter image description here

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

 - (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/

相关文章:

ios - 自定义 UITableViewCell 中的 UIButton 导致在多个单元格中选择按钮

ios - 如何在 iPhone 上的应用程序名称中包含超过 11 个字符?

ios - GPUImage:GPUImageThreeInputFilter 适用于静止图像输入,但不适用于相机输入

ios - 在 iphone xcode 中存储经纬度的最佳和最精确的数据类型是什么?

ios - 在Objective-C中以相同的动画显示和隐藏UIView?

ios - 导航栏后退按钮的重叠

iphone - 如何获取整数格式的 NSDate 日、月、年?

ios - 一段时间后(1 分钟)检查用户仍在区域中

iphone - NSFetchRequest/谓词问题

ios - 自定义类型的 UIButton 丢失 Click 事件