CStats:Median and CStats:MedianSdev


The Median method computes the median value a data object or a list of numbers. The array and list parameters must contain a mixture of numbers and strings that can be converted to numbers.

Syntax

nMedian = CStats:Median( CImage, CRect )

nMedian = CStats:Median( CImage )

nMedian = CStats:Median( table )

nMedian = CStats:Median( n1,n2, n3, ... )

nMedian, Sdev = CStats:MedianSdev( CImage, CRect )

nMedian, Sdev = CStats:MedianSdev( CImage )

nMedian, Sdev = CStats:MedianSdev( table )

nMedian, Sdev = CStats:MedianSdev( n1,n2, n3, ... )

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

bullet.gif    table is a 1-dimensional array containing numbers.

bullet.gif    n1, n2, n3, ... are numbers or string values that can be converted to numbers.

bullet.gif    On success, returns the median and standard deviation.

bullet.gif    On failure, returns 0, 0.

Example

Suppose a CImage named I and a CRect named R exist. The following script returns the median inside a rectangle on the image:

S = new_stats()

-- create a CStats object

-- specify CImage and CRect to measure

 

nVal = S:Median(I, R)

-- returns the median

Printf("Median=%lg\n", nVal)

-- list the results

S:delete()

-- when done with S, remove it from memory

Related Topics

CStats class, Rank, CImage class, CRect class


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