- so, when I go outside I forgot my mask at home then after realization, I get back home and take it
- it's just a waste of time
How it works:
- made a system with OpenCV to detect I'm wearing a mask or not, if I'm not wearing a mask then it will give me a mask, and also when I return at home it reminds me to sanitize my hands
- the ultrasonic sensor detects that I'm in front of the camera or not.
- by using open cv and front face Haar cascade files it detects face and the by using mouth Haar cascade it detects mouth if it's able to detect face without mouth it will say that I'm wearing a mask if it detects face and mouth both then it says that I am not wearing a mask.
- so if it detects that I'm wearing a mask then it just doesn't do any then and ignore it and if it detects I'm not wearing a mask the servo on the top of the gate will give me the mask hanging to it.
- and when I come home an app called Automate that detects that I'm that my phone is connected to homes wifi then it posts an HTTP request to the system then the system will remind me to sanitize my hands if I don't pick up the bottle in under 30 sec then it will again remind me.
- Automate flow to post HTTP requests when I come home.
- there is a webserver running in NodeMCU that is connected to a python program via serial
- so if the person in front of the ultrasonic sensor is then it will type H in serial then the python reads it and starts the procedure of mask or not detection if it finds that the person is not wearing a mask then it will post an HTTP request to rotate the servo to give mask on top of the gate
m5 = serial.Serial('COM5', 115200, timeout=.1)# change port as per your Nodemcu Port
da = m5.readline()[:-2]
- I'm a beginner at it
- haar cascade so haar feature-based cascade classifier is a machine learning-based approach where a cascade function is trained for a lot of positive and negatives images
- so by using this I can detect faces. Click here to find
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
cap = cv2.VideoCapture(0)
_, img = cap.read()
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, 1.1, 4)
for (x, y , w ,h) in faces:
cv2.rectangle(img, (x,y), (x+w, y+h), (255, 0 , 0), 3)
if cv2.waitKey(1) & 0xFF == ord('q'):
- this way you can also make your own Haar cascade
- so my idea is to find faces then mouth if the system is not able to find a mouth then I'm wearing a mask and if able to find a mouth and face then no mask.
More you can do:
- pip install pyttsx
- pip install serial
- pip install opencv-python
- you can use a raspberry pi as the onboard computer it will be a better choice as my pi is on another work.
- add pump that sprays sanitizer to the whole boy when you come home.
- at the last stay home stay safe.