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]
答案 0 :(得分:0)
尝试使用这些值。
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)