As in the unrefactored code:
for y in range(3):
tempimpg = []
for x in range(len(tempimpg2)):
if tempimpg2[x] <= 30:
tempimpg.append(tempimpg2[x])
elif 30 < tempimpg2[x] < 100:
tempimpg.append(tempimpg2[x]-30)
tempimpg.append(tempimpg2[x]-(tempimpg2[x]-30))
elif 100 <= tempimpg2[x] <= 200:
tempimpg.append(tempimpg2[x]-75)
tempimpg.append(tempimpg2[x]-(tempimpg2[x]-75))
else:
tempimpg.append(tempimpg2[x]-100)
tempimpg.append(tempimpg2[x]-(tempimpg2[x]-100))
tempimpg2 = tempimpg
impg = tempimpg
This was put in place to handle very long sequences, where the background becomes more and more different as the iteration in the group go forward. For example, with a 200 images group, the detected background might be different enough for the 150th images, causing weird results.
It would be nice to test to bypass the Background detection (and use the full foregroundsegmentation code), if impg is > 30, or some other value.
As in the unrefactored code:
This was put in place to handle very long sequences, where the background becomes more and more different as the iteration in the group go forward. For example, with a 200 images group, the detected background might be different enough for the 150th images, causing weird results.
It would be nice to test to bypass the Background detection (and use the full foregroundsegmentation code), if impg is > 30, or some other value.