CStats:YpMean and CStats:YpMeanSdev


The YpMean method computes the mean value for a data object image using "Yp Mean" estimation to reduce the influence of deviant pixels.

Syntax

nMean = CStats:YpMean( CImage, nPower, CRect )

nMean = CStats:YpMean( CImage, nPower )

nMean = CStats:YpMean( table, nPower )

nMean, nSdev = CStats:YpMeanSdev( CImage, nPower, CRect )

nMean, nSdev = CStats:YpMeanSdev( CImage, nPower )

nMean, nSdev = CStats:YpMeanSdev( table, nPower )

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

bullet.gif    nPower specifies the exponent parameter of the Yp Mean.

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

bullet.gif    On success, returns the mean value and standard deviation.

bullet.gif    On failure, returns 0, 0.

Remarks

This method assigns weights to values based upon their distance from the mean value. No rejection ("clipping") is performed. In contrast to the geometric mean, this method can be tuned to assign less weight to positive values or less weight to negative values, and the severity of the weighting scheme may be adjusted. The positive or negative tail bias depends upon the value of the exponent parameter and the severity of the weighting depends upon the absolute value of the exponent parameter.

For an exponent parameter of value y, the statistic is computed by summing each sample member x raised to the power y as shown below. (Note: The symbol ^ denotes raising a number to a power, as in 2^3 = 8):

     Total = Sum(x^y)

The resulting mean value is then re-scaled as

     Statistic = Total^(1/y) . Thus

bullet.gif    p=0 is invalid. Do not use.

bullet.gif    p>0 gives higher weight to positive outliers.

bullet.gif    p<0 gives lower weight to negative outliers.

Example

Suppose a CImage I and a CRect R exist and that the exponent parameter nPow is assigned a value. The following script returns the Yp Mean value inside a rectangle on the image:

S = new_stats()

-- create a CStats object

-- assume CImage and CRect exist

 

nVal = S:YpMean( I, R, nPow )

-- return the Yp Mean value

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

-- list the result

S:delete()

-- when done with S, remove it from memory

Related Topics

CStats class, CImage class, CRect class, GeometricMean, ContraMean


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