CStats:MinMaxClipMean and CStats:MinMaxClipMeanSdev


The MinMaxClipMean method computes the mean value for a data object, after excluding the minimum and maximum values of the set.

Syntax

nMean = CStats:MinMaxClipMean( CImage, CRect )

nMean = CStats:MinMaxClipMean( CImage )

nMean = CStats:MinMaxClipMean( table )

nMean, nSdev = CStats:MinMaxClipMeanSdev( CImage, CRect )

nMean, nSdev = CStats:MinMaxClipMeanSdev( CImage )

nMean, nSdev = CStats:MinMaxClipMeanSdev( table )

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

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

bullet.gif    On success, returns the min/max clipped mean value as a number.

bullet.gif    On failure, returns 0, 0.

Remarks

The calculated statistic excludes the lowest (minimum value) and highest (maximum value) pixels inside the region. Use this method to avoid a biased result when the region is suspected to contain one deviant high value and one deviant low value.

Example

Suppose a CImageI and a CRectR exist. The following script returns the mean value inside a rectangle on the image, discarding the 1 highest pixel value:

S = new_stats()

-- create a CStats object

-- specify CImage and CRect to measure

 

nVal = S:MinMaxClipMean(I, R)

-- returns the mean value

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

-- list the results

S:delete()

-- when done with S, remove it from memory

Related Topics

CStats class, CImage class, CRect class, MinClipMean, MaxClipMean


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