Web demo: Correctly display name.

This commit is contained in:
Brandon Amos 2015-10-03 23:40:16 -04:00
parent b0561510b1
commit dc7b050423
1 changed files with 7 additions and 1 deletions

View File

@ -297,7 +297,13 @@ class FaceNetServerProtocol(WebSocketServerProtocol):
tr = (bb.right(), bb.top())
cv2.rectangle(annotatedFrame, bl, tr, color=(153, 255, 204),
thickness=3)
name = "Unknown" if identity == -1 else self.people[identity]
if identity == -1:
if len(self.people) == 1:
name = self.people[0]
else:
name = "Unknown"
else:
name = self.people[identity]
cv2.putText(annotatedFrame, name, (bb.left(), bb.top()-10),
cv2.FONT_HERSHEY_SIMPLEX, fontScale=0.75,
color=(152, 255, 204), thickness=2)