TNorm


The TNorm function normalizes a table by scaling all its elements to make its total area or volume equal to 1.0. The table can be a Lua array or a class object of type CImage, CArray, or CMatrix.

Syntax

table = TNorm( table )

CImage = TNorm( CImage )

CArray = TNorm( CArray )

CMatrix = TNorm( CMatrix )

where

    table, CImage, CArray, or CMatrix contains the target data.

    On success, the modified data object is returned, otherwise nil is returned.

Examples

The following script creates a Gaussian normal population of 10,000 numbers with the area under the curve normalized to 1.0.

t = TNorm( TGaussDev(10000) )

-- create a table of 10,000 values and normalize it

  

The next script normalizes a CImage.

V = AttachView( "CImageView" )

-- attach the topmost image window

Assert( V and V:Count() > 0 )

-- make sure an image window is on top

TNorm( V:GetImage() )

-- normalize the CImage

Related Topics

Table Functions

CMatrix:Normalize