4 from .image_viewer
import ImageViewer
8 """Create a unique RGB color code for a given track id (tag).
10 The color code is generated in HSV color space by moving along the
11 hue angle and gradually changing the saturation.
16 The unique target identifying tag.
18 Difference between two neighboring color codes in HSV space (more
19 specifically, the distance in hue channel).
24 RGB color code in range [0, 1]
27 h, v = (tag * hue_step) % 1, 1. - (
int(tag * hue_step) % 4) / 5.
28 r, g, b = colorsys.hsv_to_rgb(h, 1., v)
33 """Create a unique RGB color code for a given track id (tag).
35 The color code is generated in HSV color space by moving along the
36 hue angle and gradually changing the saturation.
41 The unique target identifying tag.
43 Difference between two neighboring color codes in HSV space (more
44 specifically, the distance in hue channel).
49 RGB color code in range [0, 255]
58 A dummy visualization object that loops through all frames in a given
59 sequence to update the tracker without performing any visualization.
78 def run(self, frame_callback):
79 while self.frame_idx <= self.last_idx:
80 frame_callback(self, self.frame_idx)
86 This class shows tracking output in an OpenCV image viewer.
90 image_shape = seq_info[
"image_size"][::-1]
91 aspect_ratio =
float(image_shape[1]) / image_shape[0]
92 image_shape = 1024,
int(aspect_ratio * 1024)
94 update_ms, image_shape,
"Figure %s" % seq_info[
"sequence_name"])
99 def run(self, frame_callback):
114 for track_id, box
in zip(track_ids, boxes):
116 self.
viewer.rectangle(*box.astype(np.int), label=
str(track_id))
120 self.
viewer.color = 0, 0, 255
121 for i, detection
in enumerate(detections):
122 self.
viewer.rectangle(*detection.tlwh)
127 if not track.is_confirmed()
or track.time_since_update > 0:
131 *track.to_tlwh().astype(np.int), label=
str(track.track_id))