(image_dir: Path, output_video: Path)
| 240 | |
| 241 | |
| 242 | def generate_video_from_images(image_dir: Path, output_video: Path) -> None: |
| 243 | images = [p for p in image_dir.iterdir() if p.is_file() and p.suffix == ".png"] |
| 244 | images = sorted(images, key=lambda f: f.stem) |
| 245 | if len(images) == 0: |
| 246 | return |
| 247 | |
| 248 | height, width, channels = cv2.imread(str(images[0])).shape |
| 249 | fourcc = cv2.VideoWriter_fourcc(*"MJPG") |
| 250 | out = cv2.VideoWriter(str(output_video), fourcc, 10, (width, height)) |
| 251 | for img_path in images: |
| 252 | img = cv2.imread(str(img_path)) |
| 253 | out.write(img) |
| 254 | out.release() |
| 255 | |
| 256 | |
| 257 | def create_fake_project(path: Path, params: SyntheticProjectParameters) -> None: |
no test coverage detected