Release cv2 capture

This commit is contained in:
hzwer
2020-11-23 11:36:18 +08:00
parent d57665025f
commit 0c003b98b4

View File

@@ -37,6 +37,7 @@ model.device()
videoCapture = cv2.VideoCapture(args.video)
fps = np.round(videoCapture.get(cv2.CAP_PROP_FPS))
tot_frame = videoCapture.get(cv2.CAP_PROP_FRAME_COUNT)
videoCapture.release()
videogen = skvideo.io.vreader(args.video)
frame = next(videogen)
@@ -103,7 +104,6 @@ def make_inference(model, I0, I1, exp):
ph = ((h - 1) // 32 + 1) * 32
pw = ((w - 1) // 32 + 1) * 32
padding = (0, pw - w, 0, ph - h)
tot_frame = videoCapture.get(cv2.CAP_PROP_FRAME_COUNT)
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 = []