This library simulates and corrects images to ease differentiation of colors for colorblind people - developed for Processing Foundation as a part of Google Summer of Code 2017
You can find the full source for the library here!
Start with importing the library to your code
import colorblindness.*;
import processing.glu.*;
import processing.glu.tessellator.*;
The "colorblindness.daltonize() takes 4 parameters
- Type of colorblindness
- Absolute address of input file
- Absolute Address of output file
- 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 -> Deutranopia 3 -> Tritanopia
There are two possible function calls for this
colorblindness.rgbContrast(string inputFile, string outputFile, float factor);
//The factor range from 0 to 1
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
colorblindness.hContrast(string inputFile, string outputFile, int factor);
//The factor range from 1 to 128
colorblindness.hContrast("/Desktop/input.jpg","/Desktop/output.jpg", 50);
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