HALCON Reference Manual 10.0.2
Table of Contents / Filters / Arithmetic ClassesClassesClasses | | | Operators

abs_diff_imageabs_diff_imageabs_diff_imageAbsDiffImageAbsDiffImage (Operator)

Name

abs_diff_imageabs_diff_imageabs_diff_imageAbsDiffImageAbsDiffImage — Calculate the absolute difference of two images.

Signature

abs_diff_image(Image1, Image2 : ImageAbsDiff : Mult : )

Herror abs_diff_image(const Hobject Image1, const Hobject Image2, Hobject* ImageAbsDiff, double Mult)

Herror T_abs_diff_image(const Hobject Image1, const Hobject Image2, Hobject* ImageAbsDiff, const Htuple Mult)

Herror abs_diff_image(Hobject Image1, Hobject Image2, Hobject* ImageAbsDiff, const HTuple& Mult)

HImage HImage::AbsDiffImage(const HImage& Image2, const HTuple& Mult) const

HImageArray HImageArray::AbsDiffImage(const HImageArray& Image2, const HTuple& Mult) const

void HOperatorSetX.AbsDiffImage(
[in] IHUntypedObjectX* Image1, [in] IHUntypedObjectX* Image2, [out] IHUntypedObjectX*ImageAbsDiff, [in] VARIANT Mult)

IHImageX* HImageX.AbsDiffImage(
[in] IHImageX* Image2, [in] VARIANT Mult)

static void HOperatorSet.AbsDiffImage(HObject image1, HObject image2, out HObject imageAbsDiff, HTuple mult)

HImage HImage.AbsDiffImage(HImage image2, HTuple mult)

HImage HImage.AbsDiffImage(HImage image2, double mult)

Description

abs_diff_imageabs_diff_imageabs_diff_imageAbsDiffImageAbsDiffImage calculates the absolute difference between two images. The gray values g' of the output image ImageAbsDiffImageAbsDiffImageAbsDiffImageAbsDiffimageAbsDiff are calculated from the gray values (g1,g2) of the input images (Image1Image1Image1Image1image1 and Image2Image2Image2Image2image2) as follows:

                g' = |(g1 - g2)| * Mult

If an overflow or an underflow occurs the resulting values are clipped.

Several images can be processed in one call. In this case, both input parameters contain the same number of images which are then processed in pairs. An output image is generated for every pair.

Please note that the runtime of the operator depends on the value of MultMultMultMultmult. For MultMultMultMultmult = 1, a special optimization is used. Since values of MultMultMultMultmult different from 1 cannot yield additional information, MultMultMultMultmult = 1 should be used in applications. All other values of MultMultMultMultmult should only be used for visualization purposes. Additionally, for byte, int1, int2, and uint2 images special optimizations are implemented for MultMultMultMultmult = 1 that use SIMD technology. The actual application of these special optimizations is controlled by the system parameter 'mmx_enable'"mmx_enable""mmx_enable""mmx_enable""mmx_enable" (see set_systemset_systemset_systemSetSystemSetSystem). If 'mmx_enable'"mmx_enable""mmx_enable""mmx_enable""mmx_enable" is set to 'true'"true""true""true""true" (and the SIMD instruction set is available), the internal calculations are performed using SIMD technology.

abs_diff_imageabs_diff_imageabs_diff_imageAbsDiffImageAbsDiffImage can be executed on an OpenCL device for byte, int1, int2, uint2, int4, and real images. However, since for OpenCL 1.0 only single precision floating point is supported for all devices, and not all rounding modes are supported, the OpenCL implementation can produce slightly different results from the scalar or SIMD implementations.

Attention

Note that the acceleration gained by SIMD technology is highest on large, compact input regions. However, in rare cases, the execution of abs_diff_imageabs_diff_imageabs_diff_imageAbsDiffImageAbsDiffImage might take significantly longer with SIMD technology than without, depending on the input region and the capabilities of the hardware. In these cases, the use of SIMD technology can be avoided by set_system(::'mmx_enable','false':)set_system("mmx_enable","false")set_system("mmx_enable","false")SetSystem("mmx_enable","false")SetSystem("mmx_enable","false").

Parallelization

Parameters

Image1Image1Image1Image1image1 (input_object)  (multichannel-)image(-array) objectHImageHImageHImageXHobject (byte* / int1* / int2* / uint2* / int4* / int8 / real*) *allowed for compute devices

Input image 1.

Image2Image2Image2Image2image2 (input_object)  (multichannel-)image(-array) objectHImageHImageHImageXHobject (byte* / int1* / int2* / uint2* / int4* / int8 / real*) *allowed for compute devices

Input image 2.

ImageAbsDiffImageAbsDiffImageAbsDiffImageAbsDiffimageAbsDiff (output_object)  (multichannel-)image(-array) objectHImageHImageHImageXHobject * (byte / int1 / int2 / uint2 / int4 / int8 / real)

Absolute value of the difference of the input images.

MultMultMultMultmult (input_control)  number HTupleHTupleVARIANTHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong) (double / Hlong)

Scale factor.

Default value: 1.0

Suggested values: 1.0, 2.0, 3.0, 4.0

Restriction: Mult > 0

Result

The operator abs_diff_imageabs_diff_imageabs_diff_imageAbsDiffImageAbsDiffImage returns the value 2 (H_MSG_TRUE) if the parameters are correct. The behavior in case of empty input (no input images available) is set via the operator set_system(::'no_object_result',<Result>:)set_system("no_object_result",<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>). If necessary an exception is raised.

Possible Successors

thresholdthresholdthresholdThresholdThreshold

Alternatives

sub_imagesub_imagesub_imageSubImageSubImage

See also

add_imageadd_imageadd_imageAddImageAddImage, scale_imagescale_imagescale_imageScaleImageScaleImage, dyn_thresholddyn_thresholddyn_thresholdDynThresholdDynThreshold

Module

Foundation


Table of Contents / Filters / Arithmetic ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH