CStats:RankClipMean CStats:SigmaClipMean

CStats:Sdev


The Sdev method computes the standard deviation inside a rectangular region of the image. This may be computed against a calculated mean value or you may specify the mean value. The rectangle and image must have been previously initialized for the CStats object.

Syntax

nMean = CStats:Sdev()

nMean = CStats:Sdev( nMean )

    On success, returns the standard deviation as a number.

    On failure, returns 0.

Remarks

If you call this method with no arguments, the mean value will be calculated in order to compute the standard deviation. This equivalent to using the class Mean method.

If you call this method with a mean value argument, that mean value will be used in computing the standard deviation. This mean value might have been obtained using one of the CStats methods like Median, SigmaClipMean , or others.

Example

Example 1: Suppose a CImage I and a CRect R exist. The following script fragment returns the standard deviation relative to the simple arithmetic 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

nSdev = S:Sdev()

-- return the standard deviation

Printf("Sdev=%lg\n", nSdev)

-- list the results

S:delete()

-- when done with S, remove it from memory

Example 2: The following script fragment returns the standard deviation relative to a specified 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

nSdev = S:Sdev( nMean )

-- return the standard deviation relative to nMean

Printf("Sdev=%lg\n", nSdev)

-- list the results

S:delete()

-- when done with S, remove it from memory

Related Topics

CStats, CImage, CRect