Synopsis
Computes image moments (sum, mean, size, angle, etc).
Syntax
imgmoment infile [x_mu] [y_mu] [m_x_y] [phi] [xsig] [ysig] [eccen]
Description
'imgmoment' computes several image statistics based on the distribution of pixel values . This includes the centroid of the pixel values, the sum of the values, and the size and orientation of the pixel values around the centroid.
For an image with pixel values I(x,y), the i-th moment in the X direction and the j-th moment in the Y direction is given by
M_{i,j} = SUM_x SUM_y x^i * y^j * I(x,y)
Thus the M_{0,0} moment is simply the sum of the pixel values. The M_{1,0} moment is the related to the centroid in X direction and M_{0,1} is related to the centroid in the Y direction. The 2nd order moments are used to compute the size/extent of the pixels (the Gaussian sigma equivalent) and the rotation angle, phi, the pixel distribution makes with respect to the X axis.
These are the same calculations performed by the CIAO source detect tools (wavdetect, celldetect, and vtpdetect) to compute the source location, size, and position angle.
Examples
Example 1
imgmoment img.fits[sky=circle(100,100,10)] pget imgmoment x_mu y_mu
Computes the moments of the image in 'img.fits' in the region defined by the specified circle. The centroid (x_mu,y_mu) is then retrieved using the pget utility.
Example 2
imgmoment psf.fits pget imgmoment xsig ysig phi
Determine the size (1-sigma equivalent) and the orientation of the PSF.
Parameters
name | type | ftype | units | reqd |
---|---|---|---|---|
infile | file | input | yes | |
x_mu | real | output | pixels | |
y_mu | real | output | pixels | |
m_x_y | real | output | ||
phi | real | output | deg | |
xsig | real | output | pixels | |
ysig | real | output | pixels | |
eccen | real | output |
Detailed Parameter Descriptions
Parameter=infile (file required filetype=input)
Input 2D image
Parameter=x_mu (real filetype=output units=pixels)
X-centroid (physical coordinates)
Parameter=y_mu (real filetype=output units=pixels)
Y-centroid (physical coordinates)
Parameter=m_x_y (real filetype=output)
The x-th and y-th order moment. m_0_0 is sum of pixel values. x and y go from 0 to 2.
Parameter=phi (real filetype=output units=deg)
Ellipse angle based on moments
The angle is measured from the +X axis to the major axis.
Parameter=xsig (real filetype=output units=pixels)
Standard deviation along the major axis
The image pixels are rotated by phi degrees and the standard deviation is computed. This provides a measure of the size of the pixel distribution in the direction of the major and minor axes.
Parameter=ysig (real filetype=output units=pixels)
Standard deviation along the minor
The image pixels are rotated by phi degrees and the standard deviation is computed. This provides a measure of the size of the pixel distribution in the direction of the major and minor axes.
Parameter=eccen (real filetype=output)
Not currently used.
Bugs
There are no known bugs for this tool.
See Also
- dm
- dmfiltering
- tools::core
- dmappend
- tools::image
- centroid_map, dmfilth, dmimg2jpg, dmimgadapt, dmimgblob, dmimgcalc, dmimgdist, dmimgfilt, dmimghist, dmimgpick, dmimgpm, dmimgproject, dmimgreproject, dmimgthresh, dmmaskbin, dmmaskfill, dmnautilus, dmradar, dmregrid, dmregrid2, energy_hue_map, evalpos, hexgrid, map2reg, merge_too_small, mkregmap, pathfinder, vtbin
- tools::region
- dmcontour, dmellipse, dmimghull, dmimglasso
- tools::response
- mean_energy_map, pileup_map
- tools::statistics
- dmstat, statmap