JuliaGraphics/ColorVectorSpace.jl

Name: ColorVectorSpace.jl

Owner: JuliaGraphics

Description: Treat colors as if they are n-vectors for the purposes of arithmetic

Created: 2015-08-17 22:31:25.0

Updated: 2017-05-10 20:51:22.0

Pushed: 2017-10-25 09:14:05.0

Homepage: null

Size: 110

Language: Julia

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

ColorVectorSpace

Build Status codecov.io

This package is an add-on to ColorTypes, and provides fast mathematical operations for objects with types such as RGB and Gray.

Introduction

Colorspaces such as RGB, unlike XYZ, are technically non-linear; the “colorimetrically correct” approach when averaging two RGBs is to first convert each to XYZ, average them, and then convert back to RGB.

However, particularly in image processing it is common to ignore this concern, and for the sake of performance treat an RGB as if it were a 3-vector. This package provides such operations.

If you're curious about how much difference it makes, the following diagram might help. The first 10 distinguishable_colors were generated, and all pairs were averaged. Each box represents the average of the pair of diagonal elements intersected by tracing vertically and horizontally; within each box, the upper diagonal is the “colorimetrically-correct” version, while the lower diagonal represents the “RGB vector space” version.

ColorVectorSpace

Usage
g ColorTypes, ColorVectorSpace

That's it. Just by loading ColorVectorSpace, most basic mathematical operations will “just work” on AbstractRGB, AbstractGray (OpaqueColor{T,1}), TransparentRGB, and TransparentGray objects. (See definitions for the latter inside of ColorTypes).

If you discover missing operations, please open an issue, or better yet submit a pull request.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.