Skip to content

This is an Image transformation webservice where we can see 3 algorithms performing updates on images. It implements a contour for images, the Kuwahara blur filter and finally an algorithm I made myself called chartizate. The latter creates images where the foreground is written text.

License

jesperancinha/image-train-filters-web

Repository files navigation

Image Train Filters


Twitter URL Generic badge

Generic badge

GitHub release

CircleCI Build status Build image-train-filters-web E2E e2e-image-train-filters

Codacy Badge codebeat badge BCH compliance Known Vulnerabilities

Codacy Badge codecov Coverage Status

GitHub language count GitHub top language GitHub top language


alt text alt text alt text

Description

Let's start with this image:


Using Image Contour filter:


Using Kuwahara filter:


Using Chartizate filter:

Current running online implementation: Image train filters

NodeJs Multiproject

yarn config set workspaces-experimental true

How to use

We need to provide two form-data parameters in a Multipart Formdata request. Use curl for that please. An example follows bellow.

filename

  • this is the where you load your image file in

commands

  • this is where you set your commands. there are only two examples at the moment:
  1. Kuwahara filter:

It smooths the image

  1. Image contour filter:

Processes differences in color ranges

These requests you can apply as many times as you like using a JSON request. Read following example for more.

Command example

{
  "commands": [
    {
      "filter": "imageKuwahara",
      "settings": [
        {
          "name": "square-size",
          "value": "2"
        },
        {
          "name": "iterations",
          "value": "2"
        }
      ]
    },
    {
      "filter": "imageContour",
      "settings": [
        {
          "name": "bgColor",
          "value": "0xFFFFFF"
        },
        {
          "name": "lnColor",
          "value": "0x000000"
        },
        {
          "name": "diffThreshold",
          "value": "800000"
        },
        {
          "name": "radius",
          "value": "2"
        }
      ]
    }
  ]
}

Complete request

You can use tools like postman, but you can also use curl. This is an example of such request:

$ curl -X POST --form filename=@testEye.png http://localhost:8080/images --form commands="{ \"commands\": [ { \"filter\": \"imageKuwahara\", \"settings\": [ { \"name\": \"square-size\", \"value\": \"2\"}, { \"name\": \"iterations\", \"value\": \"2\"} ]}, { \"filter\": \"imageContour\", \"settings\": [ { \"name\": \"bgColor\", \"value\": \"0xFFFFFF\"}, { \"name\": \"lnColor\", \"value\": \"0x000000\"}, { \"name\": \"diffThreshold\", \"value\": \"800000\"}, { \"name\": \"radius\", \"value\": \"2\"} ]} ] }"

Results

Your results are stored wherever you define in your application.conf folder:

akka {
  loglevel = DEBUG
  event-handlers = ["akka.event.slf4j.Slf4jEventHandler"]
}

service {
  host = "localhost"
  port = 8080
}

image-train-filters {
  image-source-path = "/tmp/image-train-filters/sources"
  image-destination-path = "/tmp/image-train-filters/destination"
}

Only important to note here that:

  • image-source-path -> This is where your original file is saved

  • image-destination-path -> This is where the resulting file is saved after applying the train of filters.

DevOps

$ npm i -g npm  
$ npm install -g @angular/cli  
$ alias ng="/usr/local/lib/node_modules/@angular/cli/bin/ng"  
$ npm cache clean -f  
$ npm install -g n  
$ n stable  
$ echo "deb https://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list  
$ apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823  
$ apt-get update  
$ apt-get install sbt 
$ apt-get install default-jre 

image-train-filters-fe Module

Make a build

$ yarn install
$ yarn build
$ service nginx reload

References

About me

GitHub followers

About

This is an Image transformation webservice where we can see 3 algorithms performing updates on images. It implements a contour for images, the Kuwahara blur filter and finally an algorithm I made myself called chartizate. The latter creates images where the foreground is written text.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •