According to CIE color space and relation of RGB with XYZ, we can express

$$ R = \int_0^\infty I(\lambda)r(\lambda)d\lambda $$$$ G = \int_0^\infty I(\lambda)g(\lambda)d\lambda $$$$ B = \int_0^\infty I(\lambda)b(\lambda)d\lambda $$

where $r(\lambda),g(\lambda),$ and $b(\lambda)$ are the corresponding color matching functions and $I(\lambda)$ is spectral intensity function.

Now, I am trying to calculate RGB values of hyperspectral image captured by hyperspectral camera. And from the hyperspectral image, I can get spectral intensity values between 0 - 65535. But I am not sure about unit or range of the intensity function $I(\lambda)$ above. Is it values between 0 - 1?


2 Answers 2


You are probably working not with CIE RGB, but CIE XYZ, so these are properly denoted the XYZ tristimulus values, not RGB. Their absolute values do not matter if you want to determine the chromatacities ("color", as we commonly understand it), because you take the ratio of the components to their sum.

Once you have the XYZ tristimulus values or xy chromaticities, you can convert to something like sRGB to yield usable RGB values. You might need to scale the result to 0-255.

  • $\begingroup$ There are colour matching functions for RGB too, actually. So you have two ways to go about the conversion. (a) integrate using the XYZ colour matching functions to get XYZ and then convert XYZ to RGB, or (b) integrate using the RGB colour matching functions to get RGB. But either way, what you get is linear RGB, so you do still need to do a conversion to sRGB if the image format you're using requires that. Some do support linear. $\endgroup$
    – Hakanai
    Apr 27, 2022 at 1:44

I think there's two parts to this question.

Part 1. What units is $I(λ)$ in?

Usually $I$ (spectral radiance) is in watts per steradian per square metre per metre, or sometimes watts per steradian per square metre per nanometre, since often nanometres are being used for the wavelength.

When you integrate that with respect to $λ$, you then end up with watts per steradian per square metre.

Beyond that, for RGB at least, I'm not sure what happens.

When you're using the XYZ colour matching functions, you usually multiply by a factor of 683 lumens per watt, so the result ends up being lumens per steradian per square metre, which is the same as candela per square metre, which is sometimes called a nit. This makes sense when you consider that the Y in XYZ is the luminance. (Now, whether X and Z can also be considered to be in nits, is another question...)

Part 2. How do I interpret hyperspectral camera data?

There's two parts for this.

First, you say you have values in range 0-65535. Yes, you do start by scaling that to 0.0~1.0, by dividing by 65535.0.

Second, if the images were actually capturing and recording spectral radiance, then you have to find some maximum value to consider the peak and scale the values to that.

If the images were actually capturing spectral reflectance, which was the case for at least one such hyperspectral image set I came across, you also have to multiply through by an illuminant function like D65, to get the spectral radiance. And you'll probably still have to arbitrarily scale the result you get, because the units for the illuminant function are arbitrary as well. It's kind of annoying to have to do this illuminant multiplication, but one benefit it does give you is that you can simulate different lighting conditions for the scene by switching illuminants in the calculation.

This all assumes that it's just a set of images which you obtained from someone else who wasn't rigorous enough to document their units. If it's a camera you own, you might find that the documentation or perhaps the image metadata contains the information you are missing.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.