
This is based on the method described in A Physiologically-based Model for Simulation of Color Vision Deficiency.
To simulate a colour vision deficiency, the vector for each pixel is multiplied by a matrix representing the eye's response in each kind of colour receptor.