You are here: Start » AVL.NET » AVL.NormalizeLocalContrast(AvlNet.Image, AvlNet.Region, float, float, int, float, AvlNet.Image)

AVL.NormalizeLocalContrast(AvlNet.Image, AvlNet.Region, float, float, int, float, AvlNet.Image)

Normalizes local contrast of the image using Wallis filter.

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax


public static void NormalizeLocalContrast(
	AvlNet.Image inMonoImage,
	AvlNet.Region inRoi,
	float inTargetMean,
	float inTargetVariance,
	int inUniformnessScale,
	float inBrightnessPreserveRatio,
	out AvlNet.Image outImage
)

Parameters

inMonoImage
Type: AvlNet.Image
Monochromatic input image
inRoi
Type: AvlNet.Region
Range of pixels to be processed, or null.
inTargetMean
Type: System.Single
Target local mean
inTargetVariance
Type: System.Single
Target local variance
inUniformnessScale
Type: System.Int32
Radius of neighbourhood to uniformize
inBrightnessPreserveRatio
Type: System.Single
How much of original brightness to be kept
outImage
Type: AvlNet.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

\[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

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

See also