#🔒 How to filter face landmark coordinates by specific facial regions using Mediapipe?

4 messages · Page 1 of 1 (latest)

past trellis
#

My Goal: I am trying to create a simple dataset to train a machine learning model. In this dataset, I want to detect the coordinates of points in specific facial regions such as the eyes, eyebrows, and lips.

How It Works/Should Work:

  • First, I process the frames taken from the webcam using the methods in mediapipe_utils.py to detect face landmarks and obtain face_results.
  • In the data_capture.py file, I loop through each point on the face with for landmark in face_results.multi_face_landmarks[0].landmark.
  • I check whether each point obtained from face_results.multi_face_landmarks[0].landmark is one of the points in the eyes, eyebrows, or lips. If the point is from one of these regions, I obtain its coordinates relative to the nose tip (considered as the origin) and save them in JSON format.

Problem: While the landmark content is in the form of x: 0.345954359 y: 0.904962182 z: 0.0607943721, the face_mesh.FACEMESH_LIPS content is in the form of FACEMESH_LIPS = frozenset([(61, 146), (146, 91), ...]). Since these outputs are unrelated, I am unable to filter them.

What I Want: I want to detect the coordinates of only the eyes, eyebrows, and lips points, with the nose tip coordinates as the origin.

Since this is my first time using Mediapipe, I have no idea what to do.

(To keep the question concise, I will only show the relevant code snippets from the necessary files in the project.)

https://paste.pythondiscord.com/VY7Q

umbral gardenBOT
#

@past trellis

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

umbral gardenBOT
#

@past trellis

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.