Package adams.data.image.moments
Class MomentHelper
- java.lang.Object
-
- adams.data.image.moments.MomentHelper
-
public class MomentHelper extends Object
Implements Image Moments for use in feature generation Only implemented for binary images For all boolean matrices the expected format is boolean[height][width]- Version:
- $Revision$
- Author:
- sjb90
-
-
Constructor Summary
Constructors Constructor Description MomentHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
centralMoment(boolean[][] img, int p, int q)
Computes the central moment.static double
eccentricity(boolean[][] img)
Measures the eccentricity of an object.static List<Double>
husMoments(boolean[][] img)
Computes Hu's moments.static void
main(String[] args)
Just for testing.static double
majorAxisDirection(boolean[][] img)
Computes the orientation of the major axis.static double
moment(boolean[][] img, int p, int q)
Computes the moment.static double
normalCentralMoment(boolean[][] img, int p, int q)
Computes the (normal) central moment.static List<Double>
orientationVector(boolean[][] img)
Computes the orientation vector.
-
-
-
Method Detail
-
moment
public static double moment(boolean[][] img, int p, int q)
Computes the moment.- Parameters:
img
- the matrixp
- the p parameter, exponent for xq
- the q parameter, exponent for y- Returns:
- the moment
-
centralMoment
public static double centralMoment(boolean[][] img, int p, int q)
Computes the central moment. See here- Parameters:
img
- the matrixp
- the p parameter, exponent for xq
- the q parameter, exponent for y- Returns:
- the moment
-
normalCentralMoment
public static double normalCentralMoment(boolean[][] img, int p, int q)
Computes the (normal) central moment.- Parameters:
img
- the matrixp
- the p parameter, exponent for xq
- the q parameter, exponent for y- Returns:
- the moment
- See Also:
centralMoment(boolean[][], int, int)
-
majorAxisDirection
public static double majorAxisDirection(boolean[][] img)
Computes the orientation of the major axis.- Parameters:
img
- the matrix- Returns:
- the orientation
-
orientationVector
public static List<Double> orientationVector(boolean[][] img)
Computes the orientation vector.- Parameters:
img
- the matrix- Returns:
- the orientation (x, y)
-
eccentricity
public static double eccentricity(boolean[][] img)
Measures the eccentricity of an object. A value of 1 is for a round object and the value can range from 1 to infinity.- Parameters:
img
- the matrix- Returns:
- the eccentricity of the object
-
husMoments
public static List<Double> husMoments(boolean[][] img)
Computes Hu's moments.- Parameters:
img
- the matrix to use- Returns:
- the moments (1-7)
-
main
public static void main(String[] args)
Just for testing.- Parameters:
args
- ignored
-
-