MCPcopy Index your code
hub / github.com/DeepLabCut/DeepLabCut / generate_video_from_images

Function generate_video_from_images

examples/utils.py:242–254  ·  view source on GitHub ↗
(image_dir: Path, output_video: Path)

Source from the content-addressed store, hash-verified

240
241
242def 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
257def create_fake_project(path: Path, params: SyntheticProjectParameters) -> None:

Callers 1

create_fake_projectFunction · 0.85

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected