GPUImage翻译二:内置滤镜(颜色调整)

内置滤镜 (Built-in filters

本框架内置了125种滤镜,分为以下几类:

颜色调整(Color adjustments

  • GPUImageBrightnessFilter:亮度。
    brightness: 默认为0.0,范围[-1.0, 1.0]

  • GPUImageExposureFilter: 曝光度。
    exposure: 默认为0.0, 范围[-10.0, 10.0]

  • GPUImageContrastFilter: 对比度。
    contrast: 默认1.0,范围[0.0, 4.0]

  • GPUImageSaturationFilter: 饱和度
    saturation: 饱和度和去饱和度,默认为1.0,范围[0.0, 2.0]

  • GPUImageGammaFilter: 伽马值(Gamma)。
    gamma: 默认为1.0,范围[0.0, 3.0]

  • GPUImageLevelsFilter:类似Photoshop中的色阶(levels)。 参数 min, max, minOutmaxOut 都是 float 类型,范围 [0, 1]。 Photoshop获取的参数值是从[0, 255],需要转换成[0, 1]。参数 gamma/mid 也是 float >= 0\,这个值跟Photoshop一致。 If you want to apply levels to RGB as well as individual channels you need to use this filter twice - first for the individual channels and then for all channels.

  • GPUImageColorMatrixFilter: Transforms the colors of an image by applying a matrix to them通过矩阵(matrix)转换图片颜色。
    colorMatrix:一个4x4的矩阵应用于图片的每种颜色
    intensity:每个像素新转换的颜色替换原始颜色的一个度数。

  • GPUImageRGBFilter: RGB值。
    red: Normalized values by which each color channel is multiplied. 默认为1.0, 范围[0.0, 1.0].
    green
    blue

  • GPUImageHueFilter: 色相(Hue值)。
    hue: hue 角(angle), 以度(degrees)为单位。默认是90度。

  • GPUImageVibranceFilter:自然饱和度(vibrance)。
    vibrance: 默认为0.0。建议范围为[-1.2, 1.2]

  • GPUImageWhiteBalanceFilter: 白平衡。
    temperature: temperature(温度)属性以ºK为单位。默认为50004000时偏冷,7000时偏暖。注意,4000-5000的尺度视觉上跟5000-7000的尺度视觉上一样重要(Note that the scale between 4000 and 5000 is nearly as visually significant as that between 5000 and 7000).
    tint: 色彩值为 -200时 偏绿 , 200时偏粉(pink),默认为0。

  • GPUImageToneCurveFilter: 根据每个颜色通道的样条曲线(spline curves)调整图片的颜色。
    redControlPoints:
    greenControlPoints:
    blueControlPoints:
    rgbCompositeControlPoints: 色调曲线(tone curve)接受一系列的控制点,来为每种颜色元素定义样条曲线(spline curve)。 它们以CGPoints的形式用NSValue包装并保存在NSArray中,其中X、Y坐标都是从[0, 1]。 默认是 (0,0), (0.5,0.5), (1,1).

  • GPUImageHighlightShadowFilter: 阴影和高亮。
    shadows: 值越大阴影越淡,默认是0.0,范围[0.0, 1.0]
    highlights: 值越小高亮效果越深,默认为1.0,范围[1.0, 0.0]

  • GPUImageHighlightShadowTintFilter: 通过颜色和亮度(intensity)对图片的阴影和高亮(hightlights)着色。
    shadowTintColor: Shadow tint RGB color (GPUVector4). 默认: {1.0f, 0.0f, 0.0f, 1.0f} (red).
    highlightTintColor: Highlight tint RGB color (GPUVector4). 默认: {0.0f, 0.0f, 1.0f, 1.0f} (blue).
    shadowTintIntensity: Shadow tint intensity, 范围[0, 1]. 默认0。
    highlightTintIntensity: Highlight tint intensity, 范围[0, 1], 默认0。

  • GPUImageLookupFilter: 使用RGB查找(lookup)图片,重新绘制图中的颜色。首先,用你最喜欢的图片编辑工具给工程中的lookup.png图片加一个滤镜。 要想准确,每种像素颜色必须不能依赖其他像素(如,模糊效果就不会起作用)。如果需要更复杂的滤镜,可以根据需要创建查找表(lookup tables)。准备好之后,用新生成的lookup.png文件作为GPUImageLookupFilter的第二个input。

  • GPUImageAmatorkaFilter: 基于Photoshop中的 Amatorka 动作的图片滤镜。要用这个效果,必须添加lookup_amatorka.png文件到程序bundle中。

  • GPUImageMissEtikateFilter: 基于Photoshop中的 Miss Etikate 动作的图片滤镜。要用这个效果,必须添加lookup_miss_etikate.png文件到程序bundle中。

  • GPUImageSoftEleganceFilter: Another lookup-based color remapping(重映射、重测绘) filter。要用这个效果,必须添加lookup_soft_elegance_1.pnglookup_soft_elegance_2.png文件到程序bundle中。

  • GPUImageSkinToneFilter: 肤色调整滤镜,影响的范围一个独特的浅肤色( light skin-tone colors)的范围,调整粉色/绿色( pink/green)或者粉色/橘黄色(pink/orange)范围。 默认是针对白种人的肤色(fair caucasian skin),不过可根据需要调整。
    skinToneAdjust: 调整皮肤色调(Amount to adjust skin tone)。默认: 0.0, 建议范围 [-0.3, 0.3]
    skinHue: 被检测的皮肤色相(Skin hue to be detected)。 默认: 0.05 (白种人肤色偏红/fair caucasian to reddish skin).
    skinHueThreshold: Amount of variance(变化、方差) in skin hue. 默认: 40.0.
    maxHueShift: 允许最大的色相移动量(Maximum amount of hue shifting allowed). 默认: 0.25.
    maxSaturationShift =要移动的最大饱和度(当使用橘黄色时)= Maximum amount of saturation to be shifted (when using orange). 默认: 0.4.
    upperSkinToneColor = GPUImageSkinToneUpperColorGreenGPUImageSkinToneUpperColorOrange

  • GPUImageColorInvertFilter: 反转颜色。

  • GPUImageGrayscaleFilter: 将图片转为灰阶(grayscale)(略快的实现饱和度滤镜,但不能改变颜色的贡献 a slightly faster implementation of the saturation filter, without the ability to vary the color contribution

  • GPUImageMonochromeFilter: 根据每个像素的亮度(luminance)将图片转为单色版本。
    intensity: 亮度/强度。某种具体的颜色替代正常图片颜色的度。[0, 1],默认为1。
    color: 该效果的基础色, 默认(0.6, 0.45, 0.3, 1.0)

  • GPUImageFalseColorFilter: 在用户指定的两种颜色之间,使用亮度(luminance)来混合。
    firstColor: 两种颜色分别指定了哪些颜色分别代替图像的暗区和亮区。 默认(0.0, 0.0, 0.5)amd (1.0, 0.0, 0.0)
    secondColor:

  • GPUImageHazeFilter: 阴霾(haze) (类似 UV 滤镜,又叫紫外线滤光镜)。

    distance: 应用的颜色的强度(Strength)。 默认0\。 Values between -.3 and .3 are best.
    slope: 颜色变化量. 默认 0\. Values between -.3 and .3 are best.

  • GPUImageSepiaFilter: 简单的 sepia tone 滤镜

    intensity: 褐色色调替换正常图片颜色的度。(范围[0.0 - 1.0], 默认1.0)。

  • GPUImageOpacityFilter: 调整传入图片的Alpha通道。
    opacity: 改变Alpha值。 ([0.0 - 1.0], 默认 1.0)。

  • GPUImageSolidColorGenerator: 生成一张纯色(solid color)图片。通过-forceProcessingAtSize:方法设置图片尺寸。
    color: 该属性是一个由四种元素构成的结构体,用于填充图片。

  • GPUImageLuminanceThresholdFilter: 亮度(luminance)高于阈值(threshold)的像素将显示为白色,反之为黑色。
    threshold: The luminance threshold(亮度阈值), 范围[0.0 to 1.0], 默认 0.5

  • GPUImageAdaptiveThresholdFilter: 确定一个像素点周围的局部亮度(local luminance)。 然后,若低于该局部亮度将该像素点转为黑色,反之转为白色。这对于在不停变化亮度的情况下识别文字很有帮助。
    blurRadiusInPixels: A multiplier for the background averaging blur radius in pixels (以像素为单位的背景平均模糊半径的乘数), 默认4.

  • GPUImageAverageLuminanceThresholdFilter: 这适用于阈值操作,当阈值不停地根据场景的平均亮度不断变化的情况。
    thresholdMultiplier: This is a factor that the average luminance will be multiplied by in order to arrive at the final threshold to use。 默认1.0

  • GPUImageHistogramFilter: 分析图片并用每种色值出现的频率创建一个直方图(histogram)。该滤镜输出的是一个3像素高256像素宽的图片,图片垂直中心的像素包含了对应各个颜色出现频率的像素。每种色值占据了256宽的一个像素位置,从左到右分别是[0, 255]。 该直方图可以用于单个颜色通道(kGPUImageHistogramRed, kGPUImageHistogramGreen, kGPUImageHistogramBlue), 图片亮度(kGPUImageHistogramLuminance), 或者同时三种颜色 (kGPUImageHistogramRGB).
    downsamplingFactor: 并不是对每个像素进行采样,而是指定图像的哪一部分被采样。默认16,最小值为1。这需要阻止直方图被饱和(saturating),直方图在每个颜色值过载(overloaded)之前只能记录256个像素。

  • GPUImageHistogramGenerator: This is a special filter, in that it's primarily intended to work with the GPUImageHistogramFilter. It generates an output representation of the color histograms generated by GPUImageHistogramFilter, but it could be repurposed to display other kinds of values. It takes in an image and looks at the center (vertical) pixels. It then plots the numerical values of the RGB components in separate colored graphs in an output texture. You may need to force a size for this filter in order to make its output visible.

  • GPUImageAverageColor: This processes an input image and determines the average color of the scene, by averaging the RGBA components for each pixel in the image. A reduction process is used to progressively downsample the source image on the GPU, followed by a short averaging calculation on the CPU. The output from this filter is meaningless, but you need to set the colorAverageProcessingFinishedBlock property to a block that takes in four color components and a frame time and does something with them.

  • GPUImageLuminosity: Like the GPUImageAverageColor, this reduces an image to its average luminosity. You need to set the luminosityProcessingFinishedBlock to handle the output of this filter, which just returns a luminosity value and a frame time.

  • GPUImageChromaKeyFilter: For a given color in the image, sets the alpha channel to 0. This is similar to the GPUImageChromaKeyBlendFilter, only instead of blending in a second image for a matching color this doesn't take in a second image and just turns a given color transparent.

    • thresholdSensitivity: How close a color match needs to exist to the target color to be replaced (default of 0.4)
    • smoothing: How smoothly to blend for the color match (default of 0.1)

你可能感兴趣的:(GPUImage翻译二:内置滤镜(颜色调整))