带有Matplotlib的Maxwell彩色三角形 [英] Maxwell Color Triangle with Matplotlib

查看:220
本文介绍了带有Matplotlib的Maxwell彩色三角形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个麦克斯韦颜色三角形







另一种方法是最大化亮度:RGB(r,g,b)-> 1 / max(r,g,b)* RGB(r,g,b)例如RGB(0.2,0.5,0.1)-> RGB(0.4,1.0,0.2)。这样一来,值就不会被裁剪,亮度也将达到最大。




I want to create a Maxwell color triangle

(https://homepages.abdn.ac.uk/npmuseum/article/Maxwell/Legacy/MaxTri.html)

using Matplotlib. I have found code for something similar: http://www.f-legrand.fr/scidoc/docmml/image/niveaux/couleurs/couleurs.html

However, in that case, equal proportions of R, G, and B yield darker colors which is not what I want.

Any ideas are welcome. I am really struggling with this.

解决方案

Inside Maxwell Triangle: r + g + b = 1.0, it means the center will be RGB(1/3, 1/3, 1/3) ([0.0,1.0] range) which is dark compared to white RGB(1.0,1.0,1.0).

In order to get white (RGB(1.0,1.0,1.0)) at the center it is possible to multiply RGB values by 3.0: center would be perfectly white but out-of-bound values would be cropped ie RGB(2.0,1.0,1.0) would be displayed as RGB(1.0, 1.0, 1.0).

Another way is to maximize brightness: RGB(r,g,b) -> 1 / max(r,g,b) * RGB(r, g, b) e.g. RGB(0.2, 0.5, 0.1) -> RGB(0.4, 1.0, 0.2). That way values are never clipped and brightness is maximal.

这篇关于带有Matplotlib的Maxwell彩色三角形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆