|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvec_math.ImageMoments
public class ImageMoments
Similar to one-dimension power sums or CentralMoments this class
calculates image moments meaning statistic properties in a two-dimensional
image. Suppose you have an array of pixel values
I_ij = I(x,y)
Sampled at integer x/y pixel values, thus representable as a two-dimensional
double array
ADU[y][x] like returned from
astro.fits.FitsTools#getAsArray (note the counter-intuitive indexing
within the array; this stems from the FITS standard.
Passing this to the constructor of this class immediately calculates
I_0, x_c and y_c via the formulars:
I_0=ΣADU_ij,Further calls to
xc=Σ(x_ij·ADU_ij)/I_0,
yc=Σ(y_ij·ADU_ij)/I_0.
#getImageMoment first check, if the moment to
n,k has already been cached, otherwise it is calculated according to
M_nk=Σ(x_ij-xc)n (y_ij-yc)k /I_0
| Nested Class Summary | |
|---|---|
private static class |
ImageMoments.DualIndex
Helper class that combines to integer indices, both hermitian, to a single key. |
static class |
ImageMoments.Focus
This class reads an fits image and calculates the requested image moment. |
| Field Summary | |
|---|---|
private double[][] |
adu
This is the image array, innner index is y!. |
private double |
bias
If a bias is set, only adus above this are considered. |
private Map<ImageMoments.DualIndex,Double> |
cache
Cache is updated at each call to #getImageMoment with no hit. |
private double |
high
The multiplicator to the RN for maximum ADU still considered BG. |
private double |
low
The multiplicator to the RN for minimum ADU still considered BG. |
private double |
readnoise
The standard deviation estimate for background rejection. |
private double |
sum0
Once the image is set, this is the ADU-sum. |
private double |
xc
Once the image is set, this is the center-of-gravity, x coordinate. |
private double |
yc
Once the image is set, this is the center-of-gravity, y coordinate. |
| Constructor Summary | |
|---|---|
ImageMoments(double[][] image)
Takes an image array and readily calculates the count sum plus the center of gravity. |
|
ImageMoments(double[][] image,
double bias,
double rn)
Takes an image array and readily calculates the count sum plus the center of gravity. |
|
ImageMoments(double[][] image,
double bias,
double rn,
double hi,
double lo)
Takes an image array and readily calculates the count sum plus the center of gravity. |
|
| Method Summary | |
|---|---|
private double |
calculateMnk(int n,
int m)
|
Point2D |
getCenter()
Returns xc yc as a Point2D object. |
double |
getMoment(int x0,
int y0)
If the queried moment has not been calculated, we evaluate it by
M_nk=Σ(x_ij-xc) |
void |
setImage(double[][] image,
double bs,
double rn,
double hisig,
double losig)
Sets a new pixel array, erasing the cache, but immediately calculating the new count sum plus center of gravity. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private double[][] adu
private double bias
private double readnoise
private double high
private double low
private double sum0
private double xc
private double yc
private Map<ImageMoments.DualIndex,Double> cache
#getImageMoment with no hit.
| Constructor Detail |
|---|
public ImageMoments(double[][] image)
public ImageMoments(double[][] image,
double bias,
double rn)
public ImageMoments(double[][] image,
double bias,
double rn,
double hi,
double lo)
| Method Detail |
|---|
public void setImage(double[][] image,
double bs,
double rn,
double hisig,
double losig)
public double getMoment(int x0,
int y0)
M_nk=Σ(x_ij-xc)n (y_ij-yc)k /I_0.
The moment is also cached for further queries. The special case with
x0=y0=0 returns the ADU-sum, I_0, while queries with
x0=1,y0=0 or x0=0,y0=1 return the center of gravity coordinate.
x0 - The leading index in M_nky0 - The trailing index in M_nkpublic Point2D getCenter()
private double calculateMnk(int n,
int m)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||