Back to Adaptive Vision Library website

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

DifferenceImage


Computes the non-negative distances between corresponding pixel values.

Syntax

C++
C#
 
void avl::DifferenceImage
(
	const avl::Image& inImage1,
	const avl::Image& inImage2,
	atl::Optional<const avl::Region&> inRoi,
	avl::Image& outImage
)

Parameters

Name Type Default Description
inImage1 const Image& First input image
inImage2 const Image& Second input image
inRoi Optional<const Region&> NIL Range of pixels to be processed
outImage Image& Output image

Description

The operation computes the absolute difference between images. Each outImage pixel is equal to the absolute value of difference between corresponding pixels of the input images.

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 performed on the sample images.

In-place Processing

This function supports in-place data processing - you can pass the same reference to inImage1 and outImage, inImage2 and outImage

Hardware Acceleration

This operation is optimized for SSE2 technology for pixels of types: UINT8, SINT8, UINT16, SINT16, REAL.

This operation supports automatic parallelization for multicore and multiprocessor systems.

Errors

Error type Description
DomainError Image sizes are not equal in DifferenceImage.
DomainError Image formats are not the same in DifferenceImage.

See Also