# Reading an RGB image from purethermal 2 using opencv?

**URL:** <https://forum.opencv.org/t/reading-an-rgb-image-from-purethermal-2-using-opencv/2379>\
**Category:** Uncategorized\
**Created:** [March 25, 2021, 7:11pm UTC](https://forum.opencv.org/t/reading-an-rgb-image-from-purethermal-2-using-opencv/2379 "2021-03-25T19:11:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![orend](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/orend/32/1557_2.png) [@orend](https://forum.opencv.org/u/orend)\
**Post date:** [March 25, 2021, 7:11pm UTC](https://forum.opencv.org/t/reading-an-rgb-image-from-purethermal-2-using-opencv/2379/1 "2021-03-25T19:11:07Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![laurent.berger](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@laurent.berger](https://forum.opencv.org/u/laurent.berger)\
**Post date:** [March 25, 2021, 7:40pm UTC](https://forum.opencv.org/t/reading-an-rgb-image-from-purethermal-2-using-opencv/2379/2 "2021-03-25T19:40:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![aluis-rcastro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/aluis-rcastro/32/1406_2.png) [@aluis-rcastro](https://forum.opencv.org/u/aluis-rcastro)\
**Post date:** [March 25, 2021, 8:34pm UTC](https://forum.opencv.org/t/reading-an-rgb-image-from-purethermal-2-using-opencv/2379/3 "2021-03-25T20:34:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![orend](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/orend/32/1557_2.png) [@orend](https://forum.opencv.org/u/orend)\
**Post date:** [March 26, 2021, 7:41am UTC](https://forum.opencv.org/t/reading-an-rgb-image-from-purethermal-2-using-opencv/2379/4 "2021-03-26T07:41:41Z")

</div>

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.
