Class TextureAnalysis
- java.lang.Object
-
- net.sourceforge.jiu.ops.Operation
-
- net.sourceforge.jiu.color.analysis.TextureAnalysis
-
public class TextureAnalysis extends Operation
This class determines a number of properties for a given co-occurrence matrix. The only input parameter is a mandatory co-occurrence matrix object to be specified usingsetMatrix(net.sourceforge.jiu.color.data.CoOccurrenceMatrix). Thenprocess()must be called. After that, the various properties can be retrieved using the corresponding get methods, e.g.getContrast(),getEnergy()etc.Static convenience methods
compute(CoOccurrenceMatrix)andcompute(IntegerImage, int)exist for simplified usage. You may need to cast yourPixelImagetoIntegerImagefirst.Usage example
Use like that:GrayIntegerImage img = ...; TextureAnalysis op = TextureAnalysis.compute(img); System.out.println("Entropy=" + op.getEntropy());Use the compute method that takes aCoOccurrenceFrequencyMatrixif you want to reuse a matrix object.Caveat: memory consumption
Will not work with 16 bit image objects because
MemoryCoOccurrenceMatrixis rather unsophisticated, trying to allocate 4 * 65536 * 65536 bytes (16 GB). Solution is an implementation ofCoOccurrenceMatrixwhich creates element counters on demand. The following resources were helpful when creating this class:- Article Suchen ohne Worte by Henning Müller in German computer magazine c't 15 / 2001, p. 162ff.
- GLCM Texture: A Tutorial by Mryka Hall-Beyer.
- Texture Mapping of Neurological Magnetic Resonance Images by J.H.P. Burrill
- Since:
- 0.7.0
- Author:
- Marco Schmidt
-
-
Field Summary
Fields Modifier and Type Field Description private intcontrastprivate doublecorrelationprivate intdissimilarityprivate intenergyprivate doubleentropyprivate doublehomogeneityprivate CoOccurrenceMatrixmatrixprivate intsumprivate booleansymmetry
-
Constructor Summary
Constructors Constructor Description TextureAnalysis()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TextureAnalysiscompute(CoOccurrenceMatrix matrix)Create a TextureAnalysis operation with the results computed from a given matrix.static TextureAnalysiscompute(IntegerImage image, int channelIndex)For one channel of the argument image, create a TextureAnalysis operation with all attributesintgetContrast()Returns the contrast value determined inprocess().doublegetCorrelation()Returns the correlation determined inprocess().intgetDissimilarity()Returns the dissimilarity value determined inprocess().intgetEnergy()Returns the energy value determined inprocess().doublegetEntropy()Returns the entropy value determined inprocess().doublegetHomogeneity()Returns the homogeneity value determined inprocess().intgetSum()Returns the sum of all entries in the matrix.booleanisSymmetrical()voidprocess()Run over the input matrix and determine contrast, energy, entropy and homogeneity of that matrix.voidsetMatrix(CoOccurrenceMatrix m)Sets the matrix to be used by this operation to the argument value.-
Methods inherited from class net.sourceforge.jiu.ops.Operation
addProgressListener, addProgressListeners, getAbort, removeProgressListener, setAbort, setProgress, setProgress
-
-
-
-
Field Detail
-
matrix
private CoOccurrenceMatrix matrix
-
contrast
private int contrast
-
correlation
private double correlation
-
dissimilarity
private int dissimilarity
-
energy
private int energy
-
entropy
private double entropy
-
homogeneity
private double homogeneity
-
sum
private int sum
-
symmetry
private boolean symmetry
-
-
Method Detail
-
compute
public static TextureAnalysis compute(CoOccurrenceMatrix matrix) throws MissingParameterException
Create a TextureAnalysis operation with the results computed from a given matrix.- Parameters:
matrix- co-occurrence matrix to use for texture analysis- Returns:
- TextureAnalysis object with all attributes computed
- Throws:
MissingParameterException- if matrix is null- Since:
- 0.14.2
-
compute
public static TextureAnalysis compute(IntegerImage image, int channelIndex) throws MissingParameterException
For one channel of the argument image, create a TextureAnalysis operation with all attributes- Parameters:
image- the IntegerImage for which the texture analysis is being donechannelIndex- zero-based index of channel to work on- Returns:
- TextureAnalysis object with all attributes computed
- Throws:
MissingParameterException- if matrix is null- Since:
- 0.14.2
-
getContrast
public int getContrast()
Returns the contrast value determined inprocess(). Also called inertia.
-
getCorrelation
public double getCorrelation()
Returns the correlation determined inprocess().
-
getDissimilarity
public int getDissimilarity()
Returns the dissimilarity value determined inprocess().
-
getEnergy
public int getEnergy()
Returns the energy value determined inprocess().
-
getEntropy
public double getEntropy()
Returns the entropy value determined inprocess().
-
getHomogeneity
public double getHomogeneity()
Returns the homogeneity value determined inprocess(). Also called inverse difference moment.
-
getSum
public int getSum()
Returns the sum of all entries in the matrix.
-
isSymmetrical
public boolean isSymmetrical()
-
process
public void process() throws MissingParameterExceptionRun over the input matrix and determine contrast, energy, entropy and homogeneity of that matrix.- Overrides:
processin classOperation- Throws:
MissingParameterException- if no co-occurrence matrix was provided usingsetMatrix(net.sourceforge.jiu.color.data.CoOccurrenceMatrix)
-
setMatrix
public void setMatrix(CoOccurrenceMatrix m)
Sets the matrix to be used by this operation to the argument value.- Parameters:
m- the matrix for which the various properties will be computed
-
-