GPUImage(1) 高斯模糊 亮度调整

原创
2017/01/15 09:45
阅读数 859

贡献者:赵大财
博客:https://my.oschina.net/zhaodacai GitHub:https://github.com/dacaizhao
邮箱: dacai_zhao@163.com  QQ:327532817
============================= 
 

        //高斯模糊
        /*
        let blurFilter = GPUImageGaussianBlurFilter()
        blurFilter.blurRadiusInPixels = 10
        var img = UIImage(named: "mark")
        img = blurFilter.image(byFilteringImage: img)
        let imgView = UIImageView()
        imgView.frame = CGRect(x: 0, y: 200, width: 200, height: 200)
        imgView.image = img
        imgView.backgroundColor = UIColor.red
        view.addSubview(imgView)
        */
        
        
        //调整亮度
        var img = UIImage(named: "mark")
        //创建一个高亮度的滤镜
        let passthroughFilter = GPUImageBrightnessFilter()
        passthroughFilter.brightness = -0.5
        passthroughFilter.forceProcessing(at: img!.size)
        passthroughFilter.useNextFrameForImageCapture()
        //获取数据源
        let stillImageSource = GPUImagePicture(image: img)
        stillImageSource?.addTarget(passthroughFilter)
        stillImageSource?.processImage()
        img = passthroughFilter.imageFromCurrentFramebuffer()
        let imgView = UIImageView()
        imgView.image = img
        imgView.frame = CGRect(x: 0, y: 200, width: 200, height: 200)
        view.addSubview(imgView)

 

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部