Skip to main content

A small example package

Project description

Colorblind

Colorblind is a computer vision library that converts images into a colorblind friendly version depending on the type of colorblindness. The three supported types of colorblindness/color weakness are:

  • Deuteranopia: red-green weakness, particularly green
  • Protanopia: red-green weakness, particularly red
  • Tritanopia: blue weakness

So far we provide three algorithms to correct the images:

  • Daltonization: Original method for generating colorblind-friendly images
  • HSV Hue Shift: Shifts Hue based on green ratio or blue ratio (depending on colorblindness type)
  • LAB Shift: Previous studies for this had to tune hyperparameters to get good results

Installation

pip install colorblind

Usage

# imports
import numpy as np
import cv2
from colorblind import colorblind
import matplotlib.pyplot as plt

# load image
img = cv2.imread('../images/seven.jpg')
img = img[..., ::-1]

# simulate protanopia
simulated_img = colorblind.simulate_colorblindness(img, colorblind_type='protanopia')

# correct using daltonization
daltonized_img = colorblind.daltonize_correct(img, colorblind_type='protanopia')

# correct using hsv correction
hsv_img = colorblind.hsv_color_correct(img, colorblind_type='protanopia')

Results

Deuteranopia

Type Original Daltonization HSV Corrected
Full Color
Simulated

Protanopia

Type Original Daltonization HSV Corrected
Full Color
Simulated

Tritanopia

Type Original Daltonization HSV Corrected
Full Color
Simulated

Credits

Mostly inspired by a summary paper of algorithms applicable to making images color-blind friendly. Example: https://www.researchgate.net/publication/326626897_Smartphone_Based_Image_Color_Correction_for_Color_Blindness

Daltonization values came from https://github.com/joergdietrich/daltonize

Further information on color blindness is available at:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

colorblind-0.0.9.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

colorblind-0.0.9-py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page