How to apply Cool and warm tone CIFilter in iOS?

人盡茶涼 提交于 2019-12-25 19:57:41

问题


I am working on Video based Application in Swift iOS. Where I am using AVPlayer to play the Video and setting CIFilters on Video using AVVideoComposition. I have to apply Cool and warm tone filter effects on my Videos (please see the below images).

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.

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

Can anyone have worked on the same? Please suggest me.


回答1:


Thanks @Frank Schlegel for direct me to CITemperatureAndTint Filter with inputNeutral and inputTargetNeutral. 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")



回答2:


It seems like the CITemperatureAndTint filter is what you are looking for. I frankly don't know exactly how the parameters work, but maybe you can check out this or this related question.



来源:https://stackoverflow.com/questions/55177053/how-to-apply-cool-and-warm-tone-cifilter-in-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!