Also the the saturationMatrix seems to be transposed. The C example at graficaobscura applies the matrix transposed. It depends of course how you apply the matrix, but in general in should be (r',g',b')= M * (r,g,b)...