org.gicentre.utils.colour
Class CIELab

java.lang.Object
  extended by org.gicentre.utils.colour.CIELab

public class CIELab
extends java.lang.Object

Utilities for handling the CIELab colour space. This space is approximately perceptually uniform in that two colours a fixed distance apart in the colour space should be equally distinguishable from each other regardless of their location.

For details see en.wikipedia.org/wiki/Lab_color_space.

Version:
3.3, 1st August, 2011.
Author:
Jo Wood, giCentre, City University London.

Constructor Summary
CIELab()
          Creates a CIELab converter using the default D65 illuminant with 2 degree observer position.
CIELab(ColourConverter.WhitePoint wp)
          Creates a CIELab converter using the given reference calibration settings.
 
Method Summary
 java.awt.Color getColour(double L, double a, double b, boolean useNearest)
          Finds the colour corresponding to the given CIELab triplet.
 processing.core.PVector getLab(java.awt.Color colour)
          Finds the CIELab triplet representing the given colour.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CIELab

public CIELab()
Creates a CIELab converter using the default D65 illuminant with 2 degree observer position.


CIELab

public CIELab(ColourConverter.WhitePoint wp)
Creates a CIELab converter using the given reference calibration settings. These allow different whitepoints to be set.

Parameters:
wp - Colour calibration reference to use in the CIELab conversion.
Method Detail

getLab

public processing.core.PVector getLab(java.awt.Color colour)
Finds the CIELab triplet representing the given colour. CIELab L value scaled between 0-100, and a and b values scaled between -100 and 100. Based on the conversion code by Duane Schwartzwald, 12th March, 2006 and Harry Parker, Feb 27th, 2007. See rsbweb.nih.gov/ij/plugins/download/Color_Space_Converter.java.

Parameters:
colour - Colour to convert.
Returns:
Vector holding CIELab values where the x and y components hold the a and b values respectively and the z values holds the L value.

getColour

public java.awt.Color getColour(double L,
                                double a,
                                double b,
                                boolean useNearest)
Finds the colour corresponding to the given CIELab triplet. Out-of-gamut colours will be returned as null if useNearest is false, otherwise the approximate nearest visible colour will be returned. CIELab L values should be scaled between 0-100, and a and b values scaled between -100 and 100. Based on the conversion code by Duane Schwartzwald, 12th March, 2006 and Harry Parker, Feb 27th, 2007. See rsbweb.nih.gov/ij/plugins/download/Color_Space_Converter.java.

Parameters:
L - CIELab L value scaled between 0 and 100.
a - CIELab a value scaled between -100 and 100.
b - CIELab b value scaled between -100 and 100.
useNearest - If true, out-of-gamut colours will be converted to their nearest visible equivalent. If not, out-of-gamut colours returned as null.
Returns:
Colour representing the given Lab values.


giCentre Utilities V.3.3, API documentation generated 6th April, 2013