CStats:MaxPix
The MaxPix method returns the pixel coordinate of the maximum value inside a rectangular region of the image. The rectangle and image must have been previously initialized for the CStats object.
x, y = CStats:MaxPix() |
x and y are the pixel coordinates of the maximum value, relative to 1,1.
On success, returns x and y coordinates as non-zero.
On failure, returns 0,0.
Suppose a CImage named I and a CRect named R exist. The following script fragment returns the location of the maximum value inside a rectangle:
S = CStats:new() |
-- 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 |