Skip to content
Snippets Groups Projects
Commit f4ad2637 authored by Yash Shah's avatar Yash Shah
Browse files

Minor fix made to facial req

parent 6c1617c7
No related branches found
No related tags found
No related merge requests found
...@@ -30,13 +30,13 @@ white = 1 # The White colored sensor. ...@@ -30,13 +30,13 @@ white = 1 # The White colored sensor.
def temp(): def temp():
try: 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. # The first parameter is the port, the second parameter is the type of sensor.
[temp, humidity] = grovepi.dht(sensor, blue) [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: if math.isnan(temp) is False and math.isnan(humidity) is False:
print("we are here") # print("we are here")
return x return x
else: else:
print("No data.") print("No data.")
......
...@@ -26,7 +26,7 @@ def facial_rec(email): ...@@ -26,7 +26,7 @@ def facial_rec(email):
# Setting up Mail # Setting up Mail
SMTP_USERNAME = "iotg16@outlook.com" # Mail id of the sender SMTP_USERNAME = "iotg16@outlook.com" # Mail id of the sender
SMTP_PASSWORD = "Group16!" # Password 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 SMTP_SERVER = "smtp.office365.com" # Address of the SMTP server
SSL_PORT = 587 SSL_PORT = 587
...@@ -37,9 +37,8 @@ def facial_rec(email): ...@@ -37,9 +37,8 @@ def facial_rec(email):
# load the known faces and embeddings along with OpenCV's Haar # load the known faces and embeddings along with OpenCV's Haar
# cascade for face detection # cascade for face detection
print("Loading the facial recognition technology.") print("[INFO] loading encodings + face detector...")
data = pickle.loads(open(encodingsP, "rb").read()) data = pickle.loads(open(encodingsP, "rb").read())
# initialize the video stream and allow the camera sensor to warm up # initialize the video stream and allow the camera sensor to warm up
# Set the ser to the followng # Set the ser to the followng
...@@ -47,6 +46,7 @@ def facial_rec(email): ...@@ -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 # 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(src=2,framerate=10).start()
vs = VideoStream(usePiCamera=True).start() vs = VideoStream(usePiCamera=True).start()
time.sleep(2.0)
# start the FPS counter # start the FPS counter
fps = FPS().start() fps = FPS().start()
...@@ -94,7 +94,7 @@ def facial_rec(email): ...@@ -94,7 +94,7 @@ def facial_rec(email):
# If someone in your dataset is identified, print their name on the screen # If someone in your dataset is identified, print their name on the screen
if currentname != name: if currentname != name:
currentname = name currentname = name
print(currentname)
# update the list of names # update the list of names
names.append(name) names.append(name)
...@@ -125,7 +125,7 @@ def facial_rec(email): ...@@ -125,7 +125,7 @@ def facial_rec(email):
if out[2] == "6": if out[2] == "6":
print("Shutdown detected") print("Shutdown detected")
exit(0) exit(0)
print("Connected to mail")
# Create the container (outer) email message # Create the container (outer) email message
TO = SMTP_RECIPIENT TO = SMTP_RECIPIENT
...@@ -170,7 +170,8 @@ def facial_rec(email): ...@@ -170,7 +170,8 @@ def facial_rec(email):
# stop the timer and display FPS information # stop the timer and display FPS information
fps.stop() fps.stop()
print("[INFO] elasped time: {:.2f}".format(fps.elapsed()))
print("[INFO] approx. FPS: {:.2f}".format(fps.fps()))
# do a bit of cleanup # do a bit of cleanup
cv2.destroyAllWindows() cv2.destroyAllWindows()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment