You are here: Start » AVL.NET » Function Reference » Image » Image Enhancement » AVL.NormalizeImage

AVL.NormalizeImage

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

C++
C#
 
public static void NormalizeImage
(
	AvlNet.Image inImage,
	float inNewMinimum,
	float inNewMaximum,
	float inSaturateBrightestFraction,
	float inSaturateDarkestFraction,
	AvlNet.Image outImage,
	out float outA,
	out float outB
)

Parameters

Name Type Range Default Description
inImageAvlNet.ImageInput image.
inNewMinimumfloat0.0fDesired minimum value of the resulting image. Default value: 0.0f.
inNewMaximumfloat255.0fDesired maximum value of the resulting image. Default value: 255.0f.
inSaturateBrightestFractionfloat<0.0f, 1.0f>0.0fFraction of the brightest pixels skipped during normalization. Default value: 0.0f.
inSaturateDarkestFractionfloat<0.0f, 1.0f>0.0fFraction of the darkest pixels skipped during normalization. Default value: 0.0f.
outImageAvlNet.ImageRescaled image.
outAfloatMultiplicative parameter of the applied linear transformation of pixel values.
outBfloatAdditive parameter of the applied linear transformation of pixel values.

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\). Please note that the inSaturateBrightestFraction and inSaturateDarkestFraction parameters can be non-zero only for images with UInt8, Int8, UInt16 or Int16 pixel type.

Examples

NormalizeImage run on example image.

Errors

List of possible exceptions:

Error type Description
DomainError Empty image on input in NormalizeImage.
DomainError Region exceeds an input image in NormalizeImage.
DomainError The inSaturationFraction inputs cannot be used for images with this pixel type in NormalizeImage.
DomainError The sum of inSaturateBrightestFraction and inSaturateDarkestFraction can't be greater than 1 in NormalizeImage.

Function Overrides

See also