CStats:Median
The Median method computes the median value inside a rectangular region of the image. The rectangle and image must have been previously initialized for the CStats object.
nValue, Sdev = CStats:Median() |
On success, returns the median value as a number.
On success, the second returned argument, Sdev, is the standard deviation about nValue
On failure, returns 0, 0.
Suppose a CImage named I and a CRect named R exist. The following script fragment returns the median 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:Median() |
-- returns the median |
Printf("Median=%lg\n", nVal) |
-- list the results |
S:delete() |
-- when done with S, remove it from memory |