Class 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 Detail

      • MomentHelper

        public MomentHelper()
    • Method Detail

      • moment

        public static double moment​(boolean[][] img,
                                    int p,
                                    int q)
        Computes the moment.
        Parameters:
        img - the matrix
        p - the p parameter, exponent for x
        q - 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 matrix
        p - the p parameter, exponent for x
        q - 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 matrix
        p - the p parameter, exponent for x
        q - 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