內(nèi)置濾鏡 (Built-in filters
)
本框架內(nèi)置了125種濾鏡萍程,分為以下幾類:
顏色調(diào)整(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)测秸。 參數(shù)
min
,max
,minOut
,maxOut
都是 float 類型灾常,范圍[0, 1]
霎冯。 Photoshop獲取的參數(shù)值是從[0, 255]
,需要轉(zhuǎn)換成[0, 1]
钞瀑。參數(shù)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)轉(zhuǎn)換圖片顏色雕什。
colorMatrix
:一個4x4的矩陣應用于圖片的每種顏色
intensity
:每個像素新轉(zhuǎn)換的顏色替換原始顏色的一個度數(shù)关串。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(溫度)屬性以oK為單位落剪。默認為5000
睁本,4000
時偏冷,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: 根據(jù)每個顏色通道的樣條曲線(spline curves)調(diào)整圖片的顏色。
redControlPoints
:
greenControlPoints
:
blueControlPoints
:
rgbCompositeControlPoints
: 色調(diào)曲線(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
圖片加一個濾鏡歉胶。 要想準確,每種像素顏色必須不能依賴其他像素(如巴粪,模糊效果就不會起作用)通今。如果需要更復雜的濾鏡,可以根據(jù)需要創(chuàng)建查找表(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.png
和lookup_soft_elegance_2.png
文件到程序bundle中。GPUImageSkinToneFilter: 膚色調(diào)整濾鏡屡拨,影響的范圍一個獨特的淺膚色( light skin-tone colors)的范圍只酥,調(diào)整粉色/綠色( pink/green)或者粉色/橘黃色(pink/orange)范圍。 默認是針對白種人的膚色(fair caucasian skin)洁仗,不過可根據(jù)需要調(diào)整层皱。
skinToneAdjust
: 調(diào)整皮膚色調(diào)(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
=GPUImageSkinToneUpperColorGreen
或GPUImageSkinToneUpperColorOrange
GPUImageColorInvertFilter: 反轉(zhuǎn)顏色她奥。
GPUImageGrayscaleFilter: 將圖片轉(zhuǎn)為灰階(grayscale)(略快的實現(xiàn)飽和度濾鏡瓮增,但不能改變顏色的貢獻
a slightly faster implementation of the saturation filter, without the ability to vary the color contribution
)GPUImageMonochromeFilter: 根據(jù)每個像素的亮度(luminance)將圖片轉(zhuǎn)為單色版本。
intensity
: 亮度/強度哩俭。某種具體的顏色替代正常圖片顏色的度绷跑。[0, 1]
,默認為1凡资。
color
: 該效果的基礎色, 默認(0.6, 0.45, 0.3, 1.0)
砸捏。GPUImageFalseColorFilter: 在用戶指定的兩種顏色之間,使用亮度(luminance)來混合隙赁。
firstColor
: 兩種顏色分別指定了哪些顏色分別代替圖像的暗區(qū)和亮區(qū)垦藏。 默認(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
: 褐色色調(diào)替換正常圖片顏色的度弟灼。(范圍[0.0 - 1.0]
, 默認1.0
)。 GPUImageOpacityFilter: 調(diào)整傳入圖片的Alpha通道冒黑。
opacity
: 改變Alpha
值田绑。 ([0.0 - 1.0]
, 默認1.0
)。GPUImageSolidColorGenerator: 生成一張純色(solid color)圖片抡爹。通過
-forceProcessingAtSize:
方法設置圖片尺寸辛馆。
color
: 該屬性是一個由四種元素構(gòu)成的結(jié)構(gòu)體,用于填充圖片。GPUImageLuminanceThresholdFilter: 亮度(luminance)高于閾值(threshold)的像素將顯示為白色昙篙,反之為黑色腊状。
threshold
: The luminance threshold(亮度閾值), 范圍[0.0 to 1.0]
, 默認0.5
。GPUImageAdaptiveThresholdFilter: 確定一個像素點周圍的局部亮度(local luminance)苔可。 然后缴挖,若低于該局部亮度將該像素點轉(zhuǎn)為黑色,反之轉(zhuǎn)為白色焚辅。這對于在不停變化亮度的情況下識別文字很有幫助映屋。
blurRadiusInPixels
: A multiplier for the background averaging blur radius in pixels (以像素為單位的背景平均模糊半徑的乘數(shù)), 默認4
.GPUImageAverageLuminanceThresholdFilter: 這適用于閾值操作,當閾值不停地根據(jù)場景的平均亮度不斷變化的情況同蜻。
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: 分析圖片并用每種色值出現(xiàn)的頻率創(chuàng)建一個直方圖(histogram)湾蔓。該濾鏡輸出的是一個3像素高256像素寬的圖片瘫析,圖片垂直中心的像素包含了對應各個顏色出現(xiàn)頻率的像素。每種色值占據(jù)了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)