CStats:RankClipMean
The RankClipMean method computes the mean value inside a rectangular region of the image, clipping pixel values below and above the specified rank percentiles. The rectangle and image must have been previously initialized for the CStats object.
nMean = CStats:RankClipMean( nHigh, nLow ) |
wherenHigh and nLow are percentile values in the range 0 to 100. See Remarks, below.
On success, returns the rank-clipped mean value as a number.
On failure, returns 0.
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 argumentsnLow=5 and nHigh=95 calculates the region mean value after rejecting data in both the lower 5 percentile and the upper 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:
S = CStats:new() |
-- create a CStats object |
S:Init( I, R ) |
-- specify CImage and CRect to measure |
nVal = S:RankClipMean(95,5) |
-- mean value between 5th and 95th percentile |
Printf("mean=%lg\n", nVal) |
-- list the results |
CStats, CImage, CRect, MinMaxClipMean, SigmaClipMean, AlphaClipMean