de.edux.augmentation.core.CompositeAugmentationSequence Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lib Show documentation
Show all versions of lib Show documentation
Educational library for machine learning challenges
The newest version!
package de.edux.augmentation.core;
import de.edux.augmentation.io.ImageProcessingManager;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.List;
/** Composite augmentation that applies a sequence of augmentations. */
public class CompositeAugmentationSequence implements AugmentationSequence {
private final List augmentations;
public CompositeAugmentationSequence(List augmentations) {
this.augmentations = augmentations;
}
@Override
public BufferedImage applyTo(BufferedImage image) {
BufferedImage currentImage = image;
for (AbstractAugmentation augmentation : augmentations) {
currentImage = augmentation.apply(currentImage);
}
return currentImage;
}
@Override
public AugmentationSequence run(String directoryPath, int numberOfWorkers, String outputPath)
throws IOException, InterruptedException {
ImageProcessingManager manager =
new ImageProcessingManager(directoryPath, numberOfWorkers, this, outputPath);
manager.processImages();
return this;
}
}