RGB filters for different forms of color blindness

2020-05-16 05:51发布

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) that emulated different forms of color blindness.

I've seen plenty of references but never have been able to track down algorithms.

Any algorithms would be appreciated.

7条回答
做个烂人
2楼-- · 2020-05-16 05:55

My Google search came up with this one, which appears to be exactly what you're looking for. Eight different versions of color blindness are simulated by multiplying each of the R,G,B values by 3 different percentages and adding them together.

http://www.colorjack.com/labs/colormatrix/ (dead link)

Working Archived Link (working link)

查看更多
淡お忘
3楼-- · 2020-05-16 05:55

The colorjack link has good info, but I use http://colorfilter.wickline.org/. It can check a whole page: images, CSS colors and all.

查看更多
叛逆
4楼-- · 2020-05-16 05:57

Google came up with a number of links, perhaps one provides source or algorithm descriptions: http://www.google.com/search?hl=en&q=simulating+color+blindness&aq=f&oq=

Edit: Thanks Torlack for pointing out that everybody knows about Google. But using Google effectively requires using the proper search terms, and good search terms aren't always obvious. Judging by the returned page titles and a couple of the links, this particular search seemed highly relevant. I don't think it was a bad enough answer for a downvote.

查看更多
beautiful°
5楼-- · 2020-05-16 06:05

Can't help you on algorithms, but the following article was quite an eye-opener (excuse the pun): http://critiquewall.com/2007/12/10/blindness.

Ah, actually, http://www.vischeck.com/ is useful.

查看更多
在下西门庆
6楼-- · 2020-05-16 06:06

The GIMP has a colorblindness filter in View -> Display Filters -> Color Deficient Vision

查看更多
手持菜刀,她持情操
7楼-- · 2020-05-16 06:09

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.

查看更多
登录 后发表回答