CStats:YpMean
The YpMean method computes the mean value inside a rectangular region of the image using "Yp Mean" estimation to reduce the influence of deviant pixels. This is described in the Remarks section. The rectangle and image must have been previously initialized for the CStats object.
nMean = CStats:YpMean( nPower ) |
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
Suppose a CImage I and a CRect R exist and that the exponent parameter nPow is assigned a value. The following script fragment returns the Yp Mean value inside a rectangle on the image:
|
-- create a CStats object |
|
-- specify CImage and CRect to measure |
|
-- return the Yp Mean value |
|
-- list the result |
|
-- when done with S, remove it from memory |
CStats , CImage , CRect , GeomMean, ContraMean