GPUImage翻譯五:內(nèi)置濾鏡 (視覺效果Visual effects)

視覺效果 (Visual effects)

  • GPUImagePixellateFilter: Applies a pixellation effect on an image or video

    • fractionalWidthOfAPixel: How large the pixels are, as a fraction of the width and height of the image (0.0 - 1.0, default 0.05)
  • GPUImagePolarPixellateFilter: Applies a pixellation effect on an image or video, based on polar coordinates instead of Cartesian ones

    • center: The center about which to apply the pixellation, defaulting to (0.5, 0.5)
    • pixelSize: The fractional pixel size, split into width and height components. The default is (0.05, 0.05)
  • GPUImagePolkaDotFilter: Breaks an image up into colored dots within a regular grid

    • fractionalWidthOfAPixel: How large the dots are, as a fraction of the width and height of the image (0.0 - 1.0, default 0.05)
    • dotScaling: What fraction of each grid space is taken up by a dot, from 0.0 to 1.0 with a default of 0.9.
  • GPUImageHalftoneFilter: Applies a halftone effect to an image, like news print

    • fractionalWidthOfAPixel: How large the halftone dots are, as a fraction of the width and height of the image (0.0 - 1.0, default 0.05)
  • GPUImageCrosshatchFilter: This converts an image into a black-and-white crosshatch pattern

    • crossHatchSpacing: The fractional width of the image to use as the spacing for the crosshatch. The default is 0.03.
    • lineWidth: A relative width for the crosshatch lines. The default is 0.003.
  • GPUImageSketchFilter: Converts video to look like a sketch. This is just the Sobel edge detection filter with the colors inverted

    • texelWidth:
    • texelHeight: These parameters affect the visibility of the detected edges
    • edgeStrength: Adjusts the dynamic range of the filter. Higher values lead to stronger edges, but can saturate the intensity colorspace. Default is 1.0.
  • GPUImageThresholdSketchFilter: Same as the sketch filter, only the edges are thresholded instead of being grayscale

    • texelWidth:
    • texelHeight: These parameters affect the visibility of the detected edges
    • edgeStrength: Adjusts the dynamic range of the filter. Higher values lead to stronger edges, but can saturate the intensity colorspace. Default is 1.0.
    • threshold: Any edge above this threshold will be black, and anything below white. Ranges from 0.0 to 1.0, with 0.8 as the default
  • GPUImageToonFilter: This uses Sobel edge detection to place a black border around objects, and then it quantizes the colors present in the image to give a cartoon-like quality to the image.

    • texelWidth:
    • texelHeight: These parameters affect the visibility of the detected edges
    • threshold: The sensitivity of the edge detection, with lower values being more sensitive. Ranges from 0.0 to 1.0, with 0.2 as the default
    • quantizationLevels: The number of color levels to represent in the final image. Default is 10.0
  • GPUImageSmoothToonFilter: This uses a similar process as the GPUImageToonFilter, only it precedes the toon effect with a Gaussian blur to smooth out noise.

    • texelWidth:
    • texelHeight: These parameters affect the visibility of the detected edges
    • blurRadiusInPixels: The radius of the underlying Gaussian blur. The default is 2.0.
    • threshold: The sensitivity of the edge detection, with lower values being more sensitive. Ranges from 0.0 to 1.0, with 0.2 as the default
    • quantizationLevels: The number of color levels to represent in the final image. Default is 10.0
  • GPUImageEmbossFilter: Applies an embossing effect on the image

    • intensity: The strength of the embossing, from 0.0 to 4.0, with 1.0 as the normal level
  • GPUImagePosterizeFilter: This reduces the color dynamic range into the number of steps specified, leading to a cartoon-like simple shading of the image.

    • colorLevels: The number of color levels to reduce the image space to. This ranges from 1 to 256, with a default of 10.
  • GPUImageSwirlFilter: 旋渦形變币砂。

    • radius: 半徑默認(rèn)0.5.
    • center: 中心點(diǎn)范圍(0, 1.0), 默認(rèn)(0.5, 0.5)岩齿。
    • angle: 形變量, 默認(rèn) 1.0
  • GPUImageBulgeDistortionFilter: 凸起形變。

    • radius: 半徑默認(rèn) 0.25
    • center: 要形變圖片的中心點(diǎn),范圍(0, 1)护奈,默認(rèn)(0.5, 0.5)绊寻。
    • scale: 形變量, 范圍(-1.0, 1.0), 默認(rèn) 0.5
  • GPUImagePinchDistortionFilter: 擠壓形變(Pinch)复斥。

    • radius: 形變半徑营密,默認(rèn)1.0
    • center: 要形變圖片的中心點(diǎn)目锭,范圍(0, 1)评汰,默認(rèn)(0.5, 0.5)
    • scale: 形變量, 范圍(-2.0, 2.0), 默認(rèn) 1.0痢虹。
  • GPUImageStretchDistortionFilter: 拉伸變形被去。

    • center: 要形變圖片的中心點(diǎn),范圍(0, 1)奖唯,默認(rèn)(0.5, 0.5)惨缆。
  • GPUImageSphereRefractionFilter: 模擬通過玻璃球的折射。

    • center: 形變的中心點(diǎn)丰捷,默認(rèn)(0.5, 0.5)坯墨。
    • radius: 形變的半徑,范圍(0, 1), 默認(rèn) 0.25病往。
    • refractiveIndex: 球體的折射率捣染,默認(rèn)0.71
  • GPUImageGlassSphereFilter: 玻璃球荣恐,跟 GPUImageSphereRefractionFilter類似, 只有圖像沒有反轉(zhuǎn)液斜,玻璃的邊緣有一些磨砂。

    • center: 形變的中心點(diǎn)叠穆,默認(rèn)(0.5, 0.5)少漆。
    • radius: 形變的半徑,范圍(0, 1), 默認(rèn) 0.25硼被。
    • refractiveIndex: 球體的折射率示损,默認(rèn)0.71
  • GPUImageVignetteFilter: 暗角(暈影)

    • vignetteCenter: 暗角中心點(diǎn) (CGPoint), 默認(rèn)(0.5, 0.5)嚷硫。
    • vignetteColor: 暗角顏色 ( GPUVector3), 默認(rèn)黑色检访。
    • vignetteStart: 暗角效果開始距中心點(diǎn)的標(biāo)準(zhǔn)化距離,默認(rèn)0.5仔掸。
    • vignetteEnd: 暗角效果結(jié)束距中心點(diǎn)的標(biāo)準(zhǔn)化距離, 默認(rèn) 0.75脆贵。
  • GPUImageKuwaharaFilter: Kuwahara 圖抽象,取材于Kyprianidis等人發(fā)表在GPU Pro叢刊中的"Anisotropic Kuwahara Filtering on the GPU起暮。
    他們生成了一種類似油畫的圖像卖氨,但計(jì)算量極大,所以在iPad 2上面渲染一幀就需要幾秒。這可能最適合用于靜態(tài)圖筒捺。

    • radius: 整數(shù)類型柏腻,用于當(dāng)應(yīng)用濾鏡時(shí)測(cè)試中心像素以外的像素?cái)?shù),默認(rèn)值4系吭。值越高五嫂,圖像會(huì)越抽象,處理所花的時(shí)間也會(huì)越長(zhǎng)肯尺。
  • GPUImagePerlinNoiseFilter: 生成充滿「柏林噪音」的圖像沃缘。

    • colorStart:GPUVector4類型,默認(rèn)白色则吟。
    • colorFinish: 生成噪音的顏色范圍孩灯,GPUVector4類型,默認(rèn)黑色逾滥。
    • scale: 要生成噪音的尺度,默認(rèn)值8败匹,最低值1寨昙,值越高點(diǎn)越小,可通過混合模式生成噪點(diǎn)掀亩。
  • GPUImageCGAColorspaceFilter: 模擬CGA顯示器的色彩空間(Simulates the colorspace of a CGA monitor)舔哪。

  • GPUImageMosaicFilter(馬賽克): 此濾鏡采用輸入圖塊集,圖塊必須以亮度提升(This filter takes an input tileset, the tiles must ascend in luminance)槽棍。 It looks at the input image and replaces each display tile with an input tile according to the luminance of that tile. The idea was to replicate the ASCII video filters seen in other apps, but the tileset can be anything.

    • inputTileSize:
    • numTiles:
    • displayTileSize:
    • colorOn:
  • GPUImageJFAVoronoiFilter: 生成Voronoi地圖捉蚤,以備后用。

    • sizeInPixels: 各個(gè)元素的size炼七。
  • GPUImageVoronoiConsumerFilter: Takes in the Voronoi map, and uses that to filter an incoming image.

    • sizeInPixels: 各個(gè)元素的size缆巧。

=======================================================
如上所述,你也可以用類似C語(yǔ)言的OpenGL Shading語(yǔ)言豌拙,很輕松的編寫你自己定義的濾鏡陕悬。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市按傅,隨后出現(xiàn)的幾起案子捉超,更是在濱河造成了極大的恐慌,老刑警劉巖唯绍,帶你破解...
    沈念sama閱讀 212,542評(píng)論 6 493
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件拼岳,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡况芒,警方通過查閱死者的電腦和手機(jī)惜纸,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,596評(píng)論 3 385
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人堪簿,你說我怎么就攤上這事痊乾。” “怎么了椭更?”我有些...
    開封第一講書人閱讀 158,021評(píng)論 0 348
  • 文/不壞的土叔 我叫張陵哪审,是天一觀的道長(zhǎng)。 經(jīng)常有香客問我虑瀑,道長(zhǎng)湿滓,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 56,682評(píng)論 1 284
  • 正文 為了忘掉前任舌狗,我火速辦了婚禮叽奥,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘痛侍。我一直安慰自己朝氓,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 65,792評(píng)論 6 386
  • 文/花漫 我一把揭開白布主届。 她就那樣靜靜地躺著赵哲,像睡著了一般。 火紅的嫁衣襯著肌膚如雪君丁。 梳的紋絲不亂的頭發(fā)上枫夺,一...
    開封第一講書人閱讀 49,985評(píng)論 1 291
  • 那天,我揣著相機(jī)與錄音绘闷,去河邊找鬼橡庞。 笑死,一個(gè)胖子當(dāng)著我的面吹牛印蔗,可吹牛的內(nèi)容都是我干的扒最。 我是一名探鬼主播,決...
    沈念sama閱讀 39,107評(píng)論 3 410
  • 文/蒼蘭香墨 我猛地睜開眼喻鳄,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼扼倘!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起除呵,我...
    開封第一講書人閱讀 37,845評(píng)論 0 268
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤再菊,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后颜曾,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體纠拔,經(jīng)...
    沈念sama閱讀 44,299評(píng)論 1 303
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,612評(píng)論 2 327
  • 正文 我和宋清朗相戀三年泛豪,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了稠诲。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片侦鹏。...
    茶點(diǎn)故事閱讀 38,747評(píng)論 1 341
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖臀叙,靈堂內(nèi)的尸體忽然破棺而出略水,到底是詐尸還是另有隱情,我是刑警寧澤劝萤,帶...
    沈念sama閱讀 34,441評(píng)論 4 333
  • 正文 年R本政府宣布渊涝,位于F島的核電站,受9級(jí)特大地震影響床嫌,放射性物質(zhì)發(fā)生泄漏跨释。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 40,072評(píng)論 3 317
  • 文/蒙蒙 一厌处、第九天 我趴在偏房一處隱蔽的房頂上張望鳖谈。 院中可真熱鬧,春花似錦阔涉、人聲如沸缆娃。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,828評(píng)論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)龄恋。三九已至,卻和暖如春凶伙,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背它碎。 一陣腳步聲響...
    開封第一講書人閱讀 32,069評(píng)論 1 267
  • 我被黑心中介騙來泰國(guó)打工函荣, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人扳肛。 一個(gè)月前我還...
    沈念sama閱讀 46,545評(píng)論 2 362
  • 正文 我出身青樓傻挂,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親挖息。 傳聞我的和親對(duì)象是個(gè)殘疾皇子金拒,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 43,658評(píng)論 2 350

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