Skip to main content

Utility to help colorblind people by providing color filters and highlighting tools.

Project description

DaltonLens-Python

Unit Tests

This python package is a companion to the desktop application DaltonLens. Its main goal is to help the research and development of better color filters for people with color vision deficiencies. The current features include:

  • Simulate color vision deficiencies using the Viénot 1999, Brettel 1997 or Machado 2009 models.
  • Provide conversion functions to/from sRGB, linear RGB and LMS
  • Implement several variants of the LMS model
  • Generate Ishihara-like test images

Install

python3 -m pip install daltonlens

How to use

From the command line

daltonlens-python --help
usage: daltonlens-python [-h] 
       [--model MODEL] [--filter FILTER]
       [--deficiency DEFICIENCY] [--severity SEVERITY]
       input_image output_image

Toolbox to simulate and filter color vision deficiencies.

positional arguments:
  input_image           Image to process.
  output_image          Output image

optional arguments:
  -h, --help            show this help message and exit
  --model MODEL, -m MODEL
                        Color model to apply: vienot, brettel, machado or auto (default: auto)
  --filter FILTER, -f FILTER
                        Filter to apply: simulate or daltonize. (default: simulate)
  --deficiency DEFICIENCY, -d DEFICIENCY
                        Deficiency type: protan, deutan or tritan (default: protan)
  --severity SEVERITY, -s SEVERITY
                        Severity between 0 and 1 (default: 1.0)

From code

from daltonlens import convert, simulate, generate
import PIL
import numpy as np

# Generate a test image that spans the RGB range
im = np.asarray(PIL.Image.open("test.png").convert('RGB'))

# Create a simulator using the Viénot 1999 algorithm.
simulator = simulate.Simulator_Vienot1999()

# Apply the simulator to the input image to get a simulation of protanomaly
protan_im = simulator.simulate_cvd (im, simulate.Deficiency.PROTAN, severity=0.8)

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

daltonlens-0.1.3.tar.gz (284.4 kB view details)

Uploaded Source

Built Distribution

daltonlens-0.1.3-py3-none-any.whl (39.6 kB view details)

Uploaded Python 3

File details

Details for the file daltonlens-0.1.3.tar.gz.

File metadata

  • Download URL: daltonlens-0.1.3.tar.gz
  • Upload date:
  • Size: 284.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for daltonlens-0.1.3.tar.gz
Algorithm Hash digest
SHA256 3c07b2734c0a13ffe1f9c85427d6f265a0b1f5b2a07a1aeaa1a4b1011ed7cb9c
MD5 a6ee0ae11450eb74488be70c6cc3fa6d
BLAKE2b-256 aa9c25b260d84c8878732055b9edaba552b77e46e794a8baa786672ea91241e1

See more details on using hashes here.

File details

Details for the file daltonlens-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: daltonlens-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 39.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for daltonlens-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 075a5afaa46b403e4d379c3e164282a1a0083f45faa8bbc34b49298288a9d1d4
MD5 1cbddc7ada631f0a26e1335384d7e065
BLAKE2b-256 65e011b2aec93b870ab2abda31e2ace7a8210abf89e47ee0e7e915fc82024308

See more details on using hashes here.

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