2014-09-05 45 views

回答

0

色彩空間是簡單的RGB。與GPUImageSepiaFilter一樣,GPUImageColorMatrixFilter的子類通過將像素的RGBA顏色矢量乘以4x4顏色矩陣來工作。

用於執行此操作的着色器代碼如下:

vec4 textureColor = texture2D(inputImageTexture, textureCoordinate); 
vec4 outputColor = textureColor * colorMatrix; 

gl_FragColor = (intensity * outputColor) + ((1.0 - intensity) * textureColor); 

第二行是其中矩陣乘法發生。 OpenCV可能不會應用相同的矩陣乘法,或者它們可能會在矩陣中使用不同的列與行排序。