From 5af7cf3ee8e585745595549d66ea1b76ca24d6db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laure=CE=B7t?= Date: Fri, 13 Jan 2023 11:28:38 +0100 Subject: [PATCH] feat: interpolation --- src/bodyparts/head.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bodyparts/head.py b/src/bodyparts/head.py index fb379d4..ba38cf7 100644 --- a/src/bodyparts/head.py +++ b/src/bodyparts/head.py @@ -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)