# How can i get Celsius/kelvin temperature from a thermal image in python language?

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:

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

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)

cv.waitKey(0)
cv.destroyAllWindows()

Any help would be appreciated!

• 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. Jul 30, 2020 at 17:34
• That is not a pure thermal image. It looks like the thermal colors are superimposed on a greyscale image from a regular camera. Jul 30, 2020 at 21:56
• Ummm, I’m a bit out of my depth but... contact Flir? Jul 30, 2020 at 23:34
• @CedronDawg what is T function and how to implement it Aug 3, 2020 at 7:57
• @Justme this is a pure FLIR image taken by FLIR camera Aug 3, 2020 at 7:58