CStats:MaxPix


The MaxPix method returns the pixel coordinates of the maximum value for a data object.

Syntax

x, y = CStats:MaxPix( CImage, CRect )

x, y = CStats:MaxPix( CImage )

x, y = CStats:MaxPix( table )

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

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

bullet.gif    x and y are the pixel coordinates of the maximum value, relative to 1,1.

bullet.gif    On success, returns x and y coordinates as non-zero.

bullet.gif    On failure, returns 0,0.

Example

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

 

S = new_stats()

-- create a CStats object

S:Init( I, R )

-- specify CImage and CRect to measure

x, y = S:MaxPix()

-- get the column and row of the maximum value

Printf("Max at %d,&d\n", x, y )

-- list the result

S:delete()

-- when done with S, remove it from memory

Related Topics

CStats class, Max, MinPix, CImage class, CRect class


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