Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » Image Enhancement » NormalizeLocalContrast

NormalizeLocalContrast


Normalizes local contrast of the image using Wallis filter.

Name Type Range Description
inMonoImage Image Monochromatic input image
inRoi Region* Range of pixels to be processed
inTargetMean Real Target local mean
inTargetVariance Real 0.1 - Target local variance
inUniformnessScale Integer 1 - + Radius of neighbourhood to uniformize
inBrightnessPreserveRatio Real 0.0 - 1.0 How much of original brightness to be kept
outImage Image Output image

Requirements

For input inMonoImage only pixel formats are supported: 1⨯uint8, 1⨯int8, 1⨯uint16, 1⨯int16, 1⨯int32, 1⨯real.

Read more about pixel formats in Image documentation.

Description

This filter resaturates every pixel of monochromatic image inMonoImage so that its neighbourhood matches approximately average of inTargetMean and variance of inTargetVariance using Wallis algorithm.

Parameter inUniformnessScale determines the radius of the neighbourhood.

Parameter inBrightnessPreserveRatio determines how much of the original brightness is kept on the resulting image.

New value of pixel is given by:

\[ P_{new} = A\ P_{old} + B \]

where

\[B = \frac{Var_{new} }{\frac{90}{CFC} + Var_{loc} } \] \[A = Mean_{loc}(1 - BPR) + Mean_{new}(BPR - B) \]

and

  • \(Dev_{loc}\) and \(Mean_{loc}\) are local deviation and mean respectively, taken from the square neighbourhood of radius inUniformnessScale
  • CFC is Contrast Force Constant, set to \(0.9\)
  • BPR is inBrightnessPreserveRatio

Examples

Example image

Output of NormalizeLocalContrast filter

Previous image with NormalizeImage filter applied to it

Remarks

After the filter is run on the image, the neighbourhoods of pixels do not have desired variance and average. First reason for that is presence of constants BPR and CFC. Second reason is that forcing matching given average would require solving system of as many linear equations as there are pixels on the image.

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError Image depth must be 1 in NormalizeLocalContrast filter

Complexity Level

This filter is available on Basic Complexity Level.