我正在对一些解决方案进行基准测试,以从图像中提取CIE L * a * b *颜色。
当尝试使用PIL专门执行此操作时,我遇到了一个奇怪的错误:
>>> from PIL import Image
>>> from PIL import ImageCms
>>> img = Image.open('samples/purple_dress.jpg', 'r')
>>> img.mode
'RGB'
>>> ImageCms.profileToProfile(img, ImageCms.createProfile("sRGB"), ImageCms.createProfile("LAB"))
---------------------------------------------------------------------------
PyCMSError Traceback (most recent call last)
<ipython-input-17-bcf9d917fcd6> in <module>()
----> 1 ImageCms.profileToProfile(img, ImageCms.createProfile("sRGB"), ImageCms.createProfile("LAB"))
/home/dori/.virtualenvs/computer_vision/lib/python2.7/site-packages/PIL/ImageCms.pyc in profileToProfile(im, inputProfile, outputProfile, renderingIntent, outputMode, inPlace, flags)
305 imOut = transform.apply(im)
306 except (IOError, TypeError, ValueError) as v:
--> 307 raise PyCMSError(v)
308
309 return imOut
PyCMSError: cannot build transform
>>>
我正在使用Pillow 2.4.0 知道这意味着什么以及如何解决它?