Easy option to save all augmented Images
LEGoebel opened this issue · 1 comments
LEGoebel commented
Hello,
I am pretty new to python programming. I played aroung with the toolbox and it works fine. Now I want to save the augmented images with a different name after augmenting them with am.augment_random.
Is there an easy way to do that? Because I could call the loader with the specific image, augment it, save it and loop through all images in the folder. But that is probably not the easiest way, is it? Furthermore I encounter the problem, that I "lose" the name of the image. I would like to save it like image_aug.
Thank you very much in advance.
pullmyleg commented
Incase someone else comes across this and is still looking.
import Automold as am
import Helpers as hp
import math
import cv2 as cv2
import glob
path = './test_augmentation/*.jpg'
#Loader adapted with no resize, Image 3 in repo will not work without resize.
image_list = []
images = glob.glob(path)
for index in range(len(images)):
print(images[index])
image= cv2.cvtColor(cv2.imread(images[index]),1)
#image_list.append(cv2.resize(image,(1280,720)))
image_list.append(image)
# Apply flare or other augmentation
flare_image= am.add_sun_flare(image)
# Uncomment to show image
#cv2.imshow(images[index], flare_images)
#cv2.waitKey(0)
# Save image
cv2.imwrite(images[index].replace('.jpg', '_sunflare.jpg'),flare_image)