# OpenCV facial expressions mapping

**URL:** https://discourse.processing.org/t/opencv-facial-expressions-mapping/21133
**Category:** Libraries
**Created:** [May 21, 2020, 12:33pm UTC](https://discourse.processing.org/t/opencv-facial-expressions-mapping/21133 "2020-05-21T12:33:27Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![rkk16](https://avatars.discourse-cdn.com/v4/letter/r/a6a055/32.png) [@rkk16](https://discourse.processing.org/u/rkk16)
#### Post date: [May 21, 2020, 12:33pm UTC](https://discourse.processing.org/t/opencv-facial-expressions-mapping/21133/1 "2020-05-21T12:33:27Z")

</div>

What would be the best way to detect facial expressions from a live video on processing and map the different expressions into values?

---

<div class="post-metadata">

### Author: ![SomeOne](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/someone/32/8639_2.png) [@SomeOne](https://discourse.processing.org/u/SomeOne)
#### Post date: [May 21, 2020, 3:27pm UTC](https://discourse.processing.org/t/opencv-facial-expressions-mapping/21133/2 "2020-05-21T15:27:17Z")

</div>

I don’t think it would be possible to find a heuristic or algorithm to detect facial expressions. I would approach it with machine learning. Then the problem is where to find material to teach machine learning algorithm? Material would consist of set of images and related expression (classification). Neural networks would be in a way easiest method, but it would need lot’s of annotated material (data with classifications). Other machine learning algorithm could be used and they don’t require nearly as much teaching material. But they will not be able to learn straight from images. Those image would need to be transformed a to much smaller set of numbers. I believe biometric face recognition is based on

> Blockquote  
> Some face recognition [algorithms](https://en.wikipedia.org/wiki/Algorithms) identify facial features by extracting landmarks, or features, from an image of the subject’s face. For example, an algorithm may analyze the relative position, size, and/or shape of the eyes, nose, cheekbones, and jaw.[[14]](https://en.wikipedia.org/wiki/Facial_recognition_system#cite_note-14) These features are then used to search for other images with matching features.  
> [Facial recognition system - Wikipedia](https://en.wikipedia.org/wiki/Facial_recognition_system#Traditional)

Anyway there are methods to reduce faces and expression to a smaller set of number where simpler machine learning methods like Support Vector Machine could work well.

This is a very difficult problem, but it’s subject of active research. So if you want to proceed search internet. Face detection would be a good starting point.

---

<div class="post-metadata">

### Author: ![JAKEWELCH.DESIGN](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jakewelch.design/32/17972_2.png) [@JAKEWELCH.DESIGN](https://discourse.processing.org/u/JAKEWELCH.DESIGN)
#### Post date: [February 15, 2023, 11:04pm UTC](https://discourse.processing.org/t/opencv-facial-expressions-mapping/21133/3 "2023-02-15T23:04:00Z")

</div>

Hi, sorry to revive a thread 3 years after it was posted – did you ever find any routes with OpenCV & facial expression mapping that was viable in Processing? Or is the best option still some type of machine learning?
