简体   繁体   English

如何在iOS中应用冷色调和暖色调CIFilter?

[英]How to apply Cool and warm tone CIFilter in iOS?

I am working on Video based Application in Swift iOS . 我正在Swift iOS基于VideoApplication上工作。 Where I am using AVPlayer to play the Video and setting CIFilters on Video using AVVideoComposition . 当我使用AVPlayer播放的Video和设置CIFiltersVideo使用AVVideoComposition I have to apply Cool and warm tone filter effects on my Videos (please see the below images). 我要申请Cool and warm tone filter effects对我的Videos (请参阅下面的图像)。

在此处输入图片说明

在此处输入图片说明

I have tried all the Core Image Filters mentioned in below Apple doc , but none of them looks like Cool and warm tone filter effect . 我已经尝试了下面Apple doc提到的所有Core Image Filters ,但它们看起来都不像Cool and warm tone filter effect

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

Can anyone have worked on the same? 任何人都可以从事相同的工作吗? Please suggest me. 请给我建议。

It seems like the CITemperatureAndTint filter is what you are looking for. 看起来CITemperatureAndTint过滤器正是您想要的。 I frankly don't know exactly how the parameters work, but maybe you can check out this or this related question. 坦白地说,我不确切知道这些参数是如何工作的,但是也许您可以检查一下这个这个相关的问题。

Thanks @Frank Schlegel for direct me to CITemperatureAndTint Filter with inputNeutral and inputTargetNeutral . 感谢@Frank Schlegel将我CITemperatureAndTint到具有inputNeutralinputTargetNeutral CITemperatureAndTint过滤器。 Please see the below Core Image Filter Parameter to get Warm and Cold tone effect : 请查看下面的核心图像滤镜参数以获取暖色调和冷色调效果:

filter = CIFilter(name: "CITemperatureAndTint")!

//cold //冷

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

//warm //暖

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM