我在 GLSL 中有一个阈值过滤器的 CIKernal,如下所示:
let thresholdKernel = CIColorKernel(string:
"kernel vec4 thresholdFilter(__sample pixel, float threshold)" +
"{ " +
" float luma = (pixel.r * 0.2126) + " +
" (pixel.g * 0.7152) + " +
" (pixel.b * 0.0722); " +
" return vec4(step(threshold, luma)); " +
"} "
)”
我想检查像素是否为白色。GLSL 中是否有一个简单的命令可以在没有额外计算的情况下执行此操作?
更新**我想摆脱亮度计算。那么有没有办法在不进行上述亮度计算的情况下检查像素是否为白色?