目錄
創(chuàng)新互聯(lián)主要從事網(wǎng)站設(shè)計(jì)制作、成都做網(wǎng)站、網(wǎng)頁設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)西山,10余年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):13518219792
零基礎(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 , 視覺效果相關(guān).
GPUImageLuminosity 屬于 GPUImage 顏色處理相關(guān),用來處理圖片亮度平均,像 [GPUImageAverageColor](https://www.codersrc.com/archives/.html)
一樣,將圖像縮小到其平均亮度。
/******************************************************************************************/
//@Author:猿說編程
//@Blog(個(gè)人博客地址): www.codersrc.com
//@File:GPUImage – 亮度平均 GPUImageLuminosity
//@Time:2022/03/25 07:30
//@Motto:不積跬步無以至千里,不積小流無以成江海,程序人生的精彩需要堅(jiān)持不懈地積累!
/******************************************************************************************/
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE
NSString *const kGPUImageInitialLuminosityFragmentShaderString = SHADER_STRING
(
precision highp float;
uniform sampler2D inputImageTexture;
varying highp vec2 outputTextureCoordinate;
varying highp vec2 upperLeftInputTextureCoordinate;
varying highp vec2 upperRightInputTextureCoordinate;
varying highp vec2 lowerLeftInputTextureCoordinate;
varying highp vec2 lowerRightInputTextureCoordinate;
const highp vec3 W = vec3(0.2125, 0.7154, 0.0721);
void main()
{
highp float upperLeftLuminance = dot(texture2D(inputImageTexture, upperLeftInputTextureCoordinate).rgb, W);
highp float upperRightLuminance = dot(texture2D(inputImageTexture, upperRightInputTextureCoordinate).rgb, W);
highp float lowerLeftLuminance = dot(texture2D(inputImageTexture, lowerLeftInputTextureCoordinate).rgb, W);
highp float lowerRightLuminance = dot(texture2D(inputImageTexture, lowerRightInputTextureCoordinate).rgb, W);
highp float luminosity = 0.25 * (upperLeftLuminance + upperRightLuminance + lowerLeftLuminance + lowerRightLuminance);
gl_FragColor = vec4(luminosity, luminosity, luminosity, 1.0);
}
);
NSString *const kGPUImageLuminosityFragmentShaderString = SHADER_STRING
(
precision highp float;
uniform sampler2D inputImageTexture;
varying highp vec2 outputTextureCoordinate;
varying highp vec2 upperLeftInputTextureCoordinate;
varying highp vec2 upperRightInputTextureCoordinate;
varying highp vec2 lowerLeftInputTextureCoordinate;
varying highp vec2 lowerRightInputTextureCoordinate;
void main()
{
highp float upperLeftLuminance = texture2D(inputImageTexture, upperLeftInputTextureCoordinate).r;
highp float upperRightLuminance = texture2D(inputImageTexture, upperRightInputTextureCoordinate).r;
highp float lowerLeftLuminance = texture2D(inputImageTexture, lowerLeftInputTextureCoordinate).r;
highp float lowerRightLuminance = texture2D(inputImageTexture, lowerRightInputTextureCoordinate).r;
highp float luminosity = 0.25 * (upperLeftLuminance + upperRightLuminance + lowerLeftLuminance + lowerRightLuminance);
gl_FragColor = vec4(luminosity, luminosity, luminosity, 1.0);
}
);
#else
NSString *const kGPUImageInitialLuminosityFragmentShaderString = SHADER_STRING
(
uniform sampler2D inputImageTexture;
varying vec2 outputTextureCoordinate;
varying vec2 upperLeftInputTextureCoordinate;
varying vec2 upperRightInputTextureCoordinate;
varying vec2 lowerLeftInputTextureCoordinate;
varying vec2 lowerRightInputTextureCoordinate;
const vec3 W = vec3(0.2125, 0.7154, 0.0721);
void main()
{
float upperLeftLuminance = dot(texture2D(inputImageTexture, upperLeftInputTextureCoordinate).rgb, W);
float upperRightLuminance = dot(texture2D(inputImageTexture, upperRightInputTextureCoordinate).rgb, W);
float lowerLeftLuminance = dot(texture2D(inputImageTexture, lowerLeftInputTextureCoordinate).rgb, W);
float lowerRightLuminance = dot(texture2D(inputImageTexture, lowerRightInputTextureCoordinate).rgb, W);
float luminosity = 0.25 * (upperLeftLuminance + upperRightLuminance + lowerLeftLuminance + lowerRightLuminance);
gl_FragColor = vec4(luminosity, luminosity, luminosity, 1.0);
}
);
NSString *const kGPUImageLuminosityFragmentShaderString = SHADER_STRING
(
uniform sampler2D inputImageTexture;
varying vec2 outputTextureCoordinate;
varying vec2 upperLeftInputTextureCoordinate;
varying vec2 upperRightInputTextureCoordinate;
varying vec2 lowerLeftInputTextureCoordinate;
varying vec2 lowerRightInputTextureCoordinate;
void main()
{
float upperLeftLuminance = texture2D(inputImageTexture, upperLeftInputTextureCoordinate).r;
float upperRightLuminance = texture2D(inputImageTexture, upperRightInputTextureCoordinate).r;
float lowerLeftLuminance = texture2D(inputImageTexture, lowerLeftInputTextureCoordinate).r;
float lowerRightLuminance = texture2D(inputImageTexture, lowerRightInputTextureCoordinate).r;
float luminosity = 0.25 * (upperLeftLuminance + upperRightLuminance + lowerLeftLuminance + lowerRightLuminance);
gl_FragColor = vec4(luminosity, luminosity, luminosity, 1.0);
}
);
#endif
本文由博客 - 猿說編程 猿說編程 發(fā)布!