Closed Zy143L closed 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
我把face_reco_from_camera的show_chinese_name放到face_reco_from_camera_ot_multi_people中 发现输出中文都是??? 向下翻阅发现使用是 cv2.putText 作者考虑更新下这方面的代码吗?