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.pyto detect face landmarks and obtainface_results. - In the
data_capture.pyfile, I loop through each point on the face withfor landmark in face_results.multi_face_landmarks[0].landmark. - I check whether each point obtained from
face_results.multi_face_landmarks[0].landmarkis 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.)