CStats:Sdev
The Sdev method computes the Standard Deviation for the distribution of values in 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.
nStdDev = CStats:Sdev( table ) nStdDev = CStats:Sdev( CImage ) nStdDev = CStats:Sdev( CImage, CRect ) nStdDev = CStats:Sdev( CArray ) nStdDev = CStats:Sdev( CArray, CRect ) nStdDev = CStats:Sdev( CMatrix ) where |
nMeanValue is a target mean value about which the standard deviation is calculated.
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.
nStdDev is the standard deviation of the data. On failure, 0 is returned.
Suppose a CImage I and a CRect R exist. The following script returns the standard deviation relative to the simple arithmetic mean value inside a rectangle on the image:
|
-- create a CStats object |
|
-- return the standard deviation |
|
-- list the results |
The following script returns the standard deviation for a table of data:
|
-- create a CStats object |
|
-- create some data in a table |
|
-- list the result |