diff --git a/dht2.py b/dht2.py index 6b2675c9252196b4aad765d6fffdc18ea72b3eec..1b828a84d22e1bbb8ee9b1ad84da3467f23df324 100644 --- a/dht2.py +++ b/dht2.py @@ -30,13 +30,13 @@ white = 1 # The White colored sensor. def temp(): try: - # This example uses the blue colored sensor. + # This example uses the blue colored sensor. # The first parameter is the port, the second parameter is the type of sensor. [temp, humidity] = grovepi.dht(sensor, blue) - - x = json.dumps({'temperature': temp, 'humidity': humidity}) + + x = json.dumps({"temperature": temp, "humidity": humidity}) if math.isnan(temp) is False and math.isnan(humidity) is False: - print("we are here") + # print("we are here") return x else: print("No data.") diff --git a/facial_recognition/facial_req.py b/facial_recognition/facial_req.py index 72646dd04464c252f37a6184b648ce3fd7d52757..fcf330fe6d6c7a5e1d927623eaafb582040891cf 100644 --- a/facial_recognition/facial_req.py +++ b/facial_recognition/facial_req.py @@ -26,7 +26,7 @@ def facial_rec(email): # Setting up Mail SMTP_USERNAME = "iotg16@outlook.com" # Mail id of the sender SMTP_PASSWORD = "Group16!" # Password of the sender - SMTP_RECIPIENT = "yashshahq@gmail.com" # Mail id of the receiver + SMTP_RECIPIENT = email # Mail id of the receiver SMTP_SERVER = "smtp.office365.com" # Address of the SMTP server SSL_PORT = 587 @@ -37,9 +37,8 @@ def facial_rec(email): # load the known faces and embeddings along with OpenCV's Haar # cascade for face detection - print("Loading the facial recognition technology.") + print("[INFO] loading encodings + face detector...") data = pickle.loads(open(encodingsP, "rb").read()) - # initialize the video stream and allow the camera sensor to warm up # Set the ser to the followng @@ -47,6 +46,7 @@ def facial_rec(email): # src = 2 : I had to set it to 2 inorder to use the USB webcam attached to my laptop # vs = VideoStream(src=2,framerate=10).start() vs = VideoStream(usePiCamera=True).start() + time.sleep(2.0) # start the FPS counter fps = FPS().start() @@ -94,7 +94,7 @@ def facial_rec(email): # If someone in your dataset is identified, print their name on the screen if currentname != name: currentname = name - + print(currentname) # update the list of names names.append(name) @@ -125,7 +125,7 @@ def facial_rec(email): if out[2] == "6": print("Shutdown detected") exit(0) - + print("Connected to mail") # Create the container (outer) email message TO = SMTP_RECIPIENT @@ -170,7 +170,8 @@ def facial_rec(email): # stop the timer and display FPS information fps.stop() - + print("[INFO] elasped time: {:.2f}".format(fps.elapsed())) + print("[INFO] approx. FPS: {:.2f}".format(fps.fps())) # do a bit of cleanup cv2.destroyAllWindows()