coneypo / Dlib_face_recognition_from_camera

Detect and recognize the faces from camera / 调用摄像头进行人脸识别,支持多张人脸同时识别
http://www.cnblogs.com/AdaminXie/p/9010298.html
MIT License
2.07k stars 572 forks source link

OT算法下的不支持中文名称输出吗? #35

Closed Zy143L closed 3 years ago

Zy143L commented 3 years ago

我把face_reco_from_camera的show_chinese_name放到face_reco_from_camera_ot_multi_people中 发现输出中文都是??? 向下翻阅发现使用是 cv2.putText 作者考虑更新下这方面的代码吗?

coneypo commented 3 years ago

直接参考 https://github.com/coneypo/Dlib_face_recognition_from_camera/blob/master/face_reco_from_camera.py 里面用 PIL 画就好了,替代 cv2.putText(),我今天提个 MR;

def draw_name(self, img_rd):
    # 在人脸框下面写人脸名字 / Write names under rectangle
    font = ImageFont.truetype("simsun.ttc", 30)
    img = Image.fromarray(cv2.cvtColor(img_rd, cv2.COLOR_BGR2RGB))
    draw = ImageDraw.Draw(img)
    for i in range(self.current_frame_face_cnt):
        # cv2.putText(img_rd, self.current_frame_name_list[i], self.current_frame_name_position_list[i], font, 0.8, (0, 255, 255), 1, cv2.LINE_AA)
        draw.text(xy=self.current_frame_name_position_list[i], text=self.current_frame_name_list[i], font=font)
        img_with_name = cv2.cvtColor(np.array(img), cv2.COLOR_RGB2BGR)
    return img_with_name
coneypo commented 3 years ago

Udpated here: https://github.com/coneypo/Dlib_face_recognition_from_camera/commit/4e4553d5e95e034bc19b41dc7db9729326f8e392