-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #462 from aleju/grayscale_some_colors
Add augmenters for colorwise grayscaling
- Loading branch information
Showing
6 changed files
with
1,024 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Colorwise Grayscaling #462 | ||
|
||
* Added `RemoveSaturation`, a shortcut for `MultiplySaturation((0.0, 1.0))` | ||
with outputs similar to `Grayscale((0.0, 1.0))`. | ||
* Added `GrayscaleColorwise`, which applies grayscaling to randomly | ||
picked colors in the image. | ||
* Added `RemoveSaturationColorwise`, which applies color saturation removal | ||
to randomy picked colors in the image. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import imgaug as ia | ||
import imgaug.augmenters as iaa | ||
import imageio | ||
|
||
|
||
def main(): | ||
urls = [ | ||
("https://upload.wikimedia.org/wikipedia/commons/thumb/4/43/" | ||
"Sarcophilus_harrisii_taranna.jpg/" | ||
"320px-Sarcophilus_harrisii_taranna.jpg"), | ||
("https://upload.wikimedia.org/wikipedia/commons/thumb/b/ba/" | ||
"Vincent_van_Gogh_-_Wheatfield_with_crows_-_Google_Art_Project.jpg/" | ||
"320px-Vincent_van_Gogh_-_Wheatfield_with_crows_-_Google_Art_Project" | ||
".jpg"), | ||
("https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/" | ||
"Galerella_sanguinea_Zoo_Praha_2011-2.jpg/207px-Galerella_sanguinea_" | ||
"Zoo_Praha_2011-2.jpg"), | ||
("https://upload.wikimedia.org/wikipedia/commons/thumb/9/96/" | ||
"Ambrosius_Bosschaert_the_Elder_%28Dutch_-_Flower_Still_Life_-_" | ||
"Google_Art_Project.jpg/307px-Ambrosius_Bosschaert_the_Elder_%28" | ||
"Dutch_-_Flower_Still_Life_-_Google_Art_Project.jpg") | ||
] | ||
|
||
image = imageio.imread(urls[1]) | ||
|
||
aug = iaa.GrayscaleColorwise(10, 0.1, alpha=[0.0, 1.0]) | ||
images_aug = aug(images=[image] * (5*5)) | ||
|
||
ia.imshow(ia.draw_grid(images_aug)) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import imgaug as ia | ||
import imgaug.augmenters as iaa | ||
import imageio | ||
|
||
|
||
def main(): | ||
urls = [ | ||
("https://upload.wikimedia.org/wikipedia/commons/thumb/4/43/" | ||
"Sarcophilus_harrisii_taranna.jpg/" | ||
"320px-Sarcophilus_harrisii_taranna.jpg"), | ||
("https://upload.wikimedia.org/wikipedia/commons/thumb/b/ba/" | ||
"Vincent_van_Gogh_-_Wheatfield_with_crows_-_Google_Art_Project.jpg/" | ||
"320px-Vincent_van_Gogh_-_Wheatfield_with_crows_-_Google_Art_Project" | ||
".jpg"), | ||
("https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/" | ||
"Galerella_sanguinea_Zoo_Praha_2011-2.jpg/207px-Galerella_sanguinea_" | ||
"Zoo_Praha_2011-2.jpg"), | ||
("https://upload.wikimedia.org/wikipedia/commons/thumb/9/96/" | ||
"Ambrosius_Bosschaert_the_Elder_%28Dutch_-_Flower_Still_Life_-_" | ||
"Google_Art_Project.jpg/307px-Ambrosius_Bosschaert_the_Elder_%28" | ||
"Dutch_-_Flower_Still_Life_-_Google_Art_Project.jpg") | ||
] | ||
|
||
image = imageio.imread(urls[3]) | ||
|
||
aug = iaa.RemoveSaturation() | ||
images_aug = aug(images=[image] * (5*5)) | ||
|
||
ia.imshow(ia.draw_grid(images_aug)) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import imgaug as ia | ||
import imgaug.augmenters as iaa | ||
import imageio | ||
|
||
|
||
def main(): | ||
urls = [ | ||
("https://upload.wikimedia.org/wikipedia/commons/thumb/4/43/" | ||
"Sarcophilus_harrisii_taranna.jpg/" | ||
"320px-Sarcophilus_harrisii_taranna.jpg"), | ||
("https://upload.wikimedia.org/wikipedia/commons/thumb/b/ba/" | ||
"Vincent_van_Gogh_-_Wheatfield_with_crows_-_Google_Art_Project.jpg/" | ||
"320px-Vincent_van_Gogh_-_Wheatfield_with_crows_-_Google_Art_Project" | ||
".jpg"), | ||
("https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/" | ||
"Galerella_sanguinea_Zoo_Praha_2011-2.jpg/207px-Galerella_sanguinea_" | ||
"Zoo_Praha_2011-2.jpg"), | ||
("https://upload.wikimedia.org/wikipedia/commons/thumb/9/96/" | ||
"Ambrosius_Bosschaert_the_Elder_%28Dutch_-_Flower_Still_Life_-_" | ||
"Google_Art_Project.jpg/307px-Ambrosius_Bosschaert_the_Elder_%28" | ||
"Dutch_-_Flower_Still_Life_-_Google_Art_Project.jpg") | ||
] | ||
|
||
image = imageio.imread(urls[1]) | ||
|
||
aug = iaa.RemoveSaturationColorwise(10, 0.1, alpha=[0.0, 1.0]) | ||
images_aug = aug(images=[image] * (5*5)) | ||
|
||
ia.imshow(ia.draw_grid(images_aug)) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.