CImCombine:Rank CImCombine:YpMean

CImCombine:WeightedMean


The WeightedMean method combines the images by a weighted mean using an array of weight values.

Syntax

CImage = CImCombine:WeightedMean( CImageSet, CArray )

    CImageSet contains the collection of images to be combined.

    CArray is an array of weight values.

    CImage is a new image created by this method.

    On success, this method returns a new CImage.

    On failure, this method returns nil.

Remarks

Each pixel in the output image is the mean value of all images using an array of weight values. The weights are defined in a CArray. The weights are used as specified and are not normalized. For example, of the CArray has 4 elements with values 1.0, then the Weighted mean gives the same result as the Sum of 4 images. Conversely, if the weights are normalized, with values 0.25, then the result is the same as with the Mean method.

Example

Suppose a CImageSet named S exists. The following script fragment combines the images by the WeightedMean method after the weights are setup in the CArray A. The images are not normalized in this example:

 

C = CImCombine:new()

-- create a CImCombine object

A = CArray:new(4,0.2)

-- initialize weights to 0.2, 0.2, 0.2, 0.2

A[4] = 0.4

-- make the weight of image 4 equal to 0.4

I = C:WeightedMean(S,A)

-- combine image set and return new image

I:Display()

-- show the new image

C:delete()

-- when done with S, remove from memory

A:delete()

-- delete the CArray

Related Topics

CImCombine, CImageSet, CArray, CImage, CRect