Back to Aurora Vision Library website

You are here: Start » Function Reference » Image » Image Conversions » AverageChannels_Weighted

AverageChannels_Weighted


Header: AVL.h
Namespace: avl
Module: FoundationLite

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

Syntax

C++
C#
 
void avl::AverageChannels_Weighted
(
	const avl::Image& inImage,
	atl::Optional<const avl::Region&> inRoi,
	int inWeight1,
	int inWeight2,
	int inWeight3,
	int inWeight4,
	avl::Image& outImage
)

Parameters

Name Type Default Description
Input value inImage const Image& Input image
Input value inRoi Optional<const Region&> NIL Range of pixels to be processed
Input value inWeight1 int Weight of the first channel
Input value inWeight2 int Weight of the second channel
Input value inWeight3 int Weight of the third channel
Input value inWeight4 int Weight of the fourth channel
Output value outImage Image& Output 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.

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.

See Also

  • AverageChannels – Creates a monochromatic image by averaging the input image channels.
  • MixChannels – Calculates a linear combination of image channels.