mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

Easier way to access the co-ordinates

Open AnkS4 opened this issue 3 years ago • 0 comments

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

AnkS4 avatar Aug 10 '22 09:08 AnkS4

Hi @AnkS4 , For example, you get the coordinates here and simply multiply by the input image size.

sureshdagooglecom avatar Aug 22 '22 07:08 sureshdagooglecom

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.

google-ml-butler[bot] avatar Aug 29 '22 08:08 google-ml-butler[bot]

Closing as stale. Please reopen if you'd like to work on this further.

google-ml-butler[bot] avatar Sep 05 '22 08:09 google-ml-butler[bot]

Are you satisfied with the resolution of your issue? Yes No

google-ml-butler[bot] avatar Sep 05 '22 08:09 google-ml-butler[bot]