| 12345678910111213141516171819 |
- from __future__ import annotations
-
- import tempfile
- from pathlib import Path
-
- import cv2
- import numpy as np
-
-
- def create_test_image(width: int = 400, height: int = 300) -> np.ndarray:
- image = np.zeros((height, width, 3), dtype=np.uint8)
- image[:, :] = (200, 200, 200)
- return image
-
-
- def image_to_path(image: np.ndarray, suffix: str = ".png") -> Path:
- with tempfile.NamedTemporaryFile(suffix=suffix, delete=False) as tmp:
- cv2.imwrite(tmp.name, image)
- return Path(tmp.name)
|