如何在iOS中应用冷色调和暖色调CIFilter? [英] How to apply Cool and warm tone CIFilter in iOS?
问题描述
我正在使用 Swift iOS $ c $中基于
视频
的应用程序
c>。我在哪里使用 AVPlayer
播放视频
并设置 CIFilters
在视频
上使用 AVVideoComposition
。我必须在视频
上应用冷暖色调滤镜效果
(请参见下图)。
有人可以工作吗? d就一样吗?请建议我。
感谢@Frank Schlegel将我定向到 CITemperatureAndTint
使用 inputNeutral
和 inputTargetNeutral
进行过滤。请参阅下面的核心图像滤镜参数以获取暖色调和冷色调效果:
filter = CIFilter(name: CITemperatureAndTint) !
//冷
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)
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
.
Can anyone have worked on the same? Please suggest me.
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")
这篇关于如何在iOS中应用冷色调和暖色调CIFilter?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!