How can I convert RGB values of the thermal image into Celsius or kelvin temperature in python?

Here is the thermal image taken by a FLIR device:

enter image description here

Here I am reading image using OpenCV and getting the RGB values from it but I don't know how to convert these RGB values to temperature:

import cv2 as cv
import numpy as np

# read image
img = cv.imread('D:/Desktop/images/thermal.jpg')
img = cv.resize(img, (300, 300))

for i in range(img.shape[0]):
    for j in range(img.shape[1]):
        print(img[i, j])

cv.imshow('img', img)


Any help would be appreciated!

  • $\begingroup$ This is a classic calibration problem. You need a (R,G,B)->T function. This is a "surface" in three space. You need to take some calibration measurements then create a polynomial (easiest) best fit function to your points. $\endgroup$ Jul 30, 2020 at 17:34
  • $\begingroup$ That is not a pure thermal image. It looks like the thermal colors are superimposed on a greyscale image from a regular camera. $\endgroup$
    – Justme
    Jul 30, 2020 at 21:56
  • $\begingroup$ Ummm, I’m a bit out of my depth but... contact Flir? $\endgroup$
    – Dan Szabo
    Jul 30, 2020 at 23:34
  • $\begingroup$ @CedronDawg what is T function and how to implement it $\endgroup$
    – rizwan
    Aug 3, 2020 at 7:57
  • $\begingroup$ @Justme this is a pure FLIR image taken by FLIR camera $\endgroup$
    – rizwan
    Aug 3, 2020 at 7:58


Your Answer

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

Browse other questions tagged or ask your own question.