Skip to content

Commit 85dc3d5

Browse files
committed
Check if image exists in read_plate_image
1 parent 64b110a commit 85dc3d5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fast_plate_ocr/inference/process.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Utility functions for processing model input/output.
33
"""
44

5+
import os
6+
57
import cv2
68
import numpy as np
79
import numpy.typing as npt
@@ -14,6 +16,8 @@ def read_plate_image(image_path: str) -> npt.NDArray:
1416
:param str image_path: The path to the license plate image.
1517
:return: The image as a NumPy array.
1618
"""
19+
if os.path.exists(image_path):
20+
raise ValueError(f"{image_path} file doesn't exist!")
1721
return cv2.imread(image_path, cv2.IMREAD_GRAYSCALE)
1822

1923

0 commit comments

Comments
 (0)