variable init position bug fix
Browse files
app.py
CHANGED
@@ -162,19 +162,21 @@ def track_and_mask(vid, masked_frame, original_list, mask_list, in_fps, dt_strin
|
|
162 |
# init tracker
|
163 |
state = siamese_init(
|
164 |
frame, target_pos, target_sz, siammask, cfg['hp'], device=device)
|
|
|
|
|
|
|
165 |
else:
|
166 |
# track
|
167 |
state = siamese_track(
|
168 |
state, frame, mask_enable=True, refine_enable=True, device=device)
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
mask_list.append(mask)
|
178 |
|
179 |
video_writer.write(frame)
|
180 |
f = f + 1
|
|
|
162 |
# init tracker
|
163 |
state = siamese_init(
|
164 |
frame, target_pos, target_sz, siammask, cfg['hp'], device=device)
|
165 |
+
original_list.append(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
|
166 |
+
frame[:, :, 2] = (mask > 0) * 255 + \
|
167 |
+
(mask == 0) * frame[:, :, 2]
|
168 |
else:
|
169 |
# track
|
170 |
state = siamese_track(
|
171 |
state, frame, mask_enable=True, refine_enable=True, device=device)
|
172 |
+
original_list.append(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
|
173 |
+
mask = state['mask'] > state['p'].seg_thr
|
174 |
+
frame[:, :, 2] = (mask > 0) * 255 + \
|
175 |
+
(mask == 0) * frame[:, :, 2]
|
176 |
+
|
177 |
+
mask = mask.astype(np.uint8) # convert to an unsigned byte
|
178 |
+
mask = mask * 255
|
179 |
+
mask_list.append(mask)
|
|
|
180 |
|
181 |
video_writer.write(frame)
|
182 |
f = f + 1
|