pythonopencvtemperaturehikvision

Trying to read Thermal Data from Hikvision Camera in Python


I'm looking for solution to access thermal data of camera. well i used OpenCV and only could got original image. but there is no more data for process like temperature. I tried available library about HikVision cameras and surfed the net for this. but i could not be succeed. also I tried FLIR library but no success.

second solution that I have is converting RGB to temperature but i don't know what to do for this kind of process. Also I know the range of device temperature which is between-20 to 150 degree

looking for something like this:

# cam model: hikvision DS-2TD2615-10

import cv2
import hikvision api library for example

thermal = cv2.VideoCapture()
thermal.open("rtsp://""user:pass@ip:port/Streaming/channels/202/")
ret, frame = thermal.read()

while True:
   ret, frame = thermal.read()

   temp_data = api.read_temperature(frame) # -> array or excel file

   cv2.imshow('frame', frame)  
   if cv2.waitKey(1) & 0xFF == ord('q'):
       break
thermal.release()
cv2.destroyAllWindows()

and my video input is something similar to this pic and for example i want to find out the nose is how much hot just by click on it: input


Solution

  • General answer for thermal images from any camera - you can't just convert grayscale level (or color if you already applied pallete to your image) to temperature values. You need to know some coefficients which relates to IR matrix. Some software may embed that data to image file metadata but there is no standard for that. Also, if you resaved your image file without knowing it, you'll probably lose that metadata.

    Also, like plain visible-light camera, IR-camera can adapt it's range to current image. So, if you're shooting a human in a room, minimum temperature in your picture will be like 22°С (cold wall or floor), maximum will be like 37°C (hottest part of human body). In that case you'll get 256 gray levels covering range of 15 degrees, so black color is 22°С, white is 37°С (keep in mind proportion is not linear!). You move your camera to a cup of hot tea with like 60°С and your relation of gray level to temperature changes. So, you need to get coefficients for every frame.

    It is possible to "fix" temperature range on some cameras but that depends on specific models.

    More than that - most cheap thermal cameras don't deal with temperature values at all.

    P.S. Oh, I just noticed exact model of your camera. So answer is even stronger "YOU CAN'T". Don't expect capabilities of science or medical thermal camera from that chinese poorly documented surveilance hardware.