mediapipe
mediapipe copied to clipboard
Easier way to access the co-ordinates
System information
- Have I written custom code (as opposed to using a stock example script provided in Mediapipe): No
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04, Android 11, iOS 14.4): GNU/Linux Manjaro Ruah 21.3.6
- MediaPipe version: 0.8.10.1
- Bazel version: 5.2.0-1
- Solution (e.g. FaceMesh, Pose, Holistic): Face Detection
- Programming Language and version ( e.g. C++, Python, Java): Python
Describe the expected behavior:
Easier way to access the co-ordinates, if possible, as non-normalized.
i.e. Is there any better option to access the co-ordinates than this:
results.detections[0].location_data.relative_keypoints[5].x * img_width
or
mp_face_detection.get_key_point(results.detections[0], mp_face_detection.FaceKeyPoint.LEFT_EYE).x * img_width
Standalone code you may have used to try to get what you need :
with mp_face_detection.FaceDetection(
model_selection=1, min_detection_confidence=0.5) as face_detection:
results = face_detection.process(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
left_eye_x = results.detections[0].location_data.relative_keypoints[5].x * img_width
left_eye_y = results.detections[0].location_data.relative_keypoints[5].y * img_height
right_eye_x = results.detections[0].location_data.relative_keypoints[_].x * img_width
Hi @AnkS4 , For example, you get the coordinates here and simply multiply by the input image size.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you.
Closing as stale. Please reopen if you'd like to work on this further.