CImCombine:Mean CImCombine:Sum

CImCombine:Median


The Median method merges the pixel values using the median statistic at each location.

Syntax

CImage = CImCombine:Median( CImageSet )

    CImageSet contains the collection of images to be combined.

    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 median of values at the same location in all the images of the CImageSet. Use this method when a number of the images contain non-random outliers, e.g., impulse noise. In order for the median method to work properly, normalization must be done as part of the combining.

Example

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

 

C = CImCombine:new()

-- create a CImCombine object

R = CRect:new(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

I = C:Median( S )

-- 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, CImageSet, CImage, CRect