feat: interpolation
This commit is contained in:
parent
6cd40b7d8e
commit
5af7cf3ee8
|
@ -26,6 +26,7 @@ class Head:
|
||||||
],
|
],
|
||||||
dtype=np.float32,
|
dtype=np.float32,
|
||||||
)
|
)
|
||||||
|
self.old_box = np.zeros((4, 1, 2))
|
||||||
|
|
||||||
def draw(self) -> None:
|
def draw(self) -> None:
|
||||||
"""Draw the head on the screen."""
|
"""Draw the head on the screen."""
|
||||||
|
@ -53,6 +54,10 @@ class Head:
|
||||||
self.env.dist_coeff,
|
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)
|
a, b, c, d = box.squeeze().astype(int)
|
||||||
cv2.line(self.env.frame, a, b, (255, 255, 255), 2)
|
cv2.line(self.env.frame, a, b, (255, 255, 255), 2)
|
||||||
cv2.line(self.env.frame, b, c, (255, 255, 255), 2)
|
cv2.line(self.env.frame, b, c, (255, 255, 255), 2)
|
||||||
|
|
Loading…
Reference in a new issue