Reading an RGB image from purethermal 2 using opencv?

Hello
I am not sure if this the right to forum to ask this question, however I am unable to post this question, on the FLIR developers forum, so I will ask here.

I am planning to use the purethermal 2 with a lepton 2.5, to detect people.
The purethermal 2 seems to work just fine with the FLIR application on windows, and also with window’s Camera.
However when I switch to python and opencv and try to do:
cap = cv2.VideoCapture(0)
_, img = cap.read()

the program gets stuck, and the white LED, on the camera flashes rapidly (I believe that it mean that it does capture video), and in the end I am unable to read the image.

After some searching around, I found I should to use:
cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)

While I can get an image using this declaration, I get a mostly grey image which seems broken, and not an RGB image.

How should I use the purethermal 2 and opencv?

many thanks!

Hi,
thermal image are grey image not rgb. Pixel unit is kelvin

Not clear how you coded it, are you calling both above VideoCapture() and read() methods inline ? It would be expected to have the first one ( device select ) instantiated just once, whereas the last one ( capture the frame from video stream ) inside a loop.

Yes, I Do read the frame in a loop, what I wrote was just an example, In my real code I mean to write in a loop.
However it does matter if I do it inline or, in a loop, the result is cannot read the frame.