• GPUImage简单滤镜使用之色阶(三)


      色阶是表示图像亮度强弱的指数标准,图像的色彩丰满度和精细度是由色阶决定的。在GPUImage中GPUImageLevelsFilter提供了此功能。

      GPUImageLevelsFilter定义了修改红色,绿色,蓝色,和所有通道的方法,有效值范围时0.0-1.0之间,如果你想想像ps中那样,你必须先转为[0,1]。

    /** Set levels for the red channel */

    - (void)setRedMin:(CGFloat)min gamma:(CGFloat)mid max:(CGFloat)max minOut:(CGFloat)minOut maxOut:(CGFloat)maxOut;

    - (void)setRedMin:(CGFloat)min gamma:(CGFloat)mid max:(CGFloat)max;

    /** Set levels for the green channel */

    - (void)setGreenMin:(CGFloat)min gamma:(CGFloat)mid max:(CGFloat)max minOut:(CGFloat)minOut maxOut:(CGFloat)maxOut;

    - (void)setGreenMin:(CGFloat)min gamma:(CGFloat)mid max:(CGFloat)max;

    /** Set levels for the blue channel */

    - (void)setBlueMin:(CGFloat)min gamma:(CGFloat)mid max:(CGFloat)max minOut:(CGFloat)minOut maxOut:(CGFloat)maxOut;

    - (void)setBlueMin:(CGFloat)min gamma:(CGFloat)mid max:(CGFloat)max;

    /** Set levels for all channels at once */

    - (void)setMin:(CGFloat)min gamma:(CGFloat)mid max:(CGFloat)max minOut:(CGFloat)minOut maxOut:(CGFloat)maxOut;

    - (void)setMin:(CGFloat)min gamma:(CGFloat)mid max:(CGFloat)max;

        filter = [[GPUImageLevelsFilter alloc] init];
        [filter setMin:[[(UITextField *)[self viewWithTag:1001] text] floatValue]     gamma:[[(UITextField *)[self viewWithTag:1002] text] floatValue] max:    [[(UITextField *)[self viewWithTag:1003] text] floatValue] minOut:[[(UITextField *)[self viewWithTag:1004] text] floatValue] maxOut:[[(UITextField *)[self viewWithTag:1005] text] floatValue]];
    
        [filter forceProcessingAtSize:img.size];
        GPUImagePicture *pic = [[GPUImagePicture alloc] initWithImage:img];
        [pic addTarget:filter];
        [pic processImage];
        [filter useNextFrameForImageCapture];
        self.imgView.image = [filter imageFromCurrentFramebuffer];    

  • 相关阅读:
    团队介绍与选题报告
    实验6:开源控制器实践——RYU
    二叉搜索树的2层结点统计 (25 分)
    2020团队程学设计天梯赛-总决赛
    口罩发放 (25 分)
    九宫格输入法
    检查密码
    暑期训练10-1010
    暑期训练09-1003
    数据结构之循环队列
  • 原文地址:https://www.cnblogs.com/salam/p/4982791.html
Copyright © 2020-2023  润新知