如何在face_recognition库中使用face_landmarks

发布于 2025-01-28 07:59:33 字数 1166 浏览 3 评论 0原文

face_rcognition库具有face_recognition.face_landmarks()这返回列表中的许多字典,每个字典都包含地标,例如top_lips right_eye等。谁能解释这些元组是什么,以及我如何使用它们?

[{'chin': [(294, 215), (295, 230), (297, 244), (300, 258), (304, 271), (312, 282), (321, 291), (332, 299), (345, 301), (358, 299), (368, 292), (376, 282), (384, 272), (390, 259), (393, 245), (396, 230), (397, 214)], 'left_eyebrow': [(306, 200), (313, 195), (322, 194), (331, 195), (339, 199)], 'right_eyebrow': [(357, 197), (365, 193), (374, 192), (383, 193), (389, 200)], 'nose_bridge': [(348, 211), (348, 221), (348, 231), (348, 242)], 'nose_tip': [(337, 248), (343, 250), (348, 251), (353, 250), (358, 248)], 'left_eye': [(316, 213), (322, 210), (329, 210), (335, 214), (329, 215), (322, 215)], 'right_eye': [(361, 214), (366, 209), (373, 209), (378, 212), (374, 215), (367, 215)], 'top_lip': [(329, 267), (335, 262), (343, 260), (348, 262), (354, 261), (360, 263), (366, 268), (363, 269), (353, 266), (348, 266), (343, 265), (332, 267)], 'bottom_lip': [(366, 268), (360, 276), (354, 279), (347, 279), (342, 278), (335, 274), (329, 267), (332, 267), (342, 271), (348, 272), (353, 272), (363, 269)]}]

The face_recognition library has face_recognition.face_landmarks() this returns many dictionaries in a list, and each dictionary contains landmarks like top_lips right_eye etc. and many tuples. Can anyone explain what these tuples are, and how I could use them?

[{'chin': [(294, 215), (295, 230), (297, 244), (300, 258), (304, 271), (312, 282), (321, 291), (332, 299), (345, 301), (358, 299), (368, 292), (376, 282), (384, 272), (390, 259), (393, 245), (396, 230), (397, 214)], 'left_eyebrow': [(306, 200), (313, 195), (322, 194), (331, 195), (339, 199)], 'right_eyebrow': [(357, 197), (365, 193), (374, 192), (383, 193), (389, 200)], 'nose_bridge': [(348, 211), (348, 221), (348, 231), (348, 242)], 'nose_tip': [(337, 248), (343, 250), (348, 251), (353, 250), (358, 248)], 'left_eye': [(316, 213), (322, 210), (329, 210), (335, 214), (329, 215), (322, 215)], 'right_eye': [(361, 214), (366, 209), (373, 209), (378, 212), (374, 215), (367, 215)], 'top_lip': [(329, 267), (335, 262), (343, 260), (348, 262), (354, 261), (360, 263), (366, 268), (363, 269), (353, 266), (348, 266), (343, 265), (332, 267)], 'bottom_lip': [(366, 268), (360, 276), (354, 279), (347, 279), (342, 278), (335, 274), (329, 267), (332, 267), (342, 271), (348, 272), (353, 272), (363, 269)]}]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

只怪假的太真实 2025-02-04 07:59:33

可以说,您的代码获得了地标:
在评论中纠正我。

results = face_recognition.face_landmarks()
import cv2

image = cv2.imread('path/to/image.jpg') 
for k, v in result:
    for (x, y) in v:
        cv2.circle(image, (x, y), 1, (0, 0, 255), -1)

Lets say you have code that gets the landmarks:
Correct me in the comments.

results = face_recognition.face_landmarks()
import cv2

image = cv2.imread('path/to/image.jpg') 
for k, v in result:
    for (x, y) in v:
        cv2.circle(image, (x, y), 1, (0, 0, 255), -1)
回眸一遍 2025-02-04 07:59:33

您可能更喜欢看到坐标的含义:

不要忘记从0而不是1开始。
另外,此stackoverflow答案也可能有用。

2024更新:facial_landmarks_68_idxs = ordereDdict([(“ ature”,(48,68)),(“ inner_mouth”,(60,68)),(“ right_eyeebrow”,(17,22)) ”,(22,27)),(“ right_eye”,(36,42)),(“ left_eye”,(42,48)),(“鼻子”,(27,36)),(“下巴”, (0,17)))))

You may prefer to see what that coordinates mean:
enter image description here

Don't forget to start from 0 instead of 1.
Also this StackOverflow answer could be useful too.

2024 Update: FACIAL_LANDMARKS_68_IDXS = OrderedDict([(“mouth”, (48, 68)), (“inner_mouth”, (60, 68)), (“right_eyebrow”, (17, 22)),(“left_eyebrow”, (22, 27)), (“right_eye”, (36, 42)), (“left_eye”, (42, 48)),(“nose”, (27, 36)), (“jaw”, (0, 17))])

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文