Finding Temperature from RGB Value | Using Wien's Law for Color Determination

  • Thread starter Ashiataka
  • Start date
  • Tags
    Colour
In summary,This conversation explains how to determine the temperature of an object using the RGB values of the object.
  • #1
Ashiataka
21
1
Suppose I have a picture of a flame, or some other blackish-body like emitter, and I can see that the RGB value of a part of the flame is [106, 216, 177]. How would I go about determining the temperature of this?

I'm sure you'd use Wien's law etc, but I can't see how to get from the RGB value to the frequency.

Thank you.
 
Physics news on Phys.org
  • #2
I don't think you can. You would probably need a spectrograph. The problem is that each color has overlap from each other color along with different quantum efficiency, which is how many photons the sensor records compared to how many photons there originally were. Also, each color is recording a large range of wavelengths within it's range, not all of which are equally captured by the sensor.
If you knew the QE of your sensor, and were able to take very good calibration and test frames you MIGHT be able to get an approximation, but I don't know how accurate it would be. Perhaps a bit better than using your eyeball and saying "It looks deep red, so it's X temperature".
 
  • #4
Ashiataka said:
Suppose I have a picture of a flame, or some other blackish-body like emitter, and I can see that the RGB value of a part of the flame is [106, 216, 177]. How would I go about determining the temperature of this?

I'm sure you'd use Wien's law etc, but I can't see how to get from the RGB value to the frequency.

Thank you.

I would approach this in a very practical way. I think you can rely on the RGB values from a colour camera to be fairly consistent if you have consistent exposure. Needless to say, you would need to be shooting 'RAW' to avoid any auto correction in your camera.
You could take spot readings of known 'hot objects' like the sun and photographic lamps, that have a tight colour temperature spec as long as you give them the right voltage. They are obtainable from several suppliers, I believe.

Alternatively, if you had access to a spectrometer, you could measure the spectrum from a tungsten lamp at different temperatures and use that to determine those temperatures. At the same time, you could record RGB values from your colour sensor. This would calibrate the camera for you.

Do you mean peak frequency / wavelength at a given temperature?
 
  • #5
You can make a simple spectrograph using your camera and a prism. I'm sure you could find the details online somewhere.
 
  • #6
Drakkith said:
You can make a simple spectrograph using your camera and a prism. I'm sure you could find the details online somewhere.

Unless you have a single wide-band detector, I don't see how you can produce a valid spectrogram (as opposed to a spectrograph, which would just be a 'picture' of the spectrum?) I suppose that you could get an idea of the sensitivity graphs of the three sensors if the spectrum of the incident light were already known (e.g. sunlight). But your idea also involves at least a "poor man's" spectrometer which would involve significant effort, I think.

I guess the characteristics of the three sensors in the camera could be obtained from the manufacturer and that could help. The problem lies with the limited info from three ( RGB ) signals, I think, and I reckon you would need some know light sources to that you could calibrate the system before you could get valid results. The software inside cameras does calculate its own version of the colour temperature of a scene, when you are working with RAW format. I guess it depends upon the accuracy that's required in the OP.
 
  • #7
I don't know the details, I only know that you can do it. At least, that's what my book on Spectroscopy for Amateurs says. It has the details, only I don't have access to it until I move back to Tucson in 6 months. This is the book: https://www.amazon.com/dp/1441972382/?tag=pfamazon01-20
 
Last edited by a moderator:
  • #8
Drakkith said:
I don't know the details, I only know that you can do it. At least, that's what my book on Spectroscopy for Amateurs says. It has the details, only I don't have access to it until I move back to Tucson in 6 months. This is the book: https://www.amazon.com/dp/1441972382/?tag=pfamazon01-20

Actually, that post (no. 3) (thanks for that, collinsmark) gives all you need to get from RGB values to a fair estimate of colour temperature. Of course, it assumes that the camera gives you correct RGB values out and that there's no jiggery pokery inside it.
 
Last edited by a moderator:
  • #9
3 readings are enough to establish temperature assuming perfect black body. It would help greatly, however, to know the response spectra of the RGB pixels.

I have some code I wrote a few years ago that generates an RGB triple based on temperature. It's not exactly the same thing, because I was basing the values on RGB output frequencies and human eye response, so camera RGB values might not be exactly right. If you just need an estimate, however, this could work. All you'd need to do is sweep through temperatures and look for T that gives you the best fit, after brightness adjustment, to the three values you have.

Unfortunately, I haven't kept a great track of all my sources for the formulae. These could have been of greater use for you.

Edit: Specific values you provided, by the way, cannot correspond to a black body radiation of a flame. If you didn't just make these up, you cannot treat that flame as a black body.
 
Last edited:
  • #10
K^2 said:
3 readings are enough to establish temperature assuming perfect black body. It would help greatly, however, to know the response spectra of the RGB pixels.

I have some code I wrote a few years ago that generates an RGB triple based on temperature. It's not exactly the same thing, because I was basing the values on RGB output frequencies and human eye response, so camera RGB values might not be exactly right. If you just need an estimate, however, this could work. All you'd need to do is sweep through temperatures and look for T that gives you the best fit, after brightness adjustment, to the three values you have.

Unfortunately, I haven't kept a great track of all my sources for the formulae. These could have been of greater use for you.

Edit: Specific values you provided, by the way, cannot correspond to a black body radiation of a flame. If you didn't just make these up, you cannot treat that flame as a black body.

Assuming the readings are genuine, I wonder which is more likely - the flame isn't black body or the Camera software has manipulated the RGB values? I suppose that some traces of a metal in the flame could be colouring it (as in 'flame tests').
How far from black body are those values? Could it be affected by background lighting? We don't know about the actual measurement setup.

It's just possible that our enthusiastic responses have manged to scare Ashiataka off! We haven't heard from him / her for a while. Come baaaaack!
 
  • #11
Very far. Temperatures you can get from a flame would correspond to colors red to white. Sun = 5700K. [106, 216, 177] is teal. Even assuming an error due to camera, we are talking about something in the 10kK+ range.
 

1. What is the relationship between RGB value and temperature?

The RGB value of a color is directly related to its temperature, as determined by Wien's Law. The higher the temperature, the bluer the color will appear, and the lower the temperature, the redder the color will appear.

2. How accurate is using Wien's Law to determine temperature from RGB value?

Using Wien's Law to determine temperature from RGB value can be fairly accurate, as long as the color being measured is within the visible spectrum and is not affected by external lighting or other factors. However, it may not be as precise as using more specific methods for temperature measurement.

3. Can Wien's Law be applied to all colors?

Wien's Law is specifically designed to calculate the temperature of an object emitting thermal radiation, which falls within the visible spectrum. This means that it cannot be applied to non-visible colors, such as ultraviolet or infrared.

4. Is finding temperature from RGB value a commonly used method in science?

Finding temperature from RGB value is not a commonly used method in scientific research, as it is not as precise or accurate as other techniques. However, it can be useful in certain applications, such as in photography or for quick estimations.

5. How can I use Wien's Law to calculate temperature from RGB value?

To use Wien's Law, you will need to convert the RGB value to a corresponding wavelength of light. This can be done using a conversion chart or calculator. Then, plug the wavelength into the equation for Wien's Law (λmax = b/T), where b is the Wien's displacement constant and T is the temperature in Kelvin. Finally, solve for T to determine the temperature in Kelvin.

Similar threads

Replies
29
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
730
  • Engineering and Comp Sci Homework Help
Replies
14
Views
1K
  • Classical Physics
Replies
3
Views
601
  • Quantum Physics
Replies
2
Views
995
Replies
1
Views
874
  • Cosmology
Replies
4
Views
1K
  • Introductory Physics Homework Help
Replies
6
Views
1K
  • Advanced Physics Homework Help
Replies
5
Views
2K
Back
Top