This commit is contained in:
hzwer
2020-11-23 11:41:08 +08:00
parent 0c003b98b4
commit b826c65b98
2 changed files with 4 additions and 4 deletions

View File

@@ -52,7 +52,7 @@ else:
video_path_wo_ext, ext = os.path.splitext(args.video)
vid_out = cv2.VideoWriter('{}_{}X_{}fps.{}'.format(video_path_wo_ext, args.exp, int(np.round(args.fps)), args.ext), fourcc, args.fps, (w, h))
def clear_buffer(user_args):
def clear_buffer(user_args, buffer):
cnt = 0
while True:
try:
@@ -77,7 +77,7 @@ skip_frame = 1
if args.montage:
lastframe = lastframe[:, left: left + w]
buffer = Queue()
_thread.start_new_thread(clear_buffer, (args, ))
_thread.start_new_thread(clear_buffer, (args, buffer))
for frame in videogen:
if args.montage:
frame = frame[:, left: left + w]

View File

@@ -79,7 +79,7 @@ def write_frame(i0, infs, i1, p, user_args):
for inf in infs:
buffer.put(inf[i])
def clear_buffer(user_args):
def clear_buffer(user_args, buffer):
global cnt
while True:
try:
@@ -107,7 +107,7 @@ padding = (0, pw - w, 0, ph - h)
print('{}.{}, {} frames in total, {}FPS to {}FPS'.format(video_path_wo_ext, args.ext, tot_frame, fps, args.fps))
pbar = tqdm(total=tot_frame)
img_list = []
_thread.start_new_thread(clear_buffer, (args, ))
_thread.start_new_thread(clear_buffer, (args, buffer))
tot_frame -= 1
for frame in videogen:
tot_frame -= 1