FYI - implementation of CIECAM02 in Python

njs at vorpus.org njs at vorpus.org
Thu Aug 14 11:09:47 EDT 2014


Hi scikit-imageers,

I don't have time to prepare a PR, but just as a heads-up in case anyone 
else wants to do so -- I wrote a complete, tested implementation of the 
CIECAM02 forward and inverse transforms in Python (BSD-2), which might be a 
nice extension to skimage.color:
  https://github.com/njsmith/pycam02ucs/blob/master/pycam02ucs/ciecam02.py

I'm pretty confident in its correctness; the only place where it disagrees 
with Mark Fairchild's spreadsheet implementation, it turns out the 
spreadsheet is (was) wrong :-). It could probably be optimized further -- 
it is vectorized, but I didn't go to any great efforts to extract redundant 
temporaries or perform operations in-place. It's a pretty direct 
implementation of the equations.

The API may not be exactly the scikit-image's taste ATM either -- I forget 
whether you prefer to use the 0-1 or 0-100 scale for XYZ (this code uses 
0-100 b/c that's what the spec uses). And CIECAM02 is a weird space -- the 
forward transform spits out 7 named dimensions, and the inverse transform 
needs 3 of these, but is quite flexible about which 3, so I treat each 
dimension as a separate array instead of stacking them into one.

That tree also has an implementation of forward and inverse transforms to 
the CAM02-UCS perceptually uniform space (Luo et al, 2006):
  https://github.com/njsmith/pycam02ucs/blob/master/pycam02ucs/cam02ucs.py

-n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20140814/bcc4d2d0/attachment.html>


More information about the scikit-image mailing list