Code Monkey home page Code Monkey logo

irregularity-index's Introduction

Irregularity Index for Vector-valued Morphological Operators

Vector-valued morphological operators defined on total orders usually introduced irregularities because the topology of a total order is to weak to reproduce the topology induced by a metric. This repository contains the Julia's souce-code for measuring the irregularity issue using the relative gap between the generalized sum of pixel-wise distances and the Wasserstein metric. Currently, the source-code allows only computing the irregularity of color images using the Euclidean distance and with the parameters p=1 or p=2.

Getting Started

This repository contain the Julia's source-codes for quantifying the irregularity issue of vector-valued morphological operators. The Jupyter-notebook of the computational experimens are also available in this repository.

Usage

First of all, call the irregularity tools module using:

include("IrregularityTools.jl")

The modole uses the following libraries: Images, ImageMorphology, Statistics, StatsBase, Distances, LinearAlgebra, ProgressMeter, OptimalTransport, Tulip, JuMP, and Clp. Add these libraries before calling the irregularity tools module.

Global Irregularity Index:

The global irregularity index evaluate the gap between the generalized sum of pixel-wise distances and the Wasserstein metric computed using all the pixels of an image. Due to the computational cost, the global irregularity index can be computed only for tiny images. The global irregularity index can be computed as follows:

global_irregularity(I,J)

where I is the input image and J is the output image of a morphological operator. The previous command computes the irregularity index by solving the optimal transport problem using a linear programming solver (JuMP + Clp). Alternatively, the global irregularity index can be computed using the Sinkhorn method or its stabilized version, both available at OptimalTransport library.

global_irregularity(I,J,"sinkhorn",1.e-2)

or

global_irregularity(I,J,"stabilized_sinkhorn",1.e-3)

Local Irregularity Index:

The local irregularity index is obtained by computing the Wasserstein metric in local windows of size $W \times W$ and aggregating the results in a single value. The local irregularity index provides a lower bound for the global irregularity index. The local irregularity index with local windows of size $16 \times 16$ can be computed as follows:

local_irregularity(I,J)

where I is the input image and J is the output image of a morphological operator. The size of the local windows can be given as an additional parameter:

local_irregularity(I,J,W)

The previous commands compute the irregularity index by solving the optimal transport problem using the stabilized Sinkhorn method from available at OptimalTransport library. The Sinkhorn method can also be used as follows:

local_irregularity(I,J,W,"sinkhorn",1.e-2)

Alternatively, the optimal transport can be solved analytically using JuMP + Clp as follows:

local_irregularity(I,J,W,"JuMP")

See examples in the Jupyter notebook files!

There is also a Jupyter notebook showing how to compute the global irregularity index in python!

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.