I'm working on an object tracking and counting project but I want the counter to start counting from 0 each 10 seconds but when I tried to create a counting thread it just doesn't work and the counting would show 0 the whole video. Here is the code:
def countdown(): global timer
timer = 10
for z in range(10):
timer = timer - 1
sleep (1)
if timer == 0:
count = 0
countdown_thread = threading.Thread(target = countdown)
countdown_thread.start()
def count_obj(box,w,h,id): global count,data #ADDEDD while timer > 0: center_coordinates = (int(box[0]+(box[2]-box[0])/2) , int(box[1]+(box[3]-box[1])/2)) if int(box[1]+(box[3]-box[1])/2) > (h -200): if id not in data:
count += 1
data.append(id)
count = 0