I'm trying to check the previous 90 values in an array (or upto the start of the array) to determine if a value already exists.
So far my code just checks the previous value:
overt = np.array([])
if frame ==0:
overt = np.append(overt,lachange)
else:
pframe = frame - 1
plachange = overt[pframe]
if lachange ==0:
overt = np.append(overt,lachange)
elif lachange ==1:
if plachange == lachange:
overt = np.append(overt,0)
lachange = 0
else:
overt = np.append(overt,lachange)
The value is 1 if the vehicle has changed lane and 0 if it hasn't but if the value is 1 multiple times in a 3 second period I want only the first one to be recorded and the following values to be 0.