CStats:MinMaxClipMean CStats:RankClipMean

CStats:MtmSigmaClipMean


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 rectangle and image must have been previously initialized for the CStats object.

Syntax

nMean = CStats:MtmSigmaClipMean( nSigmaHigh, nSigmaLow )

    where nSigmaHigh is the number of sigmas at which to clip above the distribution.

    where nSigmaLow is the number of sigmas at which to clip below the distribution.

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

    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 the MtmSigmaClip method of 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 = CStats:new()

-- create a CStats object

S:Init( I, R )

-- specify CImage and CRect to measure

nMean = S:MtmSigmaClipMean( 3, 5 )

-- clips 3 sigmas above and 5 sigmas below

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

-- list the results

S:delete()

-- when done with S, remove it from memory

Related Topics

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