Skip to content

Commit 76f1c32

Browse files
authored
Merge pull request #5 from cvjena/develop
Add support for Blendshapes
2 parents 9aa41e8 + 0aca0c7 commit 76f1c32

File tree

5 files changed

+178
-11
lines changed

5 files changed

+178
-11
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ A small demo is hosted [here](https://semg.inf-cv.uni-jena.de/), together with t
1212
- **Visualize muscle activity**: The EMG Intensity plot allows you to visualize the intensity of muscle activity over the face, providing insights into patterns and variations.
1313
- **Designed explicitly for facial muscles**: The tool focuses on facial muscles, enabling you to study and understand muscle activity in the face, which can be particularly useful in fields like facial expression analysis, neuroscience, and rehabilitation.
1414
- **FACS**: Visualize the Facial Action Coding System at the correct anatomical locations for a more intuitive understanding of the data.
15+
- **Blend Shapes**: Many existing blend shape models base their movements on the FACS. We provide a location mapping for commonly used blend shapes models and where they are located on the face to the AU muscle.
1516
- **Potential for extension**: While the current focus is on facial muscles, this tool could potentially be extended to analyze other muscle groups.
1617
- **Beyond muscles**: The tool can also be used to plot additional facial information, such as oxygen saturation, but this is not officially supported yet.
1718

@@ -64,9 +65,11 @@ For the colorization, the users can use any color map from [matplotlib](https://
6465
We currently support the two following schematics for acquiring the EMG data.
6566
If you want to have your own, please open an issue or create a pull request, and we will be happy to add it.
6667

67-
| [Fridlund and Cappacio, 1986](https://pubmed.ncbi.nlm.nih.gov/3809364/) | [Kuramoto et al., 2019](https://onlinelibrary.wiley.com/doi/10.1002/npr2.12059) | [Ekman and Friesen - FACS](https://psycnet.apa.org/record/1971-07999-001)|
68-
|---|---|---|
69-
| ![Locations ](files/locations_fridlund.jpg) | ![Locations ](files/locations_kuramoto.jpg) | ![Locations ](files/locations_facs.jpg) |
68+
| [Fridlund and Cappacio, 1986](https://pubmed.ncbi.nlm.nih.gov/3809364/) | [Kuramoto et al., 2019](https://onlinelibrary.wiley.com/doi/10.1002/npr2.12059)|
69+
| :---: | :---: |
70+
| ![Locations ](files/locations_fridlund.jpg) | ![Locations ](files/locations_kuramoto.jpg) |
71+
| [Ekman and Friesen - FACS](https://psycnet.apa.org/record/1971-07999-001)| [Mediapipe Blendshapes](https://storage.googleapis.com/mediapipe-assets/Model%20Card%20Blendshape%20V2.pdf)|
72+
| ![Locations ](files/locations_facs.jpg) | ![Locations ](files/locations_blendshapes.jpg) |
7073

7174
If you want to define your custom scheme, create a new class inherited from `emg.Schematic` and implement the `locations` member. If you support the mirroring of the face, implement the `pairs_L` and `pairs_R` members.
7275
Then, use it in the `interpolate` function, and you are good to go.

examples/schemes.ipynb

Lines changed: 79 additions & 5 deletions
Large diffs are not rendered by default.

files/locations_blendshapes.jpg

94.3 KB
Loading

src/electromyogram/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"Scheme",
88
"colorize",
99
"get_colormap",
10-
"postprocess"
10+
"postprocess",
11+
"Blendshapes"
1112
]
1213

1314
from electromyogram.plot import (
@@ -18,4 +19,4 @@
1819
postprocess,
1920
)
2021

21-
from electromyogram.schemes import FACS, Fridlund, Kuramoto, Scheme
22+
from electromyogram.schemes import FACS, Fridlund, Kuramoto, Scheme, Blendshapes

src/electromyogram/schemes.py

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__all__ = ["Scheme", "Kuramoto", "Fridlund", "FACS"]
1+
__all__ = ["Scheme", "Kuramoto", "Fridlund", "FACS", "Blendshapes"]
22

33
import abc
44
from typing import Optional
@@ -229,4 +229,93 @@ class FACS(Scheme):
229229

230230
"AU26_R": (-70.0, -50.0),
231231
"AU26_L": ( 70.0, -50.0),
232+
}
233+
234+
class Blendshapes(Scheme):
235+
# X 1 - browDownLeft
236+
# X 2 - browDownRight
237+
# X 3 - browInnerUp
238+
# X 4 - browOuterUpLeft
239+
# X 5 - browOuterUpRight
240+
# X 6 - cheekPuff
241+
# X 7 - cheekSquintLeft
242+
# X 8 - cheekSquintRight
243+
# X 9 - eyeBlinkLeft
244+
# X 10 - eyeBlinkRight
245+
# X 11 - eyeLookDownLeft
246+
# X 12 - eyeLookDownRight
247+
# - 13 - eyeLookInLeft
248+
# - 14 - eyeLookInRight
249+
# - 15 - eyeLookOutLeft
250+
# - 16 - eyeLookOutRight
251+
# X 17 - eyeLookUpRight
252+
# X 18 - eyeLookUpRight
253+
# X 19 - eyeSquintLeft
254+
# X 20 - eyeSquintRight
255+
# X 21 - eyeWideLeft
256+
# X 22 - eyeWideRight
257+
# X 23 - jawForward
258+
# - 24 - jawLeft
259+
# X 25 - jawOpen
260+
# - 26 - jawRight
261+
# X 27 - mouthClose
262+
# X 28 - mouthDimpleLeft
263+
# X 29 - mouthDimpleRight
264+
# X 30 - mouthFrownLeft
265+
# X 31 - mouthFrownRight
266+
# X 32 - mouthFunnel
267+
# X 33 - mouthLeft
268+
# - 34 - mouthLowerDownLeft
269+
# - 35 - mouthLowerDownRight
270+
# X 36 - mouthPressLeft
271+
# X 37 - mouthPressRight
272+
# X 38 - mouthPucker
273+
# X 39 - mouthRight
274+
# X 40 - mouthRollLower
275+
# X 41 - mouthRollUpper
276+
# X 42 - mouthShrugLower
277+
# X 43 - mouthShrugUpper
278+
# X 44 - mouthSmileLeft
279+
# X 45 - mouthSmileRight
280+
# X 46 - mouthStretchLeft
281+
# X 47 - mouthStretchRight
282+
# - 48 - mouthUpperUpLeft
283+
# - 49 - mouthUpperUpRight
284+
# X 50 - noseSneerLeft
285+
# X 51 - noseSneerRight
286+
# X 52 - tongueOut
287+
locations = {
288+
"browInnerUp": (0.0, 65.0),
289+
290+
"browOuterUpRight": (-32.0, 60.0),
291+
"browOuterUpLeft": ( 32.0, 60.0),
292+
293+
"browDownRight": ( -9.0, 49.0),
294+
"browDownLeft": ( 9.0, 49.0),
295+
296+
"cheekSquintRight": (-42.0, 10.0),
297+
"cheekSquintLeft": ( 42.0, 10.0),
298+
299+
"noseSneerRight": (-16.0, -0.0),
300+
"noseSneerLeft": ( 16.0, -0.0),
301+
302+
"mouthShrugUpper": (0.0, -25.0),
303+
304+
"mouthRight": (-27.0, -38.0),
305+
"mouthLeft": ( 27.0, -38.0),
306+
307+
"mouthSmileRight": (-53.0, -8.0),
308+
"mouthSmileLeft": ( 53.0, -8.0),
309+
310+
"mouthDimpleRight": (-48.0, -24.0),
311+
"mouthDimpleLeft": ( 48.0, -24.0),
312+
313+
"mouthFrownRight": (-26.0, -69.0),
314+
"mouthFrownLeft": ( 26.0, -69.0),
315+
316+
"jawForward": (-0.0, -65.0),
317+
318+
"mouthStretchRight": (-53.0, -42.0),
319+
"mouthStretchLeft": ( 53.0, -42.0),
320+
232321
}

0 commit comments

Comments
 (0)