pyufunc.img_translate#

pyufunc.img_translate(img, dx, dy, verbose=True)#

Translate image with a given distance in x-axis and y-axis.

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

  • dx (float) – translate distance in x-axis, unit: pixel

  • dy (float) – translate distance in y-axis, unit: pixel

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

Returns:

the translated image

Return type:

np.ndarray

Example

>>> import cv2
>>> from pyufunc import img_translate
>>> img = cv2.imread('test.jpg')
>>> img_t = img_translate(img, 100, 100)
>>> cv2.imshow('translated image', img_t)
>>> cv2.waitKey(0)
>>> cv2.destroyAllWindows()