Skip to content

Instantly share code, notes, and snippets.

@Lexie88rus
Created August 8, 2019 16:11
Show Gist options
  • Select an option

  • Save Lexie88rus/ed331d6e15fe1ec34011667e9987b128 to your computer and use it in GitHub Desktop.

Select an option

Save Lexie88rus/ed331d6e15fe1ec34011667e9987b128 to your computer and use it in GitHub Desktop.
Augment image with imgaug
# import imageio to open images
import imageio
# import augmenters from imgaug
from imgaug import augmenters as iaa
# use imageio library to read the image (alternatively you can use OpenCV cv2.imread() function)
image = imageio.imread('image1.jpg')
# initialize the augmenter
rotate = iaa.Affine(rotate=(-25, 25)) # rotate image
# augment image
image_rotated = rotate.augment_images([image])[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment