Problems with coordinate ranges when doing conversion from LCH to LAB to RGB

Matteo matteo.niccoli at gmail.com
Tue Sep 30 23:33:49 EDT 2014


A while ago I wrote a post on my blog with code on how to import in Python 
a colour palette in an ASCII file and convert it to a Matplotlib colormap: 
mycarta.wordpress.com/2014/04/25/convert-color-palettes-to-python-matplotlib-colormaps/

Following that post I wrote a tutorial on a geoscience magazine on how to 
evaluate and compare colormaps using Python: 
wiki.seg.org/wiki/How_to_evaluate_and_compare_color_maps

In the accompanying notebook I show how to convert a 256x3 RGB colormap to 
a 256x256x3 RGB image, then convert it to CIELAB using scikit-image's 
rgb2lab, then plot the 256x1 lightness (L) array to evaluate the colormaps 
perceptually.
You can read the relevant extract of the notebook using this nbviewer link:
http://nbviewer.ipython.org/urls/dl.dropbox.com/s/54zoax2qesb71wn/evaluate_colormaps_skimage_test.ipynb?dl=0 

In that case scikit-image worked really well for me.

Now I am trying to follow up with a new tutorial and I run into problems 
with the color space conversions.
You can follow what I am trying to do in this other notebook extract:
http://nbviewer.ipython.org/urls/dl.dropbox.com/s/noli66nzrlk0676/make_colormap_skimage_test.ipynb?dl=0

The goal of this new tutorial is to show how to build colormaps from 
scratch using perceptual principles. I design a color palette in LCH (polar 
version of CIELAB) by keeping Chroma and Lightness fixed and interpolating 
Hue around the circle, then convert to LAB, then to RGB.
As far as I know the code I wrote should work, but the result is a black 
colormap. I am thinking I got wrong one or more of the ranges for the LCH 
coordinates. I assumed L between (0,1), Ch between (0,1), and H between (0, 
2*pi).
Is that wrong, and if that's the case, what are the ranges? Many of them 
are not stated clearly in the documentation in here: 
http://scikit-image.org/docs/dev/api/skimage.color.html

Is it possible to update the documentation to clearly state all ranges for 
all colour spaces.


Thanks for your help.
Matteo

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20140930/9c4116ae/attachment.html>


More information about the scikit-image mailing list