Skip to content

Commit

Permalink
Merge pull request #463 from aleju/cartoon
Browse files Browse the repository at this point in the history
Add augmenter Cartoon
  • Loading branch information
aleju authored Nov 5, 2019
2 parents e117cee + ec0300c commit 3c47409
Show file tree
Hide file tree
Showing 5 changed files with 685 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelogs/master/added/20191020_cartoon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# New Augmenter `Cartoon` #463

* Added module `imgaug.augmenters.artistic`.
* Added function `imgaug.augmenters.artistic.stylize_cartoon(image)`.
* Added augmenter `imgaug.augmenters.artistic.Cartoon`.
74 changes: 74 additions & 0 deletions checks/check_cartoon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import imgaug as ia
import imgaug.augmenters as iaa
import imageio
import cv2
import numpy as np


def main():
urls_small = [
"https://upload.wikimedia.org/wikipedia/commons/thumb/0/08/"
"Physicist_Stephen_Hawking_in_Zero_Gravity_NASA.jpg/"
"320px-Physicist_Stephen_Hawking_in_Zero_Gravity_NASA.jpg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/5/5d/"
"Barack_Obama_family_portrait_2011.jpg/320px-Barack_Obama_"
"family_portrait_2011.jpg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/"
"Pahalgam_Valley.jpg/320px-Pahalgam_Valley.jpg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/a/a4/"
"Iglesia_de_Nuestra_Se%C3%B1ora_de_La_Blanca%2C_Cardej%C3%B3n%2C_"
"Espa%C3%B1a%2C_2012-09-01%2C_DD_02.JPG/320px-Iglesia_de_Nuestra_"
"Se%C3%B1ora_de_La_Blanca%2C_Cardej%C3%B3n%2C_Espa%C3%B1a%2C_"
"2012-09-01%2C_DD_02.JPG",
"https://upload.wikimedia.org/wikipedia/commons/thumb/9/94/"
"Salad_platter.jpg/320px-Salad_platter.jpg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/1/1c/"
"Squirrel_posing.jpg/287px-Squirrel_posing.jpg"
]
urls_medium = [
"https://upload.wikimedia.org/wikipedia/commons/thumb/0/08/"
"Physicist_Stephen_Hawking_in_Zero_Gravity_NASA.jpg/"
"640px-Physicist_Stephen_Hawking_in_Zero_Gravity_NASA.jpg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/5/5d/"
"Barack_Obama_family_portrait_2011.jpg/640px-Barack_Obama_"
"family_portrait_2011.jpg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/"
"Pahalgam_Valley.jpg/640px-Pahalgam_Valley.jpg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/a/a4/"
"Iglesia_de_Nuestra_Se%C3%B1ora_de_La_Blanca%2C_Cardej%C3%B3n%2C_"
"Espa%C3%B1a%2C_2012-09-01%2C_DD_02.JPG/640px-Iglesia_de_Nuestra_"
"Se%C3%B1ora_de_La_Blanca%2C_Cardej%C3%B3n%2C_Espa%C3%B1a%2C_"
"2012-09-01%2C_DD_02.JPG",
"https://upload.wikimedia.org/wikipedia/commons/thumb/9/94/"
"Salad_platter.jpg/640px-Salad_platter.jpg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/1/1c/"
"Squirrel_posing.jpg/574px-Squirrel_posing.jpg"
]
urls_large = [
"https://upload.wikimedia.org/wikipedia/commons/thumb/0/08/"
"Physicist_Stephen_Hawking_in_Zero_Gravity_NASA.jpg/"
"https://upload.wikimedia.org/wikipedia/commons/thumb/5/5d/"
"Barack_Obama_family_portrait_2011.jpg/1024px-Barack_Obama_"
"family_portrait_2011.jpg",
"1024px-Physicist_Stephen_Hawking_in_Zero_Gravity_NASA.jpg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/f/f6/"
"Pahalgam_Valley.jpg/1024px-Pahalgam_Valley.jpg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/a/a4/"
"Iglesia_de_Nuestra_Se%C3%B1ora_de_La_Blanca%2C_Cardej%C3%B3n%2C_"
"Espa%C3%B1a%2C_2012-09-01%2C_DD_02.JPG/1024px-Iglesia_de_"
"Nuestra_Se%C3%B1ora_de_La_Blanca%2C_Cardej%C3%B3n%2C_"
"Espa%C3%B1a%2C_2012-09-01%2C_DD_02.JPG",
"https://upload.wikimedia.org/wikipedia/commons/thumb/9/94/"
"Salad_platter.jpg/1024px-Salad_platter.jpg",
"https://upload.wikimedia.org/wikipedia/commons/thumb/1/1c/"
"Squirrel_posing.jpg/574px-Squirrel_posing.jpg"
]

image = imageio.imread(urls_medium[1])

augs = [image] + iaa.Cartoon()(images=[image] * 15)
ia.imshow(ia.draw_grid(augs, 4, 4))


if __name__ == "__main__":
main()
1 change: 1 addition & 0 deletions imgaug/augmenters/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import absolute_import
from imgaug.augmenters.arithmetic import *
from imgaug.augmenters.artistic import *
from imgaug.augmenters.blend import *
from imgaug.augmenters.blur import *
from imgaug.augmenters.color import *
Expand Down
Loading

0 comments on commit 3c47409

Please sign in to comment.