ios - CoreImage CIImage 不工作

标签 ios swift core-image

核心图像不起作用:

    let fileUrl = Bundle.main.url(forResource: "image", withExtension: "png")

    let begainImage = CIImage(contentsOf: fileUrl!)

    let filter = CIFilter(name: "CISepiaTone")
    filter?.setValue(begainImage, forKey: kCIInputImageKey)
    filter?.setValue(0.5, forKey: kCIInputImageKey)

    let newImage = UIImage(ciImage: (filter!.outputImage)!)

    self.imageView.image = newImage

最佳答案

因为你写道:

filter?.setValue(0.5, forKey: kCIInputImageKey)

而不是

filter?.setValue(0.5, forKey: kCIInputIntensityKey)

关于ios - CoreImage CIImage 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48458765/

相关文章:

ios - 我必须等待 Alamofire 完成发布请求还是全部异步

ios - Swift & SpriteKit - 如何在 GameScene 中呈现警报 View

ios - 使用 Swift 向 Google 应用引擎端点创建 REST 请求时出错

iphone - 格式化 CIColorCube 数据

ios - 如何在 Swift 中从字符串生成条形码?

ios - 我的应用程序能否让用户将一些文件保存到 iCloud 并保留在设备上

iphone - 请解释这可能是如何泄漏的 - 字符串编码函数

ios - UITableViewCell 中的 UIButton setImage 导致应用程序崩溃

ios - 单击通过电子邮件收到的登录链接时,我收到无效的动态链接

ios - GLKView + CIImage with Alpha + AVFoundation = Trippy Mess