CStats:MaxClipMean CStats:MeanSdev

CStats:Mean


The Mean method computes the mean value inside a rectangular region of the image. The rectangle and image must have been previously initialized for the CStats object.

Syntax

nMean = CStats:Mean()

    On success, returns the mean value as a number.

    On failure, returns 0.

Example

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

 

S = CStats:new()

-- create a CStats object

S:Init( I, R )

-- specify CImage and CRect to measure

nVal = S:Mean()

-- returns the mean value

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

-- list the result

S:delete()

-- when done with S, remove it from memory

Related Topics

CStats, CImage, CRect