| 123456789101112131415161718 |
- 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.full((height, width, 3), 255, dtype=np.uint8)
- 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)
|