如何使用cv2.putText在检测到的面上方显示名称?

2024-06-28 19:16:35 发布

您现在位置:Python中文网/ 问答频道 /正文

enter image description here我将dlib用于基于图像的人脸识别应用程序。如何使用cv2.putText在检测到的面上方写入名称?你知道吗

for ( k, face ) in enumerate( face_image ):  

    faceBlob = cv2.dnn.blobFromImage(face, 1.0 / 255,
    (96, 96), (0, 0, 0), swapRB=True, crop=False)
    embedder.setInput(faceBlob)
    vec = embedder.forward()

    # perform classification to recognize the face
    preds = recognizer.predict_proba(vec)[0]
    j = np.argmax(preds)
    proba = preds[j]
    name = le.classes_[j]

Tags: 图像image应用程序heredescriptioncv2face人脸识别
1条回答
网友
1楼 · 发布于 2024-06-28 19:16:35

试着玩弄这些价值观。你知道吗

    font = cv2.FONT_HERSHEY_SIMPLEX 
    org = (x, y) 
    fontScale = 1 #(try differnt values)
    color = (0, 0, 0) 
    thickness = 2 #(try differnt values)
    image = cv2.putText(img, "TEXT", org, font,  
                       fontScale, color, thickness, cv2.LINE_AA)

相关问题 更多 >