/StatFilters

Java code to apply apply statistical functions on images

Primary LanguageJava

Stat Filters

Status: v0.3

statFilters

Java code to apply mathematical operations to images and visualise statistics.
This tool was designed around Jupyter Notebooks to test interactively different sequences of image processing operations and understand how they affect the image.

Overview

An image can be divided into tiles using createTiles(rows, columns) or alternatively createTiles(pixelsize) where pixel size is given in this format "3x3", "16x16","32x32"

divide

Each tile can be selected either by ID or coordinates (row,column) and local statistics can be displayed.

get1

[{ "img":"green.json", "Rank":0, "Y":0, "X":0, "height":5, "width":5, "avg.green":107, "avg.red":0, "saturation":100.0, "hue":24.0, "entropy":4.053660689688185, "brightness":41.0, "std.dev":5.044759657307769, "avg.blue":0, "mean":35.0}]

Tiles can be sorted by metrics:

Boolean ascending = true;
filter.sortTilesBy("std.dev", ascending);

which returns:

{6,19,16,17,10,2,8,23,18,3,11,9,22,1,13,24,12,14,4,5,7,21,0,15,20,}

Some of these metrics can be applied as "operation filters" using

filter.applyOperation(operation, subset) 

operations This is a list of all the operations available: ["mean", "std.dev","log","sqrt","entropy","sobel","red","green", "blue"]

An operatation can be applied only to specific tiles passing an array of IDs in the parameter subset.
If subset of files is not specified the opration is applied to the entire image.

sort

How to run on a Jupyter Notebook

Step 1

Install IJava a Jupyer kernel for executing Java code developed by SpencerPark

Step 2

Download the latest version of the jar file and save it in your project folder

Step 3

Open a new Notebook in the same folder where the jar file is and execute this code in the first cell:

%jars ./StatFilters.jar
import filters.*;
import java.awt.image.BufferedImage;