feat: interpolation

This commit is contained in:
Laureηt 2023-01-13 11:28:38 +01:00
parent 6cd40b7d8e
commit 5af7cf3ee8
Signed by: Laurent
SSH key fingerprint: SHA256:kZEpW8cMJ54PDeCvOhzreNr4FSh6R13CMGH/POoO8DI

View file

@ -26,6 +26,7 @@ class Head:
],
dtype=np.float32,
)
self.old_box = np.zeros((4, 1, 2))
def draw(self) -> None:
"""Draw the head on the screen."""
@ -53,6 +54,10 @@ class Head:
self.env.dist_coeff,
)
# interpolation with self.old_box
box = (box + self.old_box) / 2
self.old_box = box
a, b, c, d = box.squeeze().astype(int)
cv2.line(self.env.frame, a, b, (255, 255, 255), 2)
cv2.line(self.env.frame, b, c, (255, 255, 255), 2)