In the Optical Flow example, the following code is used to unpack points:
for i, (new, old) in enumerate(zip(good_new, good_old)):
a, b = new.ravel()
c, d = old.ravel()
This works fine for calculations. However, if good_new and good_old contain float coordinates, using a and b directly in OpenCV drawing functions (e.g., cv2.line, cv2.circle) may cause a type error, since these functions expect integer pixel coordinates.
Convert the coordinates to integers when using them for visualization:
a, b = new.ravel().astype(int)
c, d = old.ravel().astype(int)