Collection of functions to prepare datasets for Machine Learning training (resize, crop, cut pieces, create mosaic, etc.)
Various functions to resize, compress, rotate, etc. individual images (in Java).
Methods that apply operation on an input folder (and its sub-folders recursively) containing images (in Kotlin). It doesn't override the original images, but create an output folder with the processed images.
File.listAllImages()
File.cropImagesToProportions(x = 1, y = 2)
File.resizeImagesTo(width = 1920, height = 1080)
File.resizeImagesTo(size = 1024)
Create e.g. 4K images from 1080p images.
File.createMosaics(width = 3840, height = 2160, nbrOfOutputImages = 2000)
All those functions return a File
, and therefore can be chained:
val folder = File("/home/benoit/Pictures/dataset/my_data_set")
folder
.cropImagesToSquares()
.resizeImagesTo(1024)
.randomizeImageNames()
drwxrwxr-x 2 benoit benoit 3,8M Oct 13 18:05 my_data_set
drwxrwxr-x 2 benoit benoit 3,9M Oct 13 18:12 my_data_set-square
drwxrwxr-x 2 benoit benoit 3,8M Oct 13 18:18 my_data_set-square-1024
drwxrwxr-x 2 benoit benoit 2,2M Oct 13 18:18 my_data_set-square-1024-rnd
Crop pictures around the faces (in such a way that faces are always at the same place in the output images), based on information contained in a CSV file. You can build such a CSV with this project: https://github.com/benckx/tensorflow-face-detection
FaceUtils.reFrameAroundFace(csv: String, frame: ImageContainingFace, output: String)
For example, with this input image and frame (frames outlines added for visualization purpose; the CSV face data is in blue, the WAIST_LEVEL frame in red and orange):
val WAIST_LEVEL = ImageContainingFace(640, 1080, Face(Rectangle(170, 170, 300, 300)))
It will extract the following:
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile "com.github.benckx:iapetus-images:master-SNAPSHOT"
}