CStats:GeometricMean
The GeomMean method computes the mean value inside a rectangular region of the image using the geometric mean to assign lower weight to deviant pixels. The rectangle and image must have been previously initialized for the CStats object.
nMean = CStats:GeoMean() |
On success, returns the geometric mean value as a number.
On failure, returns 0.
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 a CImage named I and a CRect named R exist. The following script fragment returns the geometric 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:GeoMean() |
-- return the geometric mean value |
Printf("mean=%lg\n", nVal) |
-- list the result |
S:delete() |
-- when done with S, remove it from memory |
CStats, CImage, CRect, Mean, SigmaClipMean , ContraMean , YpMean