- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有这样的XYZ数据集:
[[ 15.4999257 20.91432805 8.15938343]
[ 38.47211872 41.38471882 4.41641215]
[ 8.42304194 10.26972173 4.58244444]
[ 59.15345728 65.6834669 42.20671404]
[ 48.21549352 50.67621445 7.84460441]
[ 28.5987903 29.48986333 25.78866701]
[ 16.37042029 11.17896503 20.92325834]...]
import numpy as np
XYZ_to_RGB_matrix = [
[3.24062548, -1.53720797, -0.49862860],
[-0.96893071, 1.87575606, 0.04151752],
[0.05571012, -0.20402105, 1.05699594]]
my_rgb = (np.dot(XYZ_to_RGB_matrix, xyz_test) * 255).astype('uint8')
XYZ:[ 15.4999257 20.91432805 8.15938343]
它的标签是绿叶
[244 116 51]
,它不是绿色,所以我的代码中有一些错误吗?
最佳答案
试试这个代码:
from colormath.color_objects import sRGBColor, XYZColor
from colormath.color_conversions import convert_color
XYZ = [[15.4999257, 20.91432805, 8.15938343],
[38.47211872, 41.38471882, 4.41641215],
[8.42304194, 10.26972173, 4.58244444],
[59.15345728, 65.6834669, 42.20671404],
[48.21549352, 50.67621445, 7.84460441],
[28.5987903, 29.48986333, 25.78866701],
[16.37042029, 11.17896503, 20.92325834]]
RGB = []
for xyz_list in XYZ:
xyz = XYZColor(*[component/100 for component in xyz_list])
rgb = convert_color(xyz, sRGBColor)
rgb_list = [255*color for color in rgb.get_value_tuple()]
RGB.append(rgb_list)
print(RGB)
[92.22372010136964, 137.4037125386466, 78.86090637192737]
[189.9967785535171, 173.00440159210268, 0.0]
[77.62483771390573, 95.56815462725146, 61.177682509553435]
[201.10203247049455, 216.97942244866422, 185.00583953450555]
[211.2583657458791, 187.8058726835025, 47.400682365292234]
[147.26702521874506, 147.4599728158739, 152.30904210885427]
[131.7100385873106, 69.84477339437986, 144.29850008120889]
pip install colormath
关于python - 如何将XYZ颜色空间更改为RGB 0-255,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62180730/
('xyz' != 'xyz') 和 NOT ('xyz' = 'xyz') 之间有什么区别吗? 虽然我在 Oracle DB 的上下文中询问,但也想知道其他语言的相同情况。 差异主要在于处理速度和所
我注意到定义了 simpleType 或 complexType,并且在模式文件中的多个元素的声明中使用了这些类型,simpleType 或 complexType 生成了一个方法签名作为“JAXBE
我在 XYZ 的 3D 空间中将对象旋转 90 度步长 (rX rY rZ)。角度限制为 0-360 度,我使用以下命令来旋转矩阵: Matrix.rotateM(mModelMatrix, 0, r
recursivePrint 函数将递归地显示文件和文件夹,我已经调用了一个函数来搜索文件中的单词此代码适用于小号。文件数但是当我使用所有目录时,它给出了内存不足错误java堆空间 File[] ma
我有一个简单的 html 网站,其中包含 50 多个 html 页面。从 statistics-script 中,我有时会在 xyz.html/(重定向到 404)而不是 xyz.html 之类的页面
我对一个位置(原始文件夹)中的所有文件进行哈希处理,然后将哈希值写入变量,然后对另一位置(目标文件夹)中的所有文件执行相同的操作: $origin = Get-ChildItem .\Test1 |
我正在编写一个包含键值对集合的重要类,在编译期间我收到一个我无法弄清楚的非常奇怪的错误。在一个与这里的函数非常相似的函数中,但由于所需代码的复杂性而没有上下文,我收到错误: TValue& opera
我正在尝试做一些非常简单的事情。 场景如下:我有一个整个网站与支持推送状态的浏览器配合得很好。该网站的工作基础是该语言是“实际页面”,例如: /en/whatever/etc = index.en.
在java脚本(或jquery)中,有什么区别 var a = xyz[] var a = xyz{} 我在互联网上搜索但找不到任何答案?如果有任何差异,请告诉我。 最佳答案 这是无效的语法。 var
我正在通过以下步骤在 Android 中进行 JSON 解析: 使用 HttpPost 对象从网络服务获取 XML 响应。 将此 XML 转换为 JSON 字符串,然后再转换为 JSON 对象。 现在
有什么区别: class A { public: void virtual method1() {...}; virtual void method2() {...}; }; 编译器(编辑:Apple
我正在尝试使用 configure、make、make install 三部曲来编译 c 源代码。 由于我想编译源代码,以便它们使用默认情况下未使用的另一个库 (XYZ),因此我可以使用 ./conf
在 MySQL 中,如何将表的列名从“sum(xyz)”更改为“xyz”?我已经尝试了以下解决方案来更改列名: Change Column Name in MySQL Rename column SQ
不能覆盖委托(delegate)函数, didFinishLaunchingWithOptions 和其他与应用程序委托(delegate)相关的函数都很好,但是当我尝试使用 application(
Tally-ho 小伙子们, 这个问题认为线性代数的艺术是数学中我无法解决的地方。所以我希望你们能帮助我 :D。 我正在尝试为一款名为《骑马与砍杀》的游戏创建单人自动踢球作弊。这个 autokicke
我正在 typescript 中访问导入的nodejs模块的函数,编译器会为每个方法调用或属性访问发出给定的错误。这是我的声明: import imageProc = module('imagePr
这个问题在这里已经有了答案: What is wrong with below code (3 个答案) What does sizeof(&array) return? (4 个答案) 关闭 9
为了好玩,我决定制作类似于 Markdown 的东西。根据我过去对正则表达式的一些小经验,我知道它们有多么强大,所以它们将是我所需要的。 所以,如果我有这个字符串: Hello **bold*
假设我有一个目录,里面有一堆网站名称。 即 dev.domain.com dev.domain2.com dev.domain3.com 如何将它们重命名为 .com在使用管道和/或重定向 bash
这个问题已经有答案了: 已关闭12 年前。 Possible Duplicate: difference between string object and string literal 你好, 首先
我是一名优秀的程序员,十分优秀!