How create desired number of images in the folder
12 views (last 30 days)
Elysi Cochin on 4 Jan 2021
How to augment a folder of images?
Suppose i have 7 images in a folder, i wanted to augment these 7 images and create a total of 20 images in the folder (that means 13 new images)
I tried the below code for 1 image
In = imread('peppers.png');
Aug = imageDataAugmenter('RandXReflection',true);
Out = augment(Aug,In);
How to augment, so that i can create desired number of images in the folder
Constantino Carlos Reyes-Aldasoro on 4 Jan 2021
First of all, if you have folders you better define these:
baseDir = pwd;
that is the base folder or directory, then define the files you have in that folder, if these are png you can just read those:
>> dir0 = dir ('*.png')
11×1 struct array with fields:
Now you have all the files in that folder and you do not need to write them one by one, e.g.
Then you do the augmentation and then save the images to the folder, create a new filename for your output and print to save in the folder where you are working:
Hope that helps. If it does, please accept the answer, if it not, let me know.