【问题标题】:Core Image filter device/simulator outputs核心图像过滤器设备/模拟器输出
【发布时间】:2014-04-13 20:20:46
【问题描述】:

我正在使用 Core Image 在我的应用程序中创建过滤器。我首先在模拟器上测试它们,一切看起来都很好。当我切换到设备时,输出看起来不同。对于我正在使用的过滤器,代码如下:

result = [CIFilter filterWithName:@"CIColorMatrix" keysAndValues:
                  kCIInputImageKey, image,
                  @"inputRVector", [CIVector vectorWithX:1.00 Y:0.00 Z:0.00 W:0.00],
                  @"inputGVector", [CIVector vectorWithX:0.00 Y:1.00 Z:0.00 W:0.00],
                  @"inputBVector", [CIVector vectorWithX:0.30 Y:0.00 Z:1.00 W:0.00],
                  @"inputAVector", [CIVector vectorWithX:0.42 Y:0.00 Z:0.00 W:1.00],
                  @"inputBiasVector", [CIVector vectorWithX:0.00 Y:0.00 Z:0.06 W:0.00], nil].outputImage;
        
        result = [CIFilter filterWithName:@"CIVignetteEffect" keysAndValues:
                  kCIInputImageKey, result,
                  kCIInputCenterKey, [CIVector vectorWithX:250 Y:478],
                  kCIInputRadiusKey, @414.36,
                  kCIInputIntensityKey, @0.75,nil].outputImage;

CGRect extent = [result extent];
    CGImageRef cgimage = [context createCGImage:result fromRect:extent];
    UIImage *filteredImage = [UIImage imageWithCGImage:cgimage scale:originalScale orientation:originalOrientation];
    CGImageRelease(cgimage);
    [_filteredImageView setImage:filteredImage];

所需的输出和模拟器显示的内容如下:

但是,当我在设备上运行它时,我得到以下输出:

可能出了什么问题?

注意:图片以屏幕截图形式拍摄,并非通过手机或其他设备拍摄。这就是图像质量。

【问题讨论】:

  • 到底是什么问题?图片不正确还是滤镜不正确?
  • @Tander 过滤器的输出在模拟器上是正确的,而在设备上运行时是错误的。这是怎么回事?提供的图片向您展示差异。谢谢
  • 结果如何声明?上次我遇到类似问题(适用于 Sim 而不是设备)是由于内存管理。
  • @Tanderi 将结果声明为 CIImage *result;我更新了关于我如何使用输出的帖子。
  • 我必须仔细检查这张图片是否是在 4 月 1 日发布的。 sim 上的图像 = 城市景观,设备上的图像 = 猫的图像。真的?!?我认为您在 2 个平台上使用完全不同的源图像?

标签: ios objective-c ios7 core-image


【解决方案1】:

好的,我发现了问题。问题出在图像中。我在每个平台上使用不同的图像尺寸。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-04-06
    • 1970-01-01
    • 1970-01-01
    • 2023-03-29
    • 2011-01-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多