hhreco.recognition
Class ZernikeMoments

java.lang.Object
  extended byhhreco.recognition.ZernikeMoments

public class ZernikeMoments
extends java.lang.Object

This class provides a set of methods for computing Zernike moments.

This code originally came from the Xite project written in C++. (http://www.ifi.uio.no/forskning/grupper/dsb/Software/Xite/)

It has been translated to Java by Lijun Tang in his zernike.java source. http://www1.cs.columbia.edu/~ljtang/research.html

Here I adapt it into my program. The basic functionality remains the same. The modifications are in the interface and data structure, and the reconstruction methods have been removed.


Nested Class Summary
static class ZernikeMoments.Complex
          Data structure for a complex number with real and imaginary parts.
 
Constructor Summary
ZernikeMoments()
           
 
Method Summary
static ZernikeMoments.Complex[] zer_mmts(int order, double[] xvals, double[] yvals, int npoints)
           
static ZernikeMoments.Complex[] zer_mmts(int order, double[] xvals, double[] yvals, int npoints, double ww, double hh, double cx, double cy)
          Return the set of Zernike's moments up to the specified order.
static ZernikeMoments.Complex zer_mom(double[] xvals, double[] yvals, int npoints, double ww, double hh, double cx, double cy, int n, int m)
          xvals and yvals are the coordinates of the shape.
static ZernikeMoments.Complex zer_mom(double[] xvals, double[] yvals, int npoints, int n, int m)
          Computes the width, height, and centroid of the shape, and call zer_mom(double[] xvals, double[] yvals, int npoints, double ww, double hh, double cx, double cy, int n, int m)
static double zer_pol_R(int n, int m_in, double x, double y)
          zer_pol_R() computes the radial polynomial, Rnm(p), in the definition of V(n,m,x,y).
static ZernikeMoments.Complex zer_pol(int n, int m, double x, double y)
          zer_pol() computes the Zernike basis function V(n,m,x,y).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZernikeMoments

public ZernikeMoments()
Method Detail

zer_pol_R

public static double zer_pol_R(int n,
                               int m_in,
                               double x,
                               double y)
zer_pol_R() computes the radial polynomial, Rnm(p), in the definition of V(n,m,x,y). [1]

Returns:
the value of Rnm(p)

zer_pol

public static ZernikeMoments.Complex zer_pol(int n,
                                             int m,
                                             double x,
                                             double y)
zer_pol() computes the Zernike basis function V(n,m,x,y).

Returns:
res[1] is the dcomplex for V(n,m,x,y)

zer_mom

public static ZernikeMoments.Complex zer_mom(double[] xvals,
                                             double[] yvals,
                                             int npoints,
                                             int n,
                                             int m)
Computes the width, height, and centroid of the shape, and call zer_mom(double[] xvals, double[] yvals, int npoints, double ww, double hh, double cx, double cy, int n, int m)


zer_mom

public static ZernikeMoments.Complex zer_mom(double[] xvals,
                                             double[] yvals,
                                             int npoints,
                                             double ww,
                                             double hh,
                                             double cx,
                                             double cy,
                                             int n,
                                             int m)
xvals and yvals are the coordinates of the shape. npoints indicates the total number of points in the digitized shape. ww is the width and hh is the height of the bounding box of the shape. (cx, cy) is the centroid point of the shape. n and m are the moment order. 'zer_mom' computes A(n,m).


zer_mmts

public static ZernikeMoments.Complex[] zer_mmts(int order,
                                                double[] xvals,
                                                double[] yvals,
                                                int npoints,
                                                double ww,
                                                double hh,
                                                double cx,
                                                double cy)
Return the set of Zernike's moments up to the specified order. The moments are returned in the order of (0,0)(1,1)(2,0)(2,2)(3,1)(3,3) and so on, where m<=n and n = 0...order. xvals and yvals are the coordinates of the shape. npoints indicates the total number of points in the digitized shape. ww is the width and hh is the height of the bounding box of the shape. (cx, cy) is the centroid point of the shape. n and m are the moment order. 'zer_mom' computes A(n,m).


zer_mmts

public static ZernikeMoments.Complex[] zer_mmts(int order,
                                                double[] xvals,
                                                double[] yvals,
                                                int npoints)