Back to Aurora Vision Library website

You are here: Start » Function Reference » Image » Image Combinators » DifferenceImage_Flex

DifferenceImage_Flex


Header: AVL.h
Namespace: avl
Module: FoundationPro

Computes the non-negative distances between corresponding pixel values using tiles.

Applications: Useful for things like comparing an image against a template or for detecting differences between consecutive video frames.

Syntax

C++
C#
 
void avl::DifferenceImage_Flex
(
	const avl::Image& inImage1,
	const avl::Image& inImage2,
	atl::Optional<const avl::Box&> inBox1,
	atl::Optional<const avl::Box&> inBox2,
	int inTileWidth,
	atl::Optional<int> inTileHeight,
	avl::TileTranslationMode::Type inTileTranslationMode,
	const bool inOutputFromColorImage,
	avl::Image& outImage
)

Parameters

Name Type Range Default Description
Input value inImage1 const Image& First input image
Input value inImage2 const Image& Second input image
Input value inBox1 Optional<const Box&> NIL
Input value inBox2 Optional<const Box&> NIL
Input value inTileWidth int 1 - 16
Input value inTileHeight Optional<int> 1 - NIL
Input value inTileTranslationMode TileTranslationMode::Type FourDirections
Input value inOutputFromColorImage const bool False Flag indicating whether to use every channel of the input images separately to compute results or only channels average
Output value outImage Image& Output image

Description

The operation computes the absolute difference between images. First the input images are divided into tiles. Each tile is then considered separately. It is translated by a minimal vector in one of the number of directions (depending on inTileTranslationMode, 4 or 8) and the translation with minimum overall difference between input images in this tile is considered to be the proper one. Finally, the output image values in the tile are computed using the so computed translation and the same formula like in DifferenceImage_Shifted.

In multichannel (color) images each pixel channel is processed separately.

The operation requires that the images being processed have equal format and dimensions, otherwise an error with appropriate description occurs. To obtain an image of desired dimensions one can use ResizeImage or CropImage filter. To alter the pixel type of an image one can use ConvertPixelType filter. ConvertToMultichannel and AverageChannels filters allow to alter the number of image channels.

Examples

DifferenceImage_Flex performed on the sample images with inTileWidth = inTileHeight = 16 and inTileTranslationMode = EightDirections.

Errors

List of possible exceptions:

Error type Description
DomainError Image formats are not the same in DifferenceImage_Flex.
DomainError Image fragments dimensions are not equal in DifferenceImage_Flex.
DomainError Input box exceeds image dimensions in DifferenceImage_Flex.

See Also

  • DifferenceImage – Computes the non-negative distances between corresponding pixel values.
  • SubtractImages – Subtracts two images pixel by pixel. The result is signed.