CStats:MinMaxClipMean CStats:new

CStats:MtmSigmaClipMean and CStats:MtmSigmaClipMeanSdev


The MtmSigmaClipMean method computes the mean value inside a rectangular region of the image, using the modified trimmed mean method for removing deviant values from the statistic. The clipping is described by 3 parameters nHigh, nLow, and nIter. These specify the number of sigmas above, number of sigmas below, and number of iterations, respectively. Typical values are 3, 3, 3.

Syntax

nMean = CStats:MtmSigmaClipMean( CImage, nHigh, nLow, nIter, CRect )

nMean = CStats:MtmSigmaClipMean( CImage, nHigh, nLow, nIter )

nMean = CStats:MtmSigmaClipMean( table, nHigh, nLow, nIter )

nMean, nSdev = CStats:MtmSigmaClipMeanSdev( CImage, nHigh, nLow, nIter, CRect )

nMean, nSdev = CStats:MtmSigmaClipMeanSdev( CImage, nHigh, nLow, nIter )

nMean, nSdev = CStats:MtmSigmaClipMeanSdev( table, nHigh, nLow, nIter )

bullet.gif    CImage is an image object.

bullet.gif    table is a 1-dimensional array containing numbers.

bullet.gif    CRect is a bounding rectangle for the CImage object.

bullet.gif    nHigh is the number of sigmas at which to clip above the distribution.

bullet.gif    nLow is the number of sigmas at which to clip below the distribution.

bullet.gif    nIter is the number of iterations of clipping, usually 3 to 5.

bullet.gif    On success, this method returns the MTM clipped mean value as a number.

bullet.gif    On failure, returns 0.

Remarks

The MTM Mean is a "Modified Trimmed Mean" which removes deviant values relative to the Median, rather than the Mean of the sample distribution. The returned value is the mean of the final sample of non-rejected points. This algorithm trims bad data away from the mean value using the standard deviation and median value in an iterative fashion. Use this method to reduce the biased result when the region contains a large percentage of deviant pixel values. This method uses the same algorithm as MtmSigmaClip in the CImCombine class.

Example

Suppose a CImage I and a CRect R exist. The following script returns the MTM clipped mean value inside a rectangle on the image. The clipping is done at 3 sigmas above the mean and 5 sigmas below the mean:

S = new_stats()

-- create a CStats object

-- specify CImage and CRect to measure

 

nMean = S:MtmSigmaClipMean( I,3,5,2,R )

-- clip 3 sigmas above, 5 sigmas below, 2 iterations

Printf("mean=%lg\n", nMean )

-- list the results

S:delete()

-- when done with S, remove it from memory

Related Topics

CStats class, CImage class, CRect class, MinMaxClipMean, SigmaClipMean, RankClipMean, AlphaClipMean


Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.