Test on Raspberry pi successfully, fix some small staff

This commit is contained in:
Feier Zhang 2021-03-28 18:02:09 -04:00
parent 175fe1ebeb
commit 850e91f209

View file

@ -47,6 +47,7 @@ def inference():
img = cv2.cvtColor(im, cv2.COLOR_BGR2RGB) img = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
faces = faceDetector(cv2.cvtColor(img, cv2.COLOR_BGR2RGB)) faces = faceDetector(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
minDistance = 0.0
for face in faces: for face in faces:
@ -81,12 +82,12 @@ def inference():
# print("time taken = {:.3f} seconds".format(time.time() - t)) # print("time taken = {:.3f} seconds".format(time.time() - t))
cv2.rectangle(im, (x1, y1), (x2, y2), (0, 255, 0), 2) cv2.rectangle(im, (x1, y1), (x2, y2), (0, 255, 0), 2)
font_face = cv2.FONT_HERSHEY_SIMPLEX font_face = cv2.FONT_HERSHEY_SIMPLEX
font_scale = 0.8 font_scale = 0.8
text_color = (0, 255, 0) text_color = (0, 255, 0)
printLabel = '{} {:0.4f}'.format(label, minDistance) printLabel = '{} {:0.4f}'.format(label, minDistance)
cv2.putText(im, printLabel, (int(x1), int(y1)), font_face, font_scale, text_color, thickness=2) cv2.putText(im, printLabel, (int(x1), int(y1)), font_face, font_scale, text_color, thickness=2)
cv2.imshow('img', im) cv2.imshow('img', im)