CStats:Mean CStats:Median

CStats:MeanSdev


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

Syntax

nMean, Sdev = CStats:MeanSdev()

    On success, returns 2 numbers: the mean value and the standard deviation.

    On failure, returns 0, 0.

Example

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

 

S = CStats:new()

-- create a CStats object

S:Init( I, R )

-- specify CImage and CRect to be measured

nMean, nSdev = S:MeanSdev()

-- returns the mean and standard deviation

Printf("mean=%lg,sdev=%lg\n", nMean, nSdev)

-- list the results

S:delete()

-- when done with S, remove it from memory

Related Topics

CStats, CImage, CRect