CStats:RankClipMean
The RankClipMean method computes the mean and standard deviation for a data sample, excluding thenHigh highest and nLow lowest values from the sample. The sample may be a Lua table or a class object of type CImage, CArray, or CMatrix. For CImage and CMatrix objects, an optional CRect object can be used to define the points used in the calculation.
nMean, nStdDev = CStats:RankClipMean( table, nHigh, nLow ) nMean, nStdDev = CStats:RankClipMean( CImage, nHigh, nLow ) nMean, nStdDev = CStats:RankClipMean( CImage, nHigh, nLow, CRect ) nMean, nStdDev = CStats:RankClipMean( CArray, nHigh, nLow ) nMean, nStdDev = CStats:RankClipMean( CArray, nHigh, nLow, CRect ) nMean, nStdDev = CStats:RankClipMean( CMatrix, nHigh, nLow ) where |
table is a lua table containing the data.
CImage, CArray, and CMatrix are class objects containing the data to measure,
CRect is a CRect rectangle object that defines the region to measure.
nHigh and nLow specify the high and low percentiles in the range 0 through 100.
nMean and nStdDev are the rank-clipped mean and standard deviation of the data. On failure, 0,0 is returned.
The calculated statistic computes the mean value using data above a low percentile and below a high percentile rank. These rank percentiles are absolute on the scale 0 to 100 percent. For example, passing the argumentsnHigh=95 and nLow=5 calculates the region mean value after excluding values in both the upper 5 percentile and the lower 5 percentile of the sample.
This method uses the same algorithm as the RankClip method of the CImCombine class.
Suppose a CImage I and a CRect R exist. The following script returns the rank clipped mean value inside a rectangle on the image. Clipping is done at the 95th percentile and 3rd percentile:
|
-- create a CStats object |
|
-- mean value between 5th and 95th percentile |
|
-- list the results |
The following script returns the rank-clipped mean value for a table of data. Clipping is done at the 95th percentile and 3rd percentile:
|
-- create a CStats object |
|
-- create some data in a table |
|
-- list the result |