visumorph.rotate

Module Contents

Functions

rotate(image, rotation[, background])

Rotate an image with a given rotation.

visumorph.rotate.rotate(image, rotation, background=None)[source]

Rotate an image with a given rotation.

This function will rotate a VisuMorph image by a given degree of rotation. A background image can be specified for filling any empty spaces which are not covered by the image after rotation.

Parameters:
  • image (visumorph.Image) – The original image to be rotated.

  • rotation (float) – The desired rotation angle in degrees. +ve means clockwise while -ve means counter-clockwise.

  • background (visumorph.Image, optional) – The background image to be filled in where the rotated image is not covered. Default is None, which a black background image would be used.

Returns:

The VisuMorph Image after rotation.

Return type:

image

Raises:

TypeError – If the image is not a valid VisuMorph Image and/or rotation given is not a number.

Examples

>>> import visumorph as vm
>>> img = vm.load_image("test.jpg")
>>> rotated_45_img = vm.rotate(img, 45.0)