Commit 5c464257 authored by cb's avatar cb

Added the option not to start a new thread for picking up names

parent bce6bf52
......@@ -45,7 +45,7 @@ def calculateAverageSuspicious(faceSuspicion):
averageSuspicious = sum(faceSuspicion)/currentFaces
print(f"Average suspicion: {averageSuspicious}")
def detectAndTrackMultipleFaces():
def detectAndTrackMultipleFaces(start_thread):
#Open the first webcame device
capture = cv2.VideoCapture(0)
......@@ -225,14 +225,20 @@ def detectAndTrackMultipleFaces():
faceTrackers[ currentFaceID ] = tracker
calculateAverageSuspicious(faceSuspicion)
# Pick up random name: Do we want a thread for that?
# Advantage is that we can pop an "Identifying..." Message
if start_thread :
#Start a new thread that is used to simulate face recognition.
t = threading.Thread( target = doRecognizePerson ,
args=(faceNames, currentFaceID))
t.start()
else:
# Directly add name
faceNames[ currentFaceID ] = randomnames.rand_name() #"Person " + str(fid)
#Start a new thread that is used to simulate
#face recognition. This is not yet implemented in this
#version :)
t = threading.Thread( target = doRecognizePerson ,
args=(faceNames, currentFaceID))
t.start()
calculateAverageSuspicious(faceSuspicion)
#Increase the currentFaceID counter
currentFaceID += 1
......@@ -285,10 +291,6 @@ def detectAndTrackMultipleFaces():
0.5, (255, 255, 255), 1, cv2.LINE_AA)
#Since we want to show something larger on the screen than the
#original 320x240, we resize the image again
#
......@@ -317,4 +319,6 @@ def detectAndTrackMultipleFaces():
if __name__ == '__main__':
detectAndTrackMultipleFaces()
detectAndTrackMultipleFaces(
start_thread=False # False: Names are directly printed on screen, no new thread
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment