CStats:Stats CStats:Sum

CStats:StatsStr


The StatsStr method computes the mean, standard deviation, and other basic statistics for numeric data and returns them in a keyed table with each statistic being the key name.

Syntax

tbl = CStats:StatsStr( CImage, CRect )

tbl = CStats:StatsStr( CImage )

tbl = CStats:StatsStr( CArray )

tbl = CStats:StatsStr( table )

bullet.gif    CRect is a bounding rectangle for the CImage object.

bullet.gif    CArray is a CArray object.

bullet.gif    tbl is a 1-dimensional table containing keyed values.

bullet.gif    The returned value tbl is a keyed table containing 8 named members:

bullet.gif      nMean is the mean value.

bullet.gif      nMedian is the median value.

bullet.gif      nSdev is the standard deviation.

bullet.gif      nMin is the minimum value.

bullet.gif      nMax is the maximum value.

bullet.gif      nSkewness is the statistical skewness.

bullet.gif      nKurtosis is the statistical kurtosis.

bullet.gif      nCount is the number of values in the sample.

bullet.gif    On success, tbl is returned.

bullet.gif    On failure, returns nil.

Example

Suppose a CImage I exists. The following script returns the mean and standard deviation of 600 pixels in the corner of the image:

S = new_stats()

-- create a CStats object

t = S:StatsStr( I, new_rect( 10,30,15,35 )

-- computes values inside the CRect

Printf("mean=%lg +/- %lg\n", t.nMean, t.nSdev )

-- list the result

S:delete()

-- when done with S, delete it

Related Topics

CStats class, Stats, CImage class, CRect class, stats function


Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.