CImCombine:WeightedMean

CImCombine:YpMean


The YpMean method merges the pixel values using the mean statistic at each location.

Syntax

CImage = CImCombine:YpMean( CImageSet, power )

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

bullet.gif    power is the exponent applied to the pixel value weights.

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 power-weighted mean of values at the same location in all the images of the CImageSet. This method assigns weights to values based upon their distance from the mean value. No rejection ("clipping") is performed. In contrast to the geometric mean, this method can be tuned to assign less weight to positive values or less weight to negative values, and the severity of the weighting scheme may be adjusted. The positive or negative tail bias depends upon the value of the exponent parameter and the severity of the weighting depends upon the absolute value of the exponent parameter.

For an exponent parameter of valuey, the statistic is computed by summing each sample member xraised to the power yas shown below. (Note: The symbol ^ denotes raising a number to a power, as in2^3 = 8):

     Total = Sum(x^y)

The resulting mean value is then re-scaled as

     Statistic = Total^(1/y) . Thus

bullet.gif    p=0 gives the arithmetic mean.

bullet.gif    p<0 gives lower weight to positive outliers.

bullet.gif    p>0 gives lower weight to negative outliers.

Example

Suppose a CImageSet named S exists. The following script combines the images by the YpMean method after normalizing their luminance by the median statistic computed inside the central 10% of the image:

C = new_imcombine()

-- create a CImCombine object

R = new_rect(10,50,10,50)

-- central 10% of the image

C:SetRelRect( R )

-- specify CImage and CRect to measure

C:SetNormStat("median")

-- use the median as the statistic

C:SetNormMethod("scale")

-- scale to normalize the image set

power = 0.5

-- give lower weight to negative outliers

I = C:YpMean(S,power)

-- combine image set and return new image

I:Display()

-- show the new image

C:delete()

-- when done with S, remove from memory

Related Topics

CImCombine class

CImageSet class

CImage class

CRect class

 


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