Description

Performs a local histogram equalization on an image.

Return Type

A McImage object.  

The resulting McImage.

Syntax

object.LocalEqualization (WindowSize, Step, [StdDev], [EqualizationType], [vSourceImg])

The LocalEqualization Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McEnhance.
WindowSizeRequired. A Long value.

Size of the square window for the local histogram calculation. This value must be 2 or more; 30 to 50 would be a typical value for many images. At AOI borders, the histogram is partially based on reflected pixel values.

StepRequired. A Long value.

Number of pixels to move before updating the local histogram. This value is forced to be no larger than WindowSize. Larger values speed up the algorithm at the cost of a less smooth result. Values of about one fifth the WindowSize will usually provide a decent compromise.

StdDevOptional. A Double value.

Plus and minus number of standard deviations for the mcleqStdDev method EqualizationType. For other EqualizationType methods the argument is unused. The mcleqStdDev method remaps pixel values from the local histogram mean minus StdDev standard deviations to the mean plus that amount onto McImage.RangeMin to McImage.RangeMax. Thus smaller values (less than about 1.5) of this argument produce more contrast enhancement, and larger values will eventually produce contrast flattening. A value of about 1.5 will have little apparent effect. The default value of 1.0 will usually give a suitable local contrast enhancement.

EqualizationTypeOptional. A mcLocalEqType enumeration, as described in settings.

Type of equalization performed. If not given, mcleqLinear is used.

vSourceImgOptional. A Variant value.

Optional input IMcImage.

Settings

The settings for EqualizationType are:

ConstantValueDescription
 mcleqLinear1

Linear histogram equalization, spreading the intensity histogram evenly from minimum to maximum values.

 mcleqBell2

The redistributed histogram will have a Gaussian bell shape.

 mcleqLog3

The histogram will be given an exponential distribution.

 mcleqExponential4

The histogram will be given a logarithmic distribution.

 mcleqBestFit5

A linear contrast enhancement will be performed based on the minimum and maximum intensities in the local histogram window. All pixel values within the histogram are linearly mapped from the histogram minimum to maximum onto McImage.RangeMin to McImage.RangeMax.

 mcleqStdDev6

A linear contrast enhancement will be performed based on the average value in the window plus and minus the standard deviation specified in the StdDev argument. All pixel values within this range are linearly mapped onto McImage.RangeMin to McImage.RangeMax, with values outside the range clipped to those limits. This provides results similar to mcleqBestFit, with less sensitivity to outlier pixel values.

Remarks

This filter is a contrast enhancement operator. The local histogram is calculated around a pixel and based upon that histogram the current pixel value is updated. The result is an image where small details are enhanced relative to their local neighborhood.

The local equalization is performed using a 256 bin histogram. Thus for images with pixel bit depths higher than 8-bits, the result will be quantized to 256 steps from McImage.RangeMin to McImage.RangeMax.

Exceptions

The exception mceINVALIDARG (E_INVALIDARG) will be thrown if one of the parameters is invalid.