Inspiration

What it does

CVDcor is a daltonizer library; it contains functions for taking an image and attempting to apply corrections to it so that color contrast is preserved for individuals with specified types of CVD (Color Vision Deficiency). The library currently supports the three most common forms of CVD and assumes worst-case for the condition.

How I built it

Starting with example code for the LMS daltonization algorithm from daltonize.org, I mainly worked on optimization. The base algorithm is quite inefficient, as it contains 4 matrix multiplications as well as a vector addition and a vector subtraction. Since several of the transformation matrices were composed of constants, I was able to pre-compute one large matrix, eliminating 2 multiplications. I was also able to simplify the remaining multiplications as they contained extraneous scalar multiplications which could be eliminated without affecting the result. Using this revised algorithm, I made a C API which allows the daltonization of 24-bit RGB pixels as well as the simulation of CVD.

I have also created some example programs to demonstrate CVDcor's abilities. These programs were made using OpenCV and include a live webcam daltonizer, video player and an image daltonizer (the image daltonizer uses lodepng instead of OpenCV, but I plan to create an OpenCV version to replace it).

CVDcor itself has no dependencies outside the C standard library.

Challenges I ran into

  • Did math for optimization wrong... three times
  • Partner had to leave a couple of hours into the project, all his work became moot by the end

Accomplishments that I'm proud of

  • Ability to handle live video at 640x480 without saturating cpu

What I learned

What's next for CVDcor

  • Moving to GPU rendering
  • Building a full-desktop daltonizer

Built With

Share this project:
×

Updates