Sync signature of cv2.imread and cv2.imwrite (#11209)

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Grzegorz K 2023-03-23 20:34:03 +01:00 committed by GitHub
parent 81f81d3e97
commit f095258e0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1119,13 +1119,13 @@ def increment_path(path, exist_ok=False, sep='', mkdir=False):
imshow_ = cv2.imshow # copy to avoid recursion errors
def imread(path, flags=cv2.IMREAD_COLOR):
return cv2.imdecode(np.fromfile(path, np.uint8), flags)
def imread(filename, flags=cv2.IMREAD_COLOR):
return cv2.imdecode(np.fromfile(filename, np.uint8), flags)
def imwrite(path, im):
def imwrite(filename, img):
try:
cv2.imencode(Path(path).suffix, im)[1].tofile(path)
cv2.imencode(Path(filename).suffix, img)[1].tofile(filename)
return True
except Exception:
return False