Skip to content

Commit

Permalink
Sync signature of cv2.imread and cv2.imwrite (#11209)
Browse files Browse the repository at this point in the history
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
  • Loading branch information
grzegorzk and glenn-jocher committed Mar 23, 2023
1 parent 81f81d3 commit f095258
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f095258

Please sign in to comment.