How To Apply GPUImage filters efficiently?

爱⌒轻易说出口 提交于 2019-12-06 21:12:04

This is how I would simply setup the filters using GPUImage2 in swift based upon what I think you are after. Image into color filter, then into source 1 of dissolve blend (mix 0.0). Then send the color filter into the kuwahara filter and then into source 2 of the dissolve blend. From there you can just transition between the two and change the radius however much you want.

func setupFilters() {
    image --> colorFilter --> dissolveBlend
    colorFilter --> kuwaharaFilter --> dissolveBlend --> renderView
    dissolveBlend.mix = 0.0
}

func addWaterColorEffect(withRadius : Int = 5){
    kuwaharaFilter.radius = withRadius
    dissolveBlend.mix = 1.0 
    // This will not give you a transition but you can use a while loop or timer 
    // to change the mix over the course of whatever length of time you are seeking.
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!