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"])
95 self.viewer.thickness = 2
99 def run(self, frame_callback):
100 self.viewer.run(
lambda: self.
_update_fun(frame_callback))
110 self.viewer.image = image
113 self.viewer.thickness = 2
114 for track_id, box
in zip(track_ids, boxes):
116 self.viewer.rectangle(*box.astype(np.int), label=str(track_id))
119 self.viewer.thickness = 2
120 self.viewer.color = 0, 0, 255
121 for i, detection
in enumerate(detections):
122 self.viewer.rectangle(*detection.tlwh)
125 self.viewer.thickness = 2
127 if not track.is_confirmed()
or track.time_since_update > 0:
130 self.viewer.rectangle(
131 *track.to_tlwh().astype(np.int), label=str(track.track_id))
def __init__(self, seq_info)
def __init__(self, seq_info, update_ms)
def create_unique_color_uchar(tag, hue_step=0.41)
def run(self, frame_callback)
def draw_trackers(self, tracks)
def draw_trackers(self, trackers)
def draw_groundtruth(self, track_ids, boxes)
def create_unique_color_float(tag, hue_step=0.41)
def draw_groundtruth(self, track_ids, boxes)
def draw_detections(self, detections)
def set_image(self, image)
def set_image(self, image)
def run(self, frame_callback)
def _update_fun(self, frame_callback)
def draw_detections(self, detections)