Unverified Commit d7c895a3 authored by Hongkai Zhang's avatar Hongkai Zhang Committed by GitHub
Browse files

support multiple interpolation modes for imrotate (#545)

* support multiple interpolation modes for imrotate

* reformat code
parent c8435966
......@@ -227,6 +227,7 @@ def imrotate(img,
center=None,
scale=1.0,
border_value=0,
interpolation='bilinear',
auto_bound=False):
"""Rotate an image.
......@@ -239,6 +240,7 @@ def imrotate(img,
used.
scale (float): Isotropic scale factor.
border_value (int): Border value.
interpolation (str): Same as :func:`resize`.
auto_bound (bool): Whether to adjust the image size to cover the whole
rotated image.
......@@ -262,7 +264,11 @@ def imrotate(img,
matrix[1, 2] += (new_h - h) * 0.5
w = int(np.round(new_w))
h = int(np.round(new_h))
rotated = cv2.warpAffine(img, matrix, (w, h), borderValue=border_value)
rotated = cv2.warpAffine(
img,
matrix, (w, h),
flags=cv2_interp_codes[interpolation],
borderValue=border_value)
return rotated
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment