CStats:Stats


The Stats method computes the mean, standard deviation, and other basic statistics for numeric data and returns them in an indexed table.

Syntax

tbl = CStats:Stats( CImage, CRect )

tbl = CStats:Stats( CImage )

tbl = CStats:Stats( CArray )

tbl = CStats:Stats( 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 array containing numbers.

bullet.gif    The returned value tbl is an indexed table containing the following 8 values:

bullet.gif      tbl[1] is the mean value returned in table index 1.

bullet.gif      tbl[2] is the median value returned in table index 2.

bullet.gif      tbl[3] is the standard deviation returned in table index 3.

bullet.gif      tbl[4] is the minimum value returned in table index 4.

bullet.gif      tbl[5] is the maximum value returned in table index 5.

bullet.gif      tbl[6] is the statistical skewness returned in table index 6.

bullet.gif      tbl[7] is the statistical kurtosis returned in table index 7.

bullet.gif      tbl[8] is the number of values in the sample returned in table index 8.

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:Stats( I, new_rect( 10,30,15,35 )

-- computes values inside the CRect

Printf("mean=%lg +/- %lg\n", t[1], t[3] )

-- list the result

S:delete()

-- when done with S, delete it

Related Topics

CStats class, StatsStr, CImage class, CRect class, stats function


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