# Haar Face Counting with Lepton 3.1R/Infrared Camera

**URL:** <https://forums.openmv.io/t/haar-face-counting-with-lepton-3-1r-infrared-camera/8923>\
**Category:** OpenMV Boards\
**Created:** [November 8, 2023, 2:06pm UTC](https://forums.openmv.io/t/haar-face-counting-with-lepton-3-1r-infrared-camera/8923 "2023-11-08T14:06:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![RickBullotta](https://avatars.discourse-cdn.com/v4/letter/r/779978/32.png) [@RickBullotta](https://forums.openmv.io/u/RickBullotta)\
**Post date:** [November 8, 2023, 2:06pm UTC](https://forums.openmv.io/t/haar-face-counting-with-lepton-3-1r-infrared-camera/8923/1 "2023-11-08T14:06:37Z")

</div>

Besides the obvious change from HQVGA to QQVGA, any other suggestions for changes to the code below that worked well for the standard camera to make it work effectively with the Lepton 3.1R?

# Reset sensor

sensor.reset()  
sensor.set\_contrast(3)  
sensor.set\_gainceiling(32)

sensor.set\_framesize(sensor.HQVGA)  
sensor.set\_pixformat(sensor.GRAYSCALE)  
sensor.set\_framebuffers(1)

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [November 8, 2023, 5:16pm UTC](https://forums.openmv.io/t/haar-face-counting-with-lepton-3-1r-infrared-camera/8923/2 "2023-11-08T17:16:41Z")

</div>

The haar cascade needs greyscale images of people’s faces. If you want to do this in thermal you need to train a new CNN using FOMO with edge impulse.

---

<div class="post-metadata">

**Author:** ![RickBullotta](https://avatars.discourse-cdn.com/v4/letter/r/779978/32.png) [@RickBullotta](https://forums.openmv.io/u/RickBullotta)\
**Post date:** [November 8, 2023, 5:32pm UTC](https://forums.openmv.io/t/haar-face-counting-with-lepton-3-1r-infrared-camera/8923/3 "2023-11-08T17:32:41Z")

</div>

OK. I was confused by this statement on this page:

[Pure Thermal OpenMV | OpenMV](https://openmv.io/products/openmv-pure-thermal)

" \* **Face Detection**

- You can detect Faces with your Pure Thermal OpenMV (or any generic object). Your Pure Thermal OpenMV can process Haar Cascades to do generic object detection and comes with a built-in Frontal Face Cascade and Eye Haar Cascade to detect faces and eyes. [Video demo here](https://youtu.be/Lmuiojo0N4A)."

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [November 8, 2023, 6:22pm UTC](https://forums.openmv.io/t/haar-face-counting-with-lepton-3-1r-infrared-camera/8923/4 "2023-11-08T18:22:37Z")

</div>

Yes, it has a color camera at the same time for that purpose which can do the face detection. You can then combine the IR data and map that to where the face is.

---

<div class="post-metadata">

**Author:** ![RickBullotta](https://avatars.discourse-cdn.com/v4/letter/r/779978/32.png) [@RickBullotta](https://forums.openmv.io/u/RickBullotta)\
**Post date:** [November 8, 2023, 9:26pm UTC](https://forums.openmv.io/t/haar-face-counting-with-lepton-3-1r-infrared-camera/8923/5 "2023-11-08T21:26:05Z")

</div>

Ah, OK. Makes sense. Didn’t know that it had both cameras.

Thanks for the info Kwabena, and thanks for making great stuff!
