RGB filters for different forms of color blindness

后端 未结 8 2160
渐次进展
渐次进展 2021-01-31 11:19

My father is color blind and given that I work in games where the visuals are important, I\'ve always wanted to write a filter for screen shots (or even some type of shader) tha

8条回答
  •  遥遥无期
    2021-01-31 12:03

    I have these transformations and code explained in detail on my color blindness page. Essentially, for each type of color blindness you first linearize the RGB values then apply a transformation matrix (this is a product of 5 matrices that I list individually) and then clip to [0,1] and de-linearize back to sRGB.

    For example, for deuteranopia, the matrix product is

     0.33066007 0.66933993 0
     0.33066007 0.66933993 0
    -0.02785538 0.02785538 1   
    

    This is a combination of: rgb -> XYZ -> LMS -> deuteranopia correction -> XYZ -> rgb.

    You can download my R code that illustrates these calculations.

提交回复
热议问题