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

Matteo matteo.niccoli at gmail.com
Fri Oct 3 10:13:54 EDT 2014


Hi Stefan (and Juan)
 
 
I run this test last night. Nothing fancy, essentially I created a 16x16x3 
RGB azure image (RGB 0,153,255 or 0,0.6,1) and took it for a walk from RGB 
to LAB to LCH then back to LAB and RGB again.
http://nbviewer.ipython.org/urls/dl.dropbox.com/s/44b9udiqz4npp0b/color_space_conversion_skimage.ipynb?dl=0
Feel free to use this if you like as an example of color conversion. I will 
be adding it to my GitHub anyway https://github.com/mycarta
 
As you can see the loop of transformations closes precisely.
When I tried with pure red (RGB 1,0,0 or 255,0,0) the final RGB values are 
all e-16 numbers, some negative. Not sure if that qualifies as deficiencies.
Certainly it points to me to the need to include documenntation on the 
coordinate ranges as Juan observed.
 
>From this I conclude that:
r,g, and b are in the range (0 1)
L is in the range (0 100) as Juan pointed out (already evident from my 
color evaluation notebook), however
a and b must be in the range (-100 100) since a is small but positive and b 
is large but negative (as expected) in my example
chrima c must be in the range (0 100) because it is the distance from the 
polar axis so it can't be negative
h is in the range (0 2pi) as specified already in the documentation
 
I hope this is useful. I'l lbe checking my original example with the new 
ranges tonigth.
Cheers
Matteo
 
 
 
 

On Thursday, October 2, 2014 4:02:54 PM UTC-6, Stefan van der Walt wrote:

> Hi Matteo 
>
> On 2014-10-01 20:56:09, Matteo <matteo.... at gmail.com <javascript:>> 
> wrote: 
> > A good test would be to convert a single  colour, say red, from RGB to 
> LAB, 
> > to LCH, then back to LAB and RGB and check the values at each step. I'll 
> > try tomorrow and post my results back for your information. 
>
> Did you have any luck with that?  Also, if you come up with any good 
> test cases that point out deficiencies in the code, we'd be happy to 
> include them in the test suite. 
>
> Thanks for the link to the article--it's very enjoyable to learn more 
> about color map perception in such a vividly illustrated way. 
>
> Regards 
> Stéfan 
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20141003/b4007c87/attachment.html>


More information about the scikit-image mailing list