pyufunc.img_rotate_bound#

pyufunc.img_rotate_bound(img, angle, verbose=True)#

Rotate image with a given angle, and keep the whole image in the frame.

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

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

  • verbose (bool, optional) – if true, print out processing message. Defaults to True.

Returns:

the rotated image

Return type:

np.ndarray

Example

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