Created
August 8, 2019 16:11
-
-
Save Lexie88rus/ed331d6e15fe1ec34011667e9987b128 to your computer and use it in GitHub Desktop.
Augment image with imgaug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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