rgb_sp=np.array(zip(rsp, gsp ,bsp)) rgb_sp.shape # check the shape of the output array
(256, 3, 256)
rgb_spectral=np.swapaxes(rgb_sp,1,2) rgb_spectral.shape # check the shape of the array again
(256, 256, 3)
Hey Matteo,I’m not familiar with all the different colour spaces, but from your second notebook you know that L in Lab ranges from 0-100, so I imagine it’s the same in Lch. Similarly for ab -> c. You might want to try 0-100 as your ranges. Various resources on the internet also point to that range, e.g., http://www.colourphil.co.uk/
lab_lch_colour_space.shtml.In addition, I think your call to swapaxes to get lch256 in the final notebook might be incorrect. You need to put axis 0, the channels, at the end for our colour conversions to work, so it should be swapaxes(arr, 0, 2).Having said that, you are right that our documentation could be improved, at the very least linking to relevant web documents for each function. I’ll add an issue for this.I hope this helps, and thanks for reporting the issue!Juan.
Sent from Mailbox
On Wed, Oct 1, 2014 at 2:29 PM, Matteo <matteo....@gmail.com> wrote: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:--
Following that post I wrote a tutorial on a geoscience magazine on how to evaluate and compare colormaps using Python:
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:
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:
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.htmlIs it possible to update the documentation to clearly state all ranges for all colour spaces.
Thanks for your help.
You received this message because you are subscribed to the Google Groups "scikit-image" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image...@
For more options, visit https://groups.google.com/d/