You are here: Start » Image » Image Combinators » DifferenceImage_Shifted

DifferenceImage_Shifted
Header: | AVL.h |
---|---|
Namespace: | avl |
Computes the non-negative distances between corresponding pixel values.
Applications: Useful for things like comparing an image against a template or for detecting differences between consecutive video frames.
Syntax
void avl::DifferenceImage_Shifted ( const avl::Image& inImage1, const avl::Image& inImage2, const avl::Box& inBox1, const avl::Box& inBox2, avl::Image& outImage )
Parameters
Name | Type | Default | Description | |
---|---|---|---|---|
![]() |
inImage1 | const Image& | First input image | |
![]() |
inImage2 | const Image& | Second input image | |
![]() |
inBox1 | const Box& | ||
![]() |
inBox2 | const Box& | ||
![]() |
outImage | Image& | Output image |
Description
The operation computes the absolute difference between image pixels inside the input boxes. Each outImage pixel is equal to the absolute value of difference between corresponding pixels of the input images:
\[\forall_{i,j} \text{OutImage}_{i,j} = |\text{InImage1}_{i + box1.x,j + box1.y} - \text{InImage2}_{i + box2.x,j + box2.y}|\]
In multichannel (color) images each pixel channel is processed separately.
The operation requires that the images being processed have equal format and the input boxes have equal dimensions, otherwise an error with appropriate description occurs. 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_Shifted performed on the sample images.
Hardware Acceleration
This operation is optimized for SSE2 technology for pixels of types: UINT8, SINT8, UINT16, SINT16, REAL.
This operation is optimized for AVX2 technology for pixels of types: UINT8, SINT8, UINT16, SINT16, REAL.
This operation is optimized for NEON technology for pixels of types: UINT8, SINT8, UINT16, SINT16, SINT32, REAL.
This operation supports automatic parallelization for multicore and multiprocessor systems.
Errors
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Image formats are not the same in DifferenceImage_Shifted. |
DomainError | Input boxes are not completely inside the input images in DifferenceImage_Shifted. |
DomainError | Not equal box dimensions in DifferenceImage_Shifted. |
See Also
- DifferenceImage – Computes the non-negative distances between corresponding pixel values.
- SubtractImages – Subtracts two images pixel by pixel. The result is signed.