Skip to content

Commit 804e085

Browse files
committed
Add covariance visualization
1 parent a28abbd commit 804e085

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

fastmot/mot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def step(self, frame):
117117
self.frame_count += 1
118118

119119
def _draw(self, frame, detections):
120-
draw_tracks(frame, self.visible_tracks, draw_flow=self.verbose)
120+
draw_tracks(frame, self.visible_tracks, show_flow=self.verbose)
121121
if self.verbose:
122122
draw_detections(frame, detections)
123123
draw_flow_bboxes(frame, self.tracker)

fastmot/utils/visualization.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
GOLDEN_RATIO = 0.618033988749895
77

88

9-
def draw_tracks(frame, tracks, draw_flow=False):
9+
def draw_tracks(frame, tracks, show_flow=False, show_cov=False):
1010
for track in tracks:
1111
draw_bbox(frame, track.tlbr, get_color(track.trk_id), 2, str(track.trk_id))
12-
if draw_flow:
12+
if show_flow:
1313
draw_feature_match(frame, track.prev_keypoints, track.keypoints, (0, 255, 255))
14+
if show_cov:
15+
draw_covariance(frame, track.tlbr, track.state[1])
1416

1517

1618
def draw_detections(frame, detections):
@@ -79,6 +81,6 @@ def ellipse(cov):
7981
return axes, angle
8082

8183
axes, angle = ellipse(covariance[:2, :2])
82-
cv2.ellipse(frame, tl, axes, angle, 0, 360, (255, 255, 255), 1)
84+
cv2.ellipse(frame, tl, axes, angle, 0, 360, (255, 255, 255), 1, cv2.LINE_AA)
8385
axes, angle = ellipse(covariance[2:4, 2:4])
84-
cv2.ellipse(frame, br, axes, angle, 0, 360, (255, 255, 255), 1)
86+
cv2.ellipse(frame, br, axes, angle, 0, 360, (255, 255, 255), 1, cv2.LINE_AA)

0 commit comments

Comments
 (0)