目錄
公司主營(yíng)業(yè)務(wù):成都網(wǎng)站制作、網(wǎng)站設(shè)計(jì)、移動(dòng)網(wǎng)站開(kāi)發(fā)等業(yè)務(wù)。幫助企業(yè)客戶真正實(shí)現(xiàn)互聯(lián)網(wǎng)宣傳,提高企業(yè)的競(jìng)爭(zhēng)能力。成都創(chuàng)新互聯(lián)公司是一支青春激揚(yáng)、勤奮敬業(yè)、活力青春激揚(yáng)、勤奮敬業(yè)、活力澎湃、和諧高效的團(tuán)隊(duì)。公司秉承以“開(kāi)放、自由、嚴(yán)謹(jǐn)、自律”為核心的企業(yè)文化,感謝他們對(duì)我們的高要求,感謝他們從不同領(lǐng)域給我們帶來(lái)的挑戰(zhàn),讓我們激情的團(tuán)隊(duì)有機(jī)會(huì)用頭腦與智慧不斷的給客戶帶來(lái)驚喜。成都創(chuàng)新互聯(lián)公司推出懷柔免費(fèi)做網(wǎng)站回饋大家。
零基礎(chǔ) OpenGL (ES) 學(xué)習(xí)路線推薦 : OpenGL (ES) 學(xué)習(xí)目錄 >> OpenGL ES 基礎(chǔ)
零基礎(chǔ) OpenGL (ES) 學(xué)習(xí)路線推薦 : OpenGL (ES) 學(xué)習(xí)目錄 >> OpenGL ES 轉(zhuǎn)場(chǎng)
零基礎(chǔ) OpenGL (ES) 學(xué)習(xí)路線推薦 : OpenGL (ES) 學(xué)習(xí)目錄 >> OpenGL ES 特效
零基礎(chǔ) OpenGL (ES) 學(xué)習(xí)路線推薦 : OpenGL (ES) 學(xué)習(xí)目錄 >> OpenGL ES 函數(shù)
零基礎(chǔ) OpenGL (ES) 學(xué)習(xí)路線推薦 : OpenGL (ES) 學(xué)習(xí)目錄 >> OpenGL ES GPUImage 使用
零基礎(chǔ) OpenGL (ES) 學(xué)習(xí)路線推薦 : OpenGL (ES) 學(xué)習(xí)目錄 >> OpenGL ES GLSL 編程
GPUImage 共 125 個(gè)濾鏡, 分為四類
1、Color adjustments : 31 filters , 顏色處理相關(guān)
2、Image processing : 40 filters , 圖像處理相關(guān).
3、Blending modes : 29 filters , 混合模式相關(guān).
4、Visual effects : 25 filters , 視覺(jué)效果相關(guān).
GPUImageLookupFilter 屬于 GPUImage 顏色處理相關(guān),用來(lái)處理圖片 lookup 濾鏡
GPUImageLookupFilter:使用 RGB 顏色查找圖像在一個(gè)圖像中重新映射的顏色。 首先,使用您最喜歡的照片編輯應(yīng)用程序,對(duì)
GPUImage / framework / Resources
中 lookup.png 應(yīng)用一個(gè)過(guò)濾器。 為了使其正常工作,每個(gè)像素顏色必須不依賴于其他像素(例如,模糊不起作用)。 如果您需要更復(fù)雜的過(guò)濾器,則可以根據(jù)需要?jiǎng)?chuàng)建任意數(shù)量的查找表。 一旦準(zhǔn)備就緒,請(qǐng)使用新的 lookup.png 文件作為GPUImageLookupFilter
的第二個(gè)輸入。
shader 源碼如下:
/******************************************************************************************/
//@Author:猿說(shuō)編程
//@Blog(個(gè)人博客地址): www.codersrc.com
//@File:IOS – OpenGL ES 設(shè)置圖像 lookup 濾鏡 GPUImageLookupFilter
//@Time:2022/04/07 07:30
//@Motto:不積跬步無(wú)以至千里,不積小流無(wú)以成江海,程序人生的精彩需要堅(jiān)持不懈地積累!
/******************************************************************************************/
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
NSString *const kGPUImageLookupFragmentShaderString = SHADER_STRING
(
varying highp vec2 textureCoordinate;
varying highp vec2 textureCoordinate2; // TODO: This is not used
uniform sampler2D inputImageTexture;
uniform sampler2D inputImageTexture2; // lookup texture
uniform lowp float intensity;
void main()
{
highp vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);
highp float blueColor = textureColor.b * 63.0;
highp vec2 quad1;
quad1.y = floor(floor(blueColor) / 8.0);
quad1.x = floor(blueColor) - (quad1.y * 8.0);
highp vec2 quad2;
quad2.y = floor(ceil(blueColor) / 8.0);
quad2.x = ceil(blueColor) - (quad2.y * 8.0);
highp vec2 texPos1;
texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);
texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);
highp vec2 texPos2;
texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);
texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);
lowp vec4 newColor1 = texture2D(inputImageTexture2, texPos1);
lowp vec4 newColor2 = texture2D(inputImageTexture2, texPos2);
lowp vec4 newColor = mix(newColor1, newColor2, fract(blueColor));
gl_FragColor = mix(textureColor, vec4(newColor.rgb, textureColor.w), intensity);
}
);
#else
NSString *const kGPUImageLookupFragmentShaderString = SHADER_STRING
(
varying vec2 textureCoordinate;
varying vec2 textureCoordinate2; // TODO: This is not used
uniform sampler2D inputImageTexture;
uniform sampler2D inputImageTexture2; // lookup texture
uniform float intensity;
void main()
{
vec4 textureColor = texture2D(inputImageTexture, textureCoordinate);
float blueColor = textureColor.b * 63.0;
vec2 quad1;
quad1.y = floor(floor(blueColor) / 8.0);
quad1.x = floor(blueColor) - (quad1.y * 8.0);
vec2 quad2;
quad2.y = floor(ceil(blueColor) / 8.0);
quad2.x = ceil(blueColor) - (quad2.y * 8.0);
vec2 texPos1;
texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);
texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);
vec2 texPos2;
texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.r);
texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * textureColor.g);
vec4 newColor1 = texture2D(inputImageTexture2, texPos1);
vec4 newColor2 = texture2D(inputImageTexture2, texPos2);
vec4 newColor = mix(newColor1, newColor2, fract(blueColor));
gl_FragColor = mix(textureColor, vec4(newColor.rgb, textureColor.w), intensity);
}
);
#endif
使用 ** **GPUImageLookupFilter**** 處理圖片 ****lookup 濾鏡****,原圖:
效果圖:
OpenGL ES Demo 下載地址 : IOS – OpenGL ES 設(shè)置圖像 lookup 濾鏡 GPUImageLookupFilter
本文由博客 - 猿說(shuō)編程 猿說(shuō)編程 發(fā)布!
分享名稱:IOS – OpenGL ES 設(shè)置圖像 lookup 濾鏡 GPUImageLookupFilter
轉(zhuǎn)載來(lái)源:http://chinadenli.net/article36/dsoijsg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供自適應(yīng)網(wǎng)站、定制開(kāi)發(fā)、云服務(wù)器、定制網(wǎng)站、品牌網(wǎng)站建設(shè)、App開(kāi)發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)