CImCombine:Sum CImCombine:GeometricMean

CImCombine:ContraMean


The ContaMean method merges the pixel values using the contra-harmonic mean statistic at each location.

Syntax

CImage = CImCombine:ContraMean( CImageSet, power )

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

bullet.gif    power is the exponent of the harmonic mean.

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 contra-harmonic mean of values at the same location in all the images of the CImageSet. This method uses the contra-harmonic mean statistic which 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 values lying above the sample or to values lying below the sample mean. 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 value e, the statistic is computed using a ratio of powers for each sample member x, as shown below. (Note: The symbol ^ denotes raising a number to a power, as in 2^3 = 8):

     Statistic = Sum( x^(e+1)/x^e ).

Thus

bullet.gif    e=0 gives the arithmetic mean.

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

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

Example

Suppose a CImageSet named S exists. The following script combines the images by the ContraMean 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 normalization statistic

C:SetNormMethod("scale")

-- scale to normalize the image set

power = 0.5

-- exponent reduces the weight of negative outliers

I = C:ContraMean(S,power)

-- combine the image set and return a new image

I:Display()

-- show the new image

C:delete()

-- when done with S, remove it 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.