Update visualizer.py
Browse files- visualizer.py +40 -31
visualizer.py
CHANGED
@@ -269,37 +269,46 @@ class Visualizer:
|
|
269 |
for t in range(T):
|
270 |
img = Image.fromarray(np.uint8(res_video[t]))
|
271 |
for i in range(N):
|
272 |
-
coord = (tracks[t, i, 0], tracks[t, i, 1])
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
if
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
res_video[t] = np.array(img)
|
304 |
|
305 |
# construct the final rgb sequence
|
|
|
269 |
for t in range(T):
|
270 |
img = Image.fromarray(np.uint8(res_video[t]))
|
271 |
for i in range(N):
|
272 |
+
coord = (round(tracks[t, i, 0]), round(tracks[t, i, 1]))
|
273 |
+
visibile = True
|
274 |
+
if visibility is not None:
|
275 |
+
visibile = visibility[0, t, i]
|
276 |
+
if coord[0] != 0 and coord[1] != 0:
|
277 |
+
if not compensate_for_camera_motion or (
|
278 |
+
compensate_for_camera_motion and segm_mask[i] > 0
|
279 |
+
):
|
280 |
+
# img = draw_circle(
|
281 |
+
# img,
|
282 |
+
# coord=coord,
|
283 |
+
# radius=int(self.linewidth * 2),
|
284 |
+
# color=vector_colors[t, i].astype(int),
|
285 |
+
# visible=visibile,
|
286 |
+
# color_alpha=color_alpha,
|
287 |
+
# )
|
288 |
+
|
289 |
+
# coord_ = coord[t,i]
|
290 |
+
# draw a red cross
|
291 |
+
# if gt_tracks[0] > 0 and gt_tracks[1] > 0:
|
292 |
+
if visibile:
|
293 |
+
length = self.linewidth * 3
|
294 |
+
coord_y = ((coord[0]) + length, (coord[1]) + length)
|
295 |
+
coord_x = ((coord[0]) - length, (coord[1]) - length)
|
296 |
+
rgb = draw_line(
|
297 |
+
img,
|
298 |
+
coord_y,
|
299 |
+
coord_x,
|
300 |
+
vector_colors[t, i].astype(int),
|
301 |
+
self.linewidth,
|
302 |
+
)
|
303 |
+
coord_y = ((coord[0]) - length, (coord[1]) + length)
|
304 |
+
coord_x = ((coord[0]) + length, (coord[1]) - length)
|
305 |
+
rgb = draw_line(
|
306 |
+
img,
|
307 |
+
coord_y,
|
308 |
+
coord_x,
|
309 |
+
vector_colors[t, i].astype(int),
|
310 |
+
self.linewidth,
|
311 |
+
)
|
312 |
res_video[t] = np.array(img)
|
313 |
|
314 |
# construct the final rgb sequence
|