Giter VIP home page Giter VIP logo

py-glcm's Introduction

Installation

python setup.py install

Usage

  • [Grey Level Co-occurance Matrix](# Grey Level Co-occurance Matrix)
  • [glcm](# glcm.glcm)
  • xglcm
  • GLCM Features

Grey Level Co-occurance Matrix

glcm.glcm

glcm.glcm(array, dists, dirs, mode, symmetric=True, bins=256, normalized=True, check=True)

Generates a GLCM.

Parameters:
array : array_like

  Input image, either 2D or 3D.

dists : array_like

  Array of desired integer distances [d1, d2, ..., dn].

dirs : array_like

  Array of desired integer directions [d1, d2, ..., dn]. 1 Corresponds to N, 2 to NE, 3 to E, ... and 8 to NW.

Caution! Directions will be reordered ascendingly. To avoid confused outputs, please make sure to provide an ordered array.
mode : string

Operation mode of the glcm. Features "sum" and "raw".

In raw-mode a glcm is generated for every combination of distances and directions.

In sum-mode all desired directions are added together so only one glcm per distance is generated. This is far more efficient than summing up afterwards.

symmetric : boolean, optional
Caution! Running in symmetric mode will remove opposing directions and will replace directions 5 to 8 with their corresponding counterparts! To avoid confusing outputs please make sure only to use directions 1 to 4 in symmetric mode!
bins : int, optional

Number of bins. When input checking is enabled, the input image is binned to this number if the maximum image value exceeds the number of bins. This happens aswell if the input image is not of integer type.

normalized : boolean, optional
Determines if the output shall be normalized or not.
Caution! The normalization will fail if the input image has more than 10^15 pixels.
check : boolean, optional
Determines if the input should be checked for correctness.
Returns: glcm : ndarray

Array of glcm(s) with the following shape:

[distances][directions][channels][bins][bins]

glcm.xglcm

glcm.xglcm(array, dists, dirs, mode, symmetric=True, bins=256, normalized=True, check=True)

Generates a GLCM for every channel combination.

**Parameters:** **array** : _array_like_

Input image with three dimensions with shape [dimx, dimy, channels]

**dists** : _array_like_

Array of desired integer distances [d1, d2, ..., dn].

**dirs** : _array_like_

Array of desired integer directions [d1, d2, ..., dn]. 1 Corresponds to N, 2 to NE, 3 to E, ... and 8 to NW.

Caution! Directions will be reordered ascendingly. To avoid confused outputs, please make sure to provide an ordered array.

**mode** : _string_

Operation mode of the glcm. Features "sum" and "raw".

In raw-mode a glcm is generated for every combination of distances and directions.

In sum-mode all desired directions are added together so only one glcm per distance is generated. This is far more efficient than summing up afterwards.

**symmetric** : _boolean, optional_

Caution! Running in symmetric mode will remove opposing directions and will replace directions 5 to 8 with their corresponding counterparts! To avoid confusing outputs please make sure only to use directions 1 to 4 in symmetric mode!

**bins** : _int, optional_

Number of bins. When input checking is enabled, the input image is binned to this number if the maximum image value exceeds the number of bins. This happens aswell if the input image is not of integer type.

**normalized** : _boolean, optional_ Determines if the output shall be normalized or not.

Caution! The normalization will fail if the input image has more than 10^15 pixels.

**check** : _boolean, optional_ Determines if the input should be checked for correctness.
**Returns:** **glcm** : _ndarray_

Array of glcm(s) with the following shape:

[distances][directions][source channels][target channels][bins][bins]

GLCM Features

glcm.glcm_features

glcm.glcm_features(array, features, symmetric=True, normalized=True)

Calculates features from a given set of GLCMs

**Parameters:** **array** : _array_like_

Array of glcms with shape where the last two axes covering the glcm entries.

**features** : _int_

Binary input that determines the desired features. See below.

**symmetric** : _boolean, optional_

Indicates if the input GLCM(s) are symmetric or not.

**normalized** : _boolean, optional_ Determines if the input is normalized.
**Returns:** **glcm** : _dict_

Dictionary of features.

Supported Features

Angular Second Moment

glcm.asm, dictionary: "ASM"

Measurement of homogeneous patterns in the image.

Contrast

glcm.contrast, dictionary: "Contrast"

Correlation

glcm.correl, dictionary: "Correlation"

Not implemented yet

Autocorrelation

glcm.autocorrel, dictionary: "Auto Correlation"

Sum of Squares

glcm.ssq, dictionary: "SSQ"

Not implemented yet

Inverse Difference Moment

glcm.idm, dictionary: "IDM"

Inverse Difference

glcm.idf, dictionary: "IDF"

Sum Average

glcm.sumavg, dictionary: "Sum Average"

Sum Variance

glcm.sumvar, dictionary: "Sum Variance"

Sum Entropy

glcm.sumentrp, dictionary: "Sum Entropy"

Difference Average

glcm.diffavg, dictionary: "Diff Average"

Difference Variance

glcm.diffvar, dictionary: "Diff Variance"

Not implemented yet

Difference Entropy

glcm.diffentrp, dictionary: "Diff Entropy"

Cluster Prominence

glcm.clusterprom, dictionary: "Cluster Prominence"

Cluster Shade

glcm.clustershade, dictionary: "Cluster Shade"

Cluster Tendency

glcm.clustertend, dictionary: "Cluster Tendency"

Dissimilarity

glcm.Dissim, dictionary: "Dissimilarity"

py-glcm's People

Watchers

James Cloos avatar

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.