Giter Club home page Giter Club logo

imageaugmentation's Introduction

Image Augmentation

Image augmentation artificially creates training images through different ways of processing or combination of multiple processing, such as rotation, flips, random crop and gaussian noise, etc.

Getting Started

These instructions will get you a copy of the project up and running on your local machine.

Prerequisites

Use at least Qt version 4.x and C++17

Download Qt

Installing

A step by step series of examples that tell you how to get the application running

Console application

On command line, type in the following commands:

$ make clean
$ qmake CONFIG+=consoleAppConf
$ make

Graphic application

On command line, type in the following commands:

$ make clean
$ qmake CONFIG+=GUIConf
$ make

Note that spaces are not allowed, so the following won't work

$ make clean
$ qmake CONFIG += consoleAppConf
$ make

Usage Tutorial

Provide source image which has one of the following formats: png, jpeg, jpg, JPG, JPEG, gif, bmp, dib

Or directory (in this case all the images in this directory with the given formats will be proccesed)

Provide destination directory

$ ./ImageAugmentation /home/user/Pictures/example.gif /home/user/TempDir
$ ./ImageAugmentation /home/user/Pictures /home/user/TempDir

Console application is provided with several keys:

  • -l 'number'

set maximum number of pictures after processing(default is 25)

  • -d 'algorithm name'

restrict the use of an algorithm

  • -a

show names of all algorithms

$ ./ImageAugmentation -a
crop | hflip | vflip | rotate90 | rotate45 | dithering | gaussnoise | kuwahara | 
lightening | rgbtone | whiteblack | blur | negative | sharpen | embross | 
lightblur | lightsharpen | lightembross | gaussblur | randomcrop

  • -f 'format'

set format of processed images (png, jpeg, jpg, JPG, JPEG, gif, bmp, dib), default is jpg

  • -o 'number'

set possible depths of overlay(default is 1)

  • -c 'config file path'

set config file

Example 1:

$ ./ImageAugmentation /home/user/Pictures /home/user/TempDir -d crop -d lightsharpen -o 3 -o 4 -l 8

This will

  1. Take all images in /Pictures directory

  2. 3 or 4 distinct algorithms(except for crop and lightsharpen) will be apllied on each image

  3. No more than 8 images will be created from each source image in the directory

For example if /Pictures contains 3 images then in total it will create 24 images

Example 2:

$ ./ImageAugmentation /home/user/Pictures/example.bmp /home/user/TempDir -f gif

This will

  1. Take example.bmp image

  2. Each algorithm will be applied but only once

  3. Processed images will have gif format

This will create 25 distinct pictures

(rotate90 and rotate45 both give 2 different images(rotation clockwise and counterclockwise), 2 types of gaussian noise)

Example 3:

$ ./ImageAugmentation /home/user/Pictures/example.bmp /home/user/TempDir -f gif -d 2 -c /home/user/configfile.json

This will

  1. Take example.bmp image

  2. Only algorithms included in the config file with given configuration will be used

  3. 2 distinct algorithms will be apllied on each image

  4. Processed images will have gif format

For example if config file contained 4 distinct algorithms, this will create 4*3 = 12 images in total

Config File

Example:

{
	"crop": {
		"upperLeftXInPercent": 10,
                "upperLeftYInPercent": 15,
                "downRightXInPercent": 30,
		"downRightYInPercent": 40
        },
	"blur": {
		"degree": 15
	},
	"negative": {
		"degree": 15
	},
	"sharpen": {
		"degree": 10
	},
	"embross": {
		"degree": 30
	},
        "lightBlur": {
		"degree": 15
	},
	"lightSharpen": {
		"degree": 15
	},
	"lightEmbross": {
		"degree": 15
	},
        "gaussBlur": {
		"degree": 15
	},
	"kuwahara": {
		"degreeOfBlur": 12
	},
	"lightening": {
		"degreeOfLightening": 40
	},
	"randomCrop": {
		"upperLeftXInPercent": 10,
                "upperLeftYInPercent": 15
        },
	"gaussiannoise": {
		"degreeOfNoise": 70,
		"mono": true
	},
	"blueRGBTone": {
		"degreeOfTone": 60
	},
	"redRGBTone": {
		"degreeOfTone": 50
	},
        "greenRGBTone": {
		"degreeOfTone": 40
	},
	"enable": [
		"dithering",
		"whiteblack",
		"vflip",
		"hflip",
		"rotate90Clockwise",
                "rotate90Counterclockwise",
                "rotate45Clockwise",
                "rotate45Counterclockwise"
	]
}

Note

If source directory contains files in (png, jpeg, jpg, JPG, JPEG, gif, bmp, dib) format that are not images, application won't be able process to them (corresponding message will appear on the screen). But it will process all the other pictures in the directory.

Gaussian Blur and Kuwahara take a long time to be processed.

Some algorithms are not compatible with small pictures (less than 100 pixels in width or height)

Built With

Description of the algorithms

Source Image

Image alt

Crop

The algorithm that cuts out part of the image: the user sets the relative size of the imageand the location of the upper left corner of the cropped image as a percentage of the size of the entire image

Image alt

Random crop

An algorithm that randomly selects the position of the black square of a given relative size that covers part of the image

Image alt

Dithering

An algorithm that expresses colors that do not exist in a given palette through errors already known with dispersion

Image alt

Gaussian Noise

An algorithm that applies color or black and white noise with given degree (from 0 to 100) to an image depending on the mode selected by the user

Image alt

Horizontal Flip

Algorithm that reflects the transmitted image relative to the y-axis

Image alt

Kuwahara

An algorithm that applies a blur filter to an image with given degree (from 0 to 30), creating the effect of a picture drawn in rough strokes

Image alt

Lightening

The algorithm that brightens the image with given degree (from 0 to 255)

Image alt

Matrix Convolution

A series of matrix convolution algorithms that passes through the image with a filter matrix and overlays one of the filters selected by the user: blur, negative, sharpen, embross, lightBlur, lightSharpen, lightEmbross, gaussBlur. Also user can tune the degree of Gauss Blur from 0 to 70

Embross Image alt

Gaussian Blur Image alt

Negative Image alt

RGB Tone

An algorithm that increments with given degree one of the components of an RGB vector. Thus, the image becomes more reddish, greenish or bluish

Image alt

Rotate 45

An algorithm that rotates an image 45 degrees clockwise or counterclockwise, depending on the user's choice. Pixel stretching is applied to the corners of the image. Thus, the picture looks holistic.

Image alt

Rotate 90

An algorithm that rotates an image 90 degrees clockwise or counterclockwise, depending on the user's choice.

Image alt

Vertical Flip

Algorithm that reflects the transmitted image relative to the x-axis

Image alt

White Black

An algorithm that converts an image to black and white palette

Image alt

imageaugmentation's People

Contributors

hwangyoon avatar lizazhemchuzhina avatar lensunko avatar lensunko01 avatar

Stargazers

INTELLIZ Corp. avatar  avatar  avatar Vitalii Selishchev avatar

Watchers

 avatar  avatar

imageaugmentation's Issues

Отрефакторить main.cpp

Разбить на мелкие функции, а создание запроса по конфигу вынести в отдельный класс JsonParser.
Продумать, как в этом случае поступать с ошибками.
Можно, например, сделать так, чтобы JsonParser кидал исключения в случае чего, а код в main их ловил и выводил соответствующие сообщения на экран.

Builder

  • Реализовать проставление полей, которые требуются отдельным алгоритмам
  • Понять и реализовать build алгоритма с учетом того, что объект класса QImage не передается строителю и на этапе обработки запросов в algo factory вообще может быть не известен
  • Тесты

Изучение Qt

Понять, как работает, завести у себя проект, который будет работать

Размытие изображения

  • Создание буфера
  • Создание фильтра
  • Применения фильтра к буферу : средневзвешенное значение пикселей вокруг текущего - фильтр????
  • обработка краев ??????

Разобраться с тестами

-Нужно сделать так, чтобы запускались (или удалить вообще)
-Так же поменять на camel case названия файлов, и в про файле поменять цель на просто test и название на testConf, если тесты все-таки оставляем

Более человекочитаемый Json

Сейчас используется такой формат:
{
"rotate45": "CLOCKWISE45",
"rotate90": "COUNTERCLOCKWISE",
"enable": [
"hflip",
"vflip"
],
"crop": [
0,
0,
40,
80
]
}

Удобнее было бы представлять аргументы crop не в виде массива, а в виде именованных параметров:
leftUpperXPercent: 0
leftUpperYPercent: 0
И т.д.

Этот конфиг -- для пользователя, он будет выставлять настройки именно в нём.

Добавить лицензию

Почитать, какие лицензии существуют, и выбрать подходящую для данного проекта.

Написать Readme

Readme должен содержать

  1. Пререквизиты (библиотеки, которые нужно поставить, что собрать приложение)
  2. Инструкция по сборке (какие команды выполнить в терминале, чтобы собрать приложение)
  3. Инструкция по запуску и работе с консольной версией: формат параметров командной строки, формат конфигурационного файла (и закоммитить пример конфига)
  4. Инструкция по работе с графической версией

P.S. всё на английском

Консольное приложение

Написать простейший парсинг аргументов коммандной строки при помощи класса QCommandLineParser Class

Создание GUI

Починить (читай как снести и установить опять Qt)
И создать графический интерфейс

Pro-file

В Pro-файле название цели gui и gui_conf нужно поменять на camel case

CLI

Написать что-то, что поможет девочкам тестить свои части (не фреймворк, ага)

Написать класс Guicontroller

Эта прелесть должна будет осуществлять связь контроллера и интерфейса
Каким образом?.. Она по каким-то объектам из интерфейса будет понимать, что это значит на языке программы (например, будет говорить, что 3-й элемент списка на самом деле алгоритм rotate) и передавать дальше на обработку

Напоминалка для самой любимой женщины

Напиши, пожалуйста, проверку аргументов в конструкторе, в случае, если они не валидны, конструктор же кинет исключение. Если получится, можно давать какие-то сообщения для пользователя: введённые координаты выходят за границы, параметров больше необходимого итд

Алгоритм: псевдотонирование

  • Идея: приближённое выражение недоступных цветов доступными, для чего доступные цвета смешиваются так, чтобы имитировать недоступные
  • https://habr.com/ru/post/326936/ прочитать и разобраться
  • попробовать избавиться от пунктира

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.