CStats:GeometricMean
The GeomMean method computes the geometric mean value of a data 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:GeoMean( table, nHigh, nLow ) nMean, nStdDev = CStats:GeoMean( CImage, nHigh, nLow ) nMean, nStdDev = CStats:GeoMean( CImage, nHigh, nLow, CRect ) nMean, nStdDev = CStats:GeoMean( CArray, nHigh, nLow ) nMean, nStdDev = CStats:GeoMean( CArray, nHigh, nLow, CRect ) nMean, nStdDev = CStats:GeoMean( 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. |
nMean and nStdDev are the geometric mean value of the data. On failure, 0,0 is returned.
This method calculates the mean value based on the geometric mean of the sample pixels. This results in pixels being assigned weight that is inversely proportional to their value-distance from the mean. No rejection ("clipping") is performed.
Suppose that CImage object I and CRect object R exist. The following script returns the geometric mean value inside a rectangle on the image:
|
-- create a CStats object |
|
-- return the geometric mean value |
|
-- list the result |
The following script returns the geometric mean value for a table of data:
|
-- create a CStats object |
|
-- create some data in a table |
|
-- list the result |