# Revision history [back]

it's quite a puzzle here, but what happens:

• you draw something into your frame
• then you assign it to last_frame
• in the next round, you absdiff last_frame(with the drawing in it) to frame, so this already has your previous drawing in it !

remedy: you need to copy to last_frame before you draw into it, also, it needs a "deep copy", not just an assignment:

 binary = cv2.absdiff(last_frame, frame)
binary = cv2.cvtColor(binary, cv2.COLOR_BGR2GRAY)
ret, binary = cv2.threshold(binary,50,255,cv2.THRESH_BINARY)

last_frame = frame.copy()

# now draw into your frame, as you like !


it's quite a puzzle here, but what happens:

• you draw something into your frame
• then you assign it to last_framelast_frame (unfortunately, with the drawing in it)
• in the next round, you absdiff last_frame(with the drawing in it) last_frame to frame, so this already has your previous drawing in it !

remedy: you need to copy to last_frame before you draw into it, also, it needs a "deep copy", not just an assignment:

 binary = cv2.absdiff(last_frame, frame)
binary = cv2.cvtColor(binary, cv2.COLOR_BGR2GRAY)
ret, binary = cv2.threshold(binary,50,255,cv2.THRESH_BINARY)

last_frame = frame.copy()

# now draw into your frame, as you like !