CImCombine:WeightedMean


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

Syntax

CImage = CImCombine:WeightedMean( CImageSet, CArray )

bullet.gif    CImageSet contains the collection of images to be combined.

bullet.gif    CArray is a 1-dimensional array of weight values.

bullet.gif    CImage is a new image created by this method.

bullet.gif    On success, this method returns a new CImage.

bullet.gif    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 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 = new_imcombine()

-- create a CImCombine object

A = new_array(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 class

CImageSet class

CImage class

CRect class

 


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.