GPUImage翻譯二:內(nèi)置濾鏡(顏色調(diào)整)

內(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, minOutmaxOut 都是 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.pnglookup_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 = GPUImageSkinToneUpperColorGreenGPUImageSkinToneUpperColorOrange

  • 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)
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市芦鳍,隨后出現(xiàn)的幾起案子嚷往,更是在濱河造成了極大的恐慌,老刑警劉巖怜校,帶你破解...
    沈念sama閱讀 217,734評論 6 505
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件间影,死亡現(xiàn)場離奇詭異注竿,居然都是意外死亡茄茁,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,931評論 3 394
  • 文/潘曉璐 我一進店門巩割,熙熙樓的掌柜王于貴愁眉苦臉地迎上來裙顽,“玉大人,你說我怎么就攤上這事宣谈∮蹋” “怎么了?”我有些...
    開封第一講書人閱讀 164,133評論 0 354
  • 文/不壞的土叔 我叫張陵,是天一觀的道長漩怎。 經(jīng)常有香客問我勋颖,道長,這世上最難降的妖魔是什么勋锤? 我笑而不...
    開封第一講書人閱讀 58,532評論 1 293
  • 正文 為了忘掉前任饭玲,我火速辦了婚禮,結(jié)果婚禮上叁执,老公的妹妹穿的比我還像新娘茄厘。我一直安慰自己,他們只是感情好谈宛,可當我...
    茶點故事閱讀 67,585評論 6 392
  • 文/花漫 我一把揭開白布次哈。 她就那樣靜靜地躺著,像睡著了一般吆录。 火紅的嫁衣襯著肌膚如雪窑滞。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,462評論 1 302
  • 那天径筏,我揣著相機與錄音葛假,去河邊找鬼。 笑死滋恬,一個胖子當著我的面吹牛聊训,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播恢氯,決...
    沈念sama閱讀 40,262評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼带斑,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了勋拟?” 一聲冷哼從身側(cè)響起勋磕,我...
    開封第一講書人閱讀 39,153評論 0 276
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎敢靡,沒想到半個月后挂滓,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,587評論 1 314
  • 正文 獨居荒郊野嶺守林人離奇死亡啸胧,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,792評論 3 336
  • 正文 我和宋清朗相戀三年赶站,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片纺念。...
    茶點故事閱讀 39,919評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡贝椿,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出陷谱,到底是詐尸還是另有隱情烙博,我是刑警寧澤,帶...
    沈念sama閱讀 35,635評論 5 345
  • 正文 年R本政府宣布,位于F島的核電站渣窜,受9級特大地震影響铺根,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜乔宿,卻給世界環(huán)境...
    茶點故事閱讀 41,237評論 3 329
  • 文/蒙蒙 一夷都、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧予颤,春花似錦囤官、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,855評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至驳庭,卻和暖如春刑顺,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背饲常。 一陣腳步聲響...
    開封第一講書人閱讀 32,983評論 1 269
  • 我被黑心中介騙來泰國打工蹲堂, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人贝淤。 一個月前我還...
    沈念sama閱讀 48,048評論 3 370
  • 正文 我出身青樓柒竞,卻偏偏與公主長得像,于是被迫代替她去往敵國和親播聪。 傳聞我的和親對象是個殘疾皇子朽基,可洞房花燭夜當晚...
    茶點故事閱讀 44,864評論 2 354

推薦閱讀更多精彩內(nèi)容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,331評論 0 10
  • 《老屋魂》內(nèi)容簡介 目錄 每個人都有一個心靈家園。 只要有了精神寄托离陶,心靈家園就永遠不會荒蕪稼虎。 ...
    馮俊龍閱讀 1,186評論 2 20
  • #口號(王默涵的時間管理打卡)# 孩子第2個30天目標:每天放學回家吃青蛙,學會列清單 媽媽第2個30天目標:陪伴...
    愛當娜閱讀 131評論 0 0
  • 1.我在幻想著招刨,幻想在破滅著霎俩,幻想總把破滅寬恕,破滅卻從不把幻想放過沉眶〈蛉矗《我的幻想》 2.黑夜給了我黑色的眼睛,我卻...
    飛燕無塵閱讀 966評論 0 0