machinevisiontoolbox.Image.roll

Image.roll(ru=0, rv=0)

Roll image by row or column

Parameters:
  • ru (int, optional) – roll in the column direction, defaults to 0

  • rv (int, optional) – roll in the row direction, defaults to 0

Returns:

rolled image

Return type:

Image instance

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
>>> img.roll(ru=1).A
array([[3, 1, 2],
       [6, 4, 5],
       [9, 7, 8]], dtype=uint8)
>>> img.roll(ru=-1).A
array([[2, 3, 1],
       [5, 6, 4],
       [8, 9, 7]], dtype=uint8)
>>> img.roll(rv=1).A
array([[7, 8, 9],
       [1, 2, 3],
       [4, 5, 6]], dtype=uint8)
>>> img.roll(ru=1, rv=-1).A
array([[6, 4, 5],
       [9, 7, 8],
       [3, 1, 2]], dtype=uint8)
Seealso:

numpy.roll