Giter Site home page Giter Site logo

benckx / iapetus-images Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 924 KB

Images manipulation tools (resize, crop, compress, rotate, reframe around faces, etc.) written Java and Kotlin to clean up images datasets (e.g. for machine learning).

Java 20.49% Kotlin 79.51%
kotlin kotlin-library image-processing image-manipulation image-analysis cnn

iapetus-images's Introduction

About

Collection of functions to prepare datasets for Machine Learning training (resize, crop, cut pieces, create mosaic, etc.)

ImagesUtils

Various functions to resize, compress, rotate, etc. individual images (in Java).

ImagesFolderUtils

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.

List all images in folders and sub-folders:

File.listAllImages()

Crop all images found in input folder to proportions (e.g. 1x1, 16x9, etc.):

File.cropImagesToProportions(x = 1, y = 2)

Resize all images found in input folder:

File.resizeImagesTo(width = 1920, height = 1080)
File.resizeImagesTo(size = 1024)

Create Mosaics

Create e.g. 4K images from 1080p images.

File.createMosaics(width = 3840, height = 2160, nbrOfOutputImages = 2000)

Chain calls

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

FaceUtils

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:

Import with Gradle

repositories {
    maven { url "https://jitpack.io" }
}

dependencies {
    compile "com.github.benckx:iapetus-images:master-SNAPSHOT"
}

iapetus-images's People

Contributors

benckx avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

fazlimolajan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.