fix: compatible with opencv under version 4.4.0

pull/1283/head
gaotingquan 2021-09-26 04:45:12 +00:00 committed by Tingquan Gao
parent de65a13e53
commit de859b4a3d
2 changed files with 6 additions and 0 deletions

View File

@ -78,6 +78,9 @@ class UnifiedResize(object):
if backend.lower() == "cv2":
if isinstance(interpolation, str):
interpolation = _cv2_interp_from_str[interpolation.lower()]
# compatible with opencv < version 4.4.0
elif not interpolation:
interpolation = cv2.INTER_LINEAR
self.resize_func = partial(cv2.resize, interpolation=interpolation)
elif backend.lower() == "pil":
if isinstance(interpolation, str):

View File

@ -59,6 +59,9 @@ class UnifiedResize(object):
if backend.lower() == "cv2":
if isinstance(interpolation, str):
interpolation = _cv2_interp_from_str[interpolation.lower()]
# compatible with opencv < version 4.4.0
elif not interpolation:
interpolation = cv2.INTER_LINEAR
self.resize_func = partial(cv2.resize, interpolation=interpolation)
elif backend.lower() == "pil":
if isinstance(interpolation, str):