Commit faf9deff authored by Dilitha A.G.A.D.'s avatar Dilitha A.G.A.D.

implement live and overall persons counter

parent aaa4ba43
...@@ -67,6 +67,9 @@ def main(): ...@@ -67,6 +67,9 @@ def main():
fps_start_time = datetime.datetime.now() fps_start_time = datetime.datetime.now()
fps = 0 fps = 0
total_frames = 0 total_frames = 0
lpc_count = 0
opc_count = 0
object_id_list = [] object_id_list = []
dtime = dict() dtime = dict()
...@@ -108,6 +111,9 @@ def main(): ...@@ -108,6 +111,9 @@ def main():
x2 = int(x2) x2 = int(x2)
y2 = int(y2) y2 = int(y2)
# if objectId not in object_id_list:
# object_id_list.append(objectId)
if objectId not in object_id_list: if objectId not in object_id_list:
object_id_list.append(objectId) object_id_list.append(objectId)
dtime[objectId] = datetime.datetime.now() dtime[objectId] = datetime.datetime.now()
...@@ -141,6 +147,15 @@ def main(): ...@@ -141,6 +147,15 @@ def main():
cv2.putText(frame, fps_text, (5, 30), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1) cv2.putText(frame, fps_text, (5, 30), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
lpc_count = len(objects)
opc_count = len(object_id_list)
lpc_txt = "LPC: {}".format(lpc_count)
opc_txt = "OPC: {}".format(opc_count)
cv2.putText(frame, lpc_txt, (5, 60), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
cv2.putText(frame, opc_txt, (5, 90), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (0, 0, 255), 1)
cv2.imshow("Application", frame) cv2.imshow("Application", frame)
# print("Detected" + text) # print("Detected" + text)
key = cv2.waitKey(1) key = cv2.waitKey(1)
......
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