You are here: Start » FIL.NET » Function Reference » Image » Image Enhancement » FIL.NormalizeLocalContrast
Normalizes local contrast of the image using Wallis filter.
Namespace: | FilNet |
---|---|
Assembly: | FIL.NET.dll |
Syntax
public static void NormalizeLocalContrast ( FilNet.Image inMonoImage, NullableRef<FilNet.Region> inRoi, float inTargetMean, float inTargetVariance, int inUniformnessScale, float inBrightnessPreserveRatio, FilNet.Image outImage )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
![]() | inMonoImage | FilNet.Image | Monochromatic input image. | ||
![]() | inRoi | FilNet.NullableRef<FilNet.Region> | Range of pixels to be processed. Default value: ftl::NIL. | ||
![]() | inTargetMean | float | 128.0f | Target local mean. Default value: 128.0f. | |
![]() | inTargetVariance | float | <0.1f, INF> | 90.0f | Target local variance. Default value: 90.0f. |
![]() | inUniformnessScale | int | <1, +INF> | 10 | Radius of neighbourhood to uniformize. Default value: 10. |
![]() | inBrightnessPreserveRatio | float | <0.0f, 1.0f> | 0.1f | How much of original brightness to be kept. Default value: 0.1f. |
![]() | outImage | FilNet.Image | Output image. |
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
\[A = \frac{Var_{new} }{\frac{90}{CFC} + Var_{loc} } \] \[B = Mean_{new}(1 - BPR) + Mean_{loc}(BPR - A) \]and
- \(Dev_{loc}\) and \(Mean_{loc}\) are local deviation and mean respectively, taken from the square neighbourhood of radius inUniformnessScale
- \(Dev_{new}\) and \(Mean_{new}\) are target deviation and mean respectively, inTargetVariance and inTargetMean
- 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
Errors
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Mono image expected on input in NormalizeLocalContrast. |
DomainError | Region exceeds an input image in NormalizeLocalContrast. |
DomainError | Not supported inMonoImage pixel format in NormalizeLocalContrast. Supported formats: 1xUInt8, 1xInt8, 1xUInt16, 1xInt16, 1xInt32, 1xReal. |