问题
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