Skip to content

Instantly share code, notes, and snippets.

@karan19100
Created December 18, 2020 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karan19100/1b7968970e59bbfc1cb56590563e411f to your computer and use it in GitHub Desktop.
Save karan19100/1b7968970e59bbfc1cb56590563e411f to your computer and use it in GitHub Desktop.
# Face detected but Lips not detected which means person is wearing mask
if(len(mouth_rects) == 0):
cv2.putText(img, weared_mask, org, font, font_scale, weared_mask_font_color, thickness, cv2.LINE_AA)
else:
for (mx, my, mw, mh) in mouth_rects:
if(y < my < y + h):
# Face and Lips are detected but lips coordinates are within face cordinates which means lips prediction is true and
# person is not waring mask
cv2.putText(img, not_weared_mask, org, font, font_scale, not_weared_mask_font_color, thickness, cv2.LINE_AA)
cv2.rectangle(img, (mx, my), (mx + mh, my + mw), (0, 0, 255), 3)
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment