目前使用 PIL/Numpy/SciPy 进行转换的首选方式是什么?
最佳答案
自 2010 年以来 linked question被问到相应的代码从 scipy 转移到一个单独的工具包: http://scikit-image.org/
所以这是我真正要寻找的代码:
from skimage import io, color
rgb = io.imread(filename)
lab = color.rgb2lab(rgb)
还应注意,由于 Lab性质 srgb->lab 转换依赖于一个附加参数:whitepoint,例如:
• Photoshop 使用称为 D50 的白点(这是 icc 的标准)
• OpenCV 和 skimage 使用 D65(这是 srgb 的标准)。
• 默认Matlab实现使用D50(它能够使用others),
这个不错FAQ是这样解释的:
You should use D65 unless you have a good reason to use something else.
The print industry commonly uses D50 and photography commonly uses D55.
These represent compromises between the conditions of indoor (tungsten) and daylight viewing.
您可以通过将 RGB (0,0,255)
转换为 Lab 来判断您正在处理的白点:
• D50 会给你 (30, 68, -112)
• D55 (30, 73, -110)
• D65 (32, 79, -108)
“D”后面的数字对应(内部)使用的白点色温:D50 = 5003 K(偏黄),D65 = 6504 K(偏蓝)
感谢 Alex 和 Roman 的回答,因为他们为我指明了正确的方向。
关于python - 使用 python 转换图像 RGB->Lab,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13405956/