简体   繁体   English

怎么把ARGB转换成波长(纳米)?

[英]How convert ARGB to wavelenght(nanometers)?

I am searching method which allow me to convert ARGB(from BufferedImage.getRGB) to nanometers( wavelength of light). 我正在搜索允许我将ARGB(从BufferedImage.getRGB)转换为纳米(光的波长)的方法。 I know that it exist coz i saw programs which can do that. 我知道它的存在是因为我看到了可以做到这一点的程序。

Example Code 范例程式码

Example code that goes from rgba to wavelength can be found here . 从rgba到波长的示例代码可以在这里找到。 Disclaimer: I have not tried this code, I just found it on the interwebs. 免责声明:我没有尝试过这段代码,我只是在互联网上找到了它。

For example code that goes from wavelength>RGB, see the question linked to by Mayo (relinked here ). 例如,波长> RGB的代码,请参见Mayo链接到的问题( 在此处重新链接)。

RGB and wavelength RGB和波长

If you're asking this question, you should probably make sure you understand the nuances of the relation between RGB and wavelength. 如果您问这个问题,您可能应该确保您了解RGB与波长之间关系的细微差别。

A color as perceived by our eye may be light of a single wavelength, or light of several wavelengths superimposed on one another to approximate the appearance of light of that single wavelength. 我们的眼睛所感知的颜色可能是单一波长的光,也可能是几种波长的光相互叠加以近似于该单一波长的光的外观。

RGB treats colors as adding light of three specific wavelengths together to get the thing we perceive. RGB将颜色视为将三种特定波长的光加在一起以获得我们所感知的东西。 So going from wavelength to RGB is asking the question: "How can we add red, green, and blue to approximate the appearance of this color?" 因此,从波长变为RGB提出了一个问题:“我们如何添加红色,绿色和蓝色以近似该颜色的外观?” There are many possible answers to this question. 这个问题有很多可能的答案。

Going from RGB to wavelength is asking the question (as you are) "What single wavelength light approximates the superposition of light given by these RGB values?". 从RGB到波长是一个问题(就像您一样):“哪个单一波长的光近似于这些RGB值给定的光的叠加?”。 It's important to understand that you're working with a many to one mapping here. 重要的是要了解您正在使用多对一映射。

**Here you can find another discussion of this along with a cool tool to help you check your work. **在这里,您可以找到有关此问题的另一个讨论以及一个很酷的工具,以帮助您检查工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM