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

AVL.NormalizeImage(AvlNet.Image, AvlNet.Region, float, float, float, float, AvlNet.Image, float, float, AvlNet.Region)

Rescales an image linearly, so that its minimum becomes inNewMinimum and the maximum of the remaining pixels becomes inNewMaximum.

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax


public static void NormalizeImage(
	AvlNet.Image inImage,
	AvlNet.Region inRoi,
	float inNewMinimum,
	float inNewMaximum,
	float inSaturateBrightestFraction,
	float inSaturateDarkestFraction,
	out AvlNet.Image outImage,
	out float outA,
	out float outB,
	out AvlNet.Region diagLinearNormalizedRegion
)

Parameters

inImage
Type: AvlNet.Image
Input image
inRoi
Type: AvlNet.Region
Range of pixels to be processed, or null.
inNewMinimum
Type: System.Single
Desired minimum value of the resulting image
inNewMaximum
Type: System.Single
Desired maximum value of the resulting image
inSaturateBrightestFraction
Type: System.Single
Fraction of the brightest pixels skipped during normalization
inSaturateDarkestFraction
Type: System.Single
Fraction of the darkest pixels skipped during normalization
outImage
Type: AvlNet.Image
Rescaled image
outA
Type: System.Single
Multiplicative parameter of the applied linear transformation of pixel values
outB
Type: System.Single
Additive parameter of the applied linear transformation of pixel values
diagLinearNormalizedRegion
Type: AvlNet.Region
Region of image that has been linearly normalized

Description

This filter linearly scales the pixel values of an image in order to make the histogram span the desired range of values.

The operation computes the parameters \(A\), \(B\) of the linear transform that scales the image values to the desired range and applies the transform computing the results as follows:

\[ \begin{aligned} outImage[i,j] &= inImage[i,j] \times A + B \\ outA &= A \\ outB &= B \end{aligned} \]

The inSaturateBrightestFraction and inSaturateDarkestFraction parameters can be used to make image normalization independent from salt and pepper noise. The normalization skips a chosen fraction of the brightest and the darkest pixels during counting \(A\) and \(B\). The brightest and darkest pixels are set to inNewMaximum and inNewMinimum respectively, while the rest of the image is linearly scaled. A region of the linear scaling is available on diagLinearNormalizedRegion diagnostic output. For example, setting inSaturateBrightestFraction to 0.01 causes skipping 1 percent of the brightest pixels during counting \(A\) and \(B\).

Examples

NormalizeImage run on example image.

Errors

Error type Description
DomainError Empty image on NormalizeImage input.
DomainError The sum of inSaturateBrightestFraction and inSaturateDarkestFraction can't be greater than 1.

See also