Back to Aurora Vision Library website

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

ResizePixelVectors


Header: AVL.h
Namespace: avl
Module: FoundationBasic

Rescales an image treating pixels as vectors.

Syntax

C++
C#
 
void avl::ResizePixelVectors
(
	const avl::Image& inImage,
	atl::Optional<const avl::Region&> inRoi,
	const float inVectorLength,
	avl::Image& outImage
)

Parameters

Name Type Range Default Description
Input value inImage const Image& Input image
Input value inRoi Optional<const Region&> NIL Region of interest
Input value inVectorLength const float 0.0 - 255.0f Desired vector length after normalization
Output value outImage Image& Rescaled 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.

Errors

List of possible exceptions:

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

See Also

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