【问题标题】:How to apply Cool and warm tone CIFilter in iOS?如何在 iOS 中应用冷暖色调 CIFilter?
【发布时间】:2019-08-06 04:56:18
【问题描述】:

我正在基于Swift iOS 中的Application 开发Video。我使用AVPlayer 播放Video 并使用AVVideoCompositionVideo 上设置CIFilters。我必须在我的Videos 上申请Cool and warm tone filter effects(请参阅下图)。

我已经尝试了下面Apple doc 中提到的所有Core Image Filters,但没有一个看起来像Cool and warm tone filter effect

https://developer.apple.com/library/archive/documentation/GraphicsImaging/Reference/CoreImageFilterReference/index.html

任何人都可以这样做吗?请给我建议。

【问题讨论】:

    标签: ios swift core-image cifilter


    【解决方案1】:

    感谢@Frank Schlegel 将我引导至CITemperatureAndTint 过滤器inputNeutralinputTargetNeutral。请参阅以下核心图像过滤器参数以获得暖色调和冷色调效果:

    filter = CIFilter(name: "CITemperatureAndTint")!
    

    //冷

    filter.setValue(CIVector(x: 16000, y: 1000), forKey: "inputNeutral")
    filter.setValue(CIVector(x: 1000, y: 500), forKey: "inputTargetNeutral")
    

    //温暖

    filter.setValue(CIVector(x: 6500, y: 500), forKey: "inputNeutral")
    filter.setValue(CIVector(x: 1000, y: 630), forKey: "inputTargetNeutral")
    

    【讨论】:

      【解决方案2】:

      看来CITemperatureAndTint filter 就是您要找的东西。坦率地说,我不知道参数是如何工作的,但也许你可以查看thisthis 相关问题。

      【讨论】:

      • 感谢@Frank Schlegel 的回复,我尝试使用 CITemperatureAndTint 过滤器,但预览没有区别。看起来类似于原始视频:(
      • 你玩过inputNeutralinputTargetNeutral 参数吗?
      • 不,我没有。你能帮我做同样的事情吗?
      • 据我了解,inputNeutral 定义了参考点的色温和色调,inputTargetNeutral 定义了目标点的相同。因此,也许可以在中间选择一些参考点(或保持默认值 6500K)并将标尺移动到更暖或更冷的颜色(如 1000K)。
      • 也许可以先试试这个:[filter setValue:[CIVector vectorWithX:1000 Y:0] forKey:@"inputTargetNeutral"];
      猜你喜欢
      • 2020-07-05
      • 1970-01-01
      • 1970-01-01
      • 2010-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-03
      • 2012-05-05
      相关资源
      最近更新 更多