| 115 | |
| 116 | |
| 117 | def img2video(video_path, output_dir): |
| 118 | cap = cv2.VideoCapture(video_path) |
| 119 | fps = int(cap.get(cv2.CAP_PROP_FPS)) |
| 120 | |
| 121 | fourcc = cv2.VideoWriter_fourcc(*"mp4v") |
| 122 | |
| 123 | names = sorted(glob.glob(os.path.join(output_dir + 'pose/', '*.png'))) |
| 124 | img = cv2.imread(names[0]) |
| 125 | size = (img.shape[1], img.shape[0]) |
| 126 | |
| 127 | videoWrite = cv2.VideoWriter(output_dir + video_name + '.mp4', fourcc, fps, size) |
| 128 | |
| 129 | for name in names: |
| 130 | img = cv2.imread(name) |
| 131 | videoWrite.write(img) |
| 132 | |
| 133 | videoWrite.release() |
| 134 | |
| 135 | |
| 136 | def showimage(ax, img): |