fix: issue program not running

This commit is contained in:
rendies 2023-01-12 19:49:22 +07:00
parent e75a0b2c06
commit 0d489e22aa

View File

@ -40,7 +40,7 @@ def video_feed():
return Response(generate(), return Response(generate(),
mimetype = "multipart/x-mixed-replace; boundary=frame") mimetype = "multipart/x-mixed-replace; boundary=frame")
def run(args): def PeopleCounter(args):
global outputFrame, lock, people_count global outputFrame, lock, people_count
# construct the argument parse and parse the arguments # construct the argument parse and parse the arguments
# ap = argparse.ArgumentParser() # ap = argparse.ArgumentParser()
@ -328,7 +328,7 @@ def run(args):
# show the output frame # show the output frame
with lock: with lock:
outputFrame = frame.copy() outputFrame = frame.copy()
# cv2.imshow("Real-Time Monitoring/Analysis Window", frame) cv2.imshow("Real-Time Monitoring/Analysis Window", frame)
key = cv2.waitKey(1) & 0xFF key = cv2.waitKey(1) & 0xFF
# if the `q` key was pressed, break from the loop # if the `q` key was pressed, break from the loop
@ -413,7 +413,7 @@ if __name__ == '__main__':
help="# of skip frames between detections") help="# of skip frames between detections")
args = vars(ap.parse_args()) args = vars(ap.parse_args())
# start a thread that will perform motion detection # start a thread that will perform motion detection
t = threading.Thread(target=run, args=(args)) t = threading.Thread(target=PeopleCounter, args=(args))
t.daemon = True t.daemon = True
t.start() t.start()
# start the flask app # start the flask app