You are here: Start » AVL.NET » Function Reference » Image » Image Conversions » AVL.AverageChannels_Weighted

AVL.AverageChannels_Weighted

Creates a monochromatic image from weighted averages of the input image channels.

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax

C++
C#
 
public static void AverageChannels_Weighted
(
	AvlNet.Image inImage,
	NullableRef<AvlNet.Region> inRoi,
	int inWeight1,
	int inWeight2,
	int inWeight3,
	int inWeight4,
	AvlNet.Image outImage
)

Parameters

Name Type Range Default Description
inImageAvlNet.ImageInput image.
inRoiAvlNet.NullableRef<AvlNet.Region>Range of pixels to be processed. Default value: atl::NIL.
inWeight1intWeight of the first channel.
inWeight2intWeight of the second channel.
inWeight3intWeight of the third channel.
inWeight4intWeight of the fourth channel.
outImageAvlNet.ImageOutput image.

Description

The operation computes the monochromatic average of the inImage color channels. Average being computed at each pixel is a weighted arithmetic mean.

Weights of the channels are determined by the parameters inWeight1, inWeight2, inWeight3, inWeight4. For images having less than four channels, it is required that weights assigned to non-existing channels equal zero.

Examples

AverageChannels_Weighted run on example image with inWeight1 = 1, inWeight2 = 0, inWeight3 = 0, inWeight4 = 0, which for a RGB image is equivalent to the extraction of the Red channel.

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 Non-zero weight of not existing image channel in AverageChannels_Weighted.
DomainError Region exceeds an input image in AverageChannels_Weighted.
DomainError Sum of weights equals zero in AverageChannels_Weighted.

Function Overrides

See also