Colour blindness (color vision deficiency affects approximately 1 in 12 men (8%) and 1 in 200 women in the world. Color blindness is a defect, where certain cones in eyes, responsible for detecting colors at various wavelengths are missing, and the person cannot perceive that entire range of the visible spectrum. The aim of the GSoC Project was to research about various algorithms that would ease the differentiation of colors for colorblind people by manipulating colors in images.

The Google Summer of Code project to develop a library for the Processing Library has achieved many of its goals. To start with, this project included a research on various image processing algorithms to increase the contrast in certain areas of images that would indeed help color blind people to differentiate between objects and colors in an image. Another achievement was to able to implement the code for all the proposed algorithms.

 

Read about the project  – About Project

Contents

  1. Github links to the code
  2. Documentation for the library
  3. Results of the algorithms
  4. Links to the progress of the project
  5. Git Commit logs
  6. Conclusion

Github links to the code :

  1. Processing Library – Colorblindness Library
  2. To download the zip file of library – Downloadable Zip
  3. Raw uncompiled source files for the library – Uncompiled Files
  4. Example PDE (processing files) for the library – Example Files

Documentation for the library :

Importing the library

Start with importing the library to your code

import colorblindness.*;
import processing.glu.*;
import processing.glu.tessellator.*;

Simulating/Correcting using color difference method (Daltonization)

The “colorblindness.daltonize() takes 4 parameters
1) Type of colorblindness
2) Absolute address of input file
3) Absolute Address of output file
4) Simulate or Correct the image

colorblindness.daltonize(int type, string inputAddress, string outputAddress, boolean correct);

//For example, the following line simulates the image at /Desktop/input.jpg 
//as per protanopia and stores the output at /Desktop/output.jpg

colorblindness.daltonize(1,"/Desktop/input.jpg","/Desktop/output.jpg",false);

Options for type –
1 -> Protanopia
2 -> Deuteranopia
3 -> Tritanopia

Correcting the image using RGB Color Contrast method

There are two possible function calls for this

colorblindness.rgbContrast(string inputFile, string outputFile, float factor);
//The factor range from 0 to 1 (which is optional)

colorblindness.rgbContrast(string inputFile, string outputFile);

colorblindness.rgbContrast("/Desktop/input.jpg","/Desktop/output.jpg",0.40);

When no factor is defined, the library uses predetermined optimum factor of 0.28

Correcting the image using HSV Color Contrast method

colorblindness.hContrast(string inputFile, string outputFile, int factor);
//The factor range from 1 to 128

colorblindness.hContrast("/Desktop/input.jpg","/Desktop/output.jpg", 50);

Correcting the image using CIE*LAB Color Contrast Method

colorblindness.labMethod(string inputFile, string outputFile, float factor);
//The factor range from 0 to 1

colorblindness.labMethod(string inputFile, string outputFile);


colorblindness.labMethod("/Desktop/input.jpg","/Desktop/output.jpg",0.40);

When no factor is defined, the library uses predetermined optimum factor of 0.35

Results of the algorithms

Original Image

5
Original Image

Output for simulation using “colorblindness.daltonize(type, input, output,false)” : 

5ot
Simulated as per Protanopia
5ot2
Simulated as per Deuteranopia
5ot3
Simulated as per Tritanopia

Correcting using “colorblindness.daltonize(type,input,output,true)”  : 

5ot1
Corrected for Protanopia
5ot2
Corrected for deuteranopia
5ot3
Corrected for tritanopia

Correcting using “colorblindness.rgbContrast(input,output, 0.28)”  :

5ot1
Corrected using rgb colorcontrast method

Correcting using “colorblindness.hContrast(input,output,70)”  : 

5ot1
Corrected using HSV Contrast

Correcting using “colorblindness.labMethod(input,output,0.35)”  :

5ot1
Corrected using LAB Method

Links to the progress of the project :

  1. About Project – About Project
  2. Simulation – Simulating Colorblindness
  3. How does simulation works? – Simulating Colorblindness – How it works?
  4. Survey results for simulation – Observations from Survey results for Simulation Algorithm
  5. Daltonization/Color difference correction – Image Correction Using Color Difference Image
  6. RGB Contrast Method – RGB Color contrast enhancement method for Image Correction
  7. Survey results for correction – Results of the Survey for Correction Algorithms

Git Commit Logs :

  1. Commit logs for code prototypes (in python): Prototype commit log

Note: Due to some code merge issues, I had to create a new repository for the library and for the raw source files. Below you can find commit logs for all the repositories.

  1. Commit log for raw source files (old) – Raw source files – old repo
  2. Commit log for raw source files (new) – Raw source files – new repo
  3. Commit log for library files (old) – Library files – Old repo
  4. Commit log for library files (new) – Library files – New repo

Conclusion :

The experience of developing a library for the open source community has been amazing. The difficulties I faced as I progressed through these three months and the happiness that came with solving various issues are the two things I’ll carry with me forever.

I would like to thank my mentor, Professor Claire, without whose suggestions the project might not have reached where it has today. It was an amazing experience working along with her on the project. Also, in developing this library, I was able to get many color blind Redditors on board, who helped me in discovering issues and fixing them. Without their help, this research would have been difficult.

Advertisements