CStats:Max and CStats:MaxXy


The Max method computes the maximum value of a 1-dimensional array, CImage, or list of numbers. The array and list parameters must contain a mixture of numbers and strings that can be converted to numbers. This function is similar to the CStat:Mean method but does not require calling new_stats() beforehand to create a CStats object.

Syntax

nMaxValue = CStats:Max( CImage, CRect )

nMaxValue = CStats:Max( CImage )

nMaxValue = CStats:Max( table )

nMaxValue = CStats:Max( n1, n2, n3, ... )

nMaxValue, nX, nY = CStats:MaxXy( CImage, CRect )

nMaxValue, nX, nY = CStats:MaxXy( CImage )

nMaxValue, nX, nY = CStats:MaxXy( table )

nMaxValue, nX, nY = CStats:MaxXy( n1, n2, n3, ... )

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

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, the maximum value and the x and y coordinates of the maximum value are returned.

bullet.gif    On failure, returns 0, 0, 0.

Example

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

S = new_stats()

-- create a CStats object

-- specify CImage and CRect to measure

 

nVal, nX, nY = S:MaxXy(I, R)

-- returns the maximum value

Printf("Max=%lg at %d,%d\n", nVal, nX, nY)

-- list the result

S:delete()

-- when done with S, remove it from memory

Related Topics

CStats class, MaxPix, Min, CImage class, CRect class


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