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.
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 ) |
CRect is a bounding rectangle for the CImage object.
nPower specifies the exponent parameter of the Yp Mean.
table is a 1-dimensional array containing numbers.
On success, returns the mean value and standard deviation.
On failure, returns 0, 0.
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
p=0 is invalid. Do not use.
p>0 gives higher weight to positive outliers.
p<0 gives lower weight to negative outliers.
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:
|
-- create a CStats object |
-- assume CImage and CRect exist |
|
|
-- return the Yp Mean value |
|
-- list the result |
|
-- when done with S, remove it from memory |
CStats class, CImage class, CRect class, GeometricMean, ContraMean
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.