test02.py 264 B

12345678910111213141516
  1. import cv2
  2. import numpy as np
  3. from pathlib import Path
  4. import os
  5. img: np.ndarray = cv2.imread(r"")
  6. print(img.shape)
  7. path = "./a/b/33.jpg"
  8. path_obj = Path(path)
  9. path_obj.parent.mkdir(parents=True, exist_ok=True)
  10. success = cv2.imwrite(path, img)
  11. print(success)