You are here: Start » AVL.NET » Function Reference » Image » Image Vector Transforms » AVL.ResizePixelVectors

AVL.ResizePixelVectors

Rescales an image treating pixels as vectors.

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax

C++
C#
 
public static void ResizePixelVectors
(
	AvlNet.Image inImage,
	NullableRef<AvlNet.Region> inRoi,
	float inVectorLength,
	AvlNet.Image outImage
)

Parameters

Name Type Range Default Description
inImageAvlNet.ImageInput image.
inRoiAvlNet.NullableRef<AvlNet.Region>Region of interest. Default value: atl::NIL.
inVectorLengthfloat<0.0f, INF>255.0fDesired vector length after normalization. Default value: 255.0f.
outImageAvlNet.ImageRescaled image.

Description

The filter treats pixels as a vector (each channel value as a coordinate). The operation scales pixels values to desired vector length:

\[ \begin{aligned} \lvert \lvert Pixel \rvert \rvert &= \sqrt{Pixel.X^2 + Pixel.Y^2 + Pixel.Z^2 + Pixel.W^2}\\ Pixel.X &= \frac{Pixel.X}{\lvert \lvert Pixel \rvert \rvert}\cdot inVectorLength\\ Pixel.Y &= \frac{Pixel.Y}{\lvert \lvert Pixel \rvert \rvert}\cdot inVectorLength\\ Pixel.Z &= \frac{Pixel.Z}{\lvert \lvert Pixel \rvert \rvert}\cdot inVectorLength\\ Pixel.W &= \frac{Pixel.W}{\lvert \lvert Pixel \rvert \rvert}\cdot inVectorLength \end{aligned} \]

Remarks

If a vector length of a pixel from an input image is zero, the output value equals zero.

If computed channel value exceeds its range, it is cut to maximal allowed value. Therefore the resulting vector length can be smaller than desired.

Computed values are rounded down to the next integer for integer pixel types.

Hardware Acceleration

This operation supports automatic parallelization for multicore and multiprocessor systems.

Hardware acceleration settings may be manipulated with Settings class.

Errors

List of possible exceptions:

Error type Description
DomainError Region exceeds an input image in ResizePixelVectors.

Function Overrides

See also