pyufunc.img_rotate#

pyufunc.img_rotate(img, angle, center=None, scale=1.0, verbose=True)#

Rotate image with a given angle at a given center.

Parameters:
  • img (Union[np.ndarray, str, Image.Image]) – image array or image path or PIL image object

  • angle (float) – rotate angle, unit: degree

  • center (tuple[int, int], optional) – rotate center [width, height], default is None, center is the center of image, unit: pixel

  • scale (float, optional) – scale factor, default is 1.0

  • verbose (bool, optional) – print out processing message, default is True

Returns:

the rotated image

Return type:

np.ndarray

Example

>>> import cv2
>>> from pyufunc import img_rotate
>>> img = cv2.imread('test.jpg')
>>> img_r = img_rotate(img, 45)
>>> cv2.imshow('rotated image', img_r)
>>> cv2.waitKey(0)
>>> cv2.destroyAllWindows()