HALCON Reference Manual 10.0.2
Table of Contents / Segmentation / Threshold ClassesClassesClasses | | | Operators

check_differencecheck_differencecheck_differenceCheckDifferenceCheckDifference (Operator)

Name

check_differencecheck_differencecheck_differenceCheckDifferenceCheckDifference — Compare two images pixel by pixel.

Signature

check_difference(Image, Pattern : Selected : Mode, DiffLowerBound, DiffUpperBound, GrayOffset, AddRow, AddCol : )

Herror check_difference(const Hobject Image, const Hobject Pattern, Hobject* Selected, const char* Mode, const Hlong DiffLowerBound, const Hlong DiffUpperBound, const Hlong GrayOffset, const Hlong AddRow, const Hlong AddCol)

Herror T_check_difference(const Hobject Image, const Hobject Pattern, Hobject* Selected, const Htuple Mode, const Htuple DiffLowerBound, const Htuple DiffUpperBound, const Htuple GrayOffset, const Htuple AddRow, const Htuple AddCol)

Herror check_difference(Hobject Image, Hobject Pattern, Hobject* Selected, const HTuple& Mode, const HTuple& DiffLowerBound, const HTuple& DiffUpperBound, const HTuple& GrayOffset, const HTuple& AddRow, const HTuple& AddCol)

HRegion HImage::CheckDifference(const HImage& Pattern, const HTuple& Mode, const HTuple& DiffLowerBound, const HTuple& DiffUpperBound, const HTuple& GrayOffset, const HTuple& AddRow, const HTuple& AddCol) const

HRegionArray HImageArray::CheckDifference(const HImageArray& Pattern, const HTuple& Mode, const HTuple& DiffLowerBound, const HTuple& DiffUpperBound, const HTuple& GrayOffset, const HTuple& AddRow, const HTuple& AddCol) const

void HOperatorSetX.CheckDifference(
[in] IHUntypedObjectX* Image, [in] IHUntypedObjectX* Pattern, [out] IHUntypedObjectX*Selected, [in] VARIANT Mode, [in] VARIANT DiffLowerBound, [in] VARIANT DiffUpperBound, [in] VARIANT GrayOffset, [in] VARIANT AddRow, [in] VARIANT AddCol)

IHRegionX* HImageX.CheckDifference(
[in] IHImageX* Pattern, [in] BSTR Mode, [in] Hlong DiffLowerBound, [in] Hlong DiffUpperBound, [in] Hlong GrayOffset, [in] Hlong AddRow, [in] Hlong AddCol)

static void HOperatorSet.CheckDifference(HObject image, HObject pattern, out HObject selected, HTuple mode, HTuple diffLowerBound, HTuple diffUpperBound, HTuple grayOffset, HTuple addRow, HTuple addCol)

HRegion HImage.CheckDifference(HImage pattern, string mode, int diffLowerBound, int diffUpperBound, int grayOffset, int addRow, int addCol)

Description

check_differencecheck_differencecheck_differenceCheckDifferenceCheckDifference selects from the input image ImageImageImageImageimage those pixels (g_{o} = g_{ImageImageImageImageimage}), whose gray value difference to the corresponding pixels in PatternPatternPatternPatternpattern is inside (outside) of the interval [DiffLowerBoundDiffLowerBoundDiffLowerBoundDiffLowerBounddiffLowerBound,DiffUpperBoundDiffUpperBoundDiffUpperBoundDiffUpperBounddiffUpperBound]. The pixels of PatternPatternPatternPatternpattern are translated by (AddRowAddRowAddRowAddRowaddRow,AddColAddColAddColAddColaddCol) with respect to ImageImageImageImageimage. Let g_{p} be the gray value from PatternPatternPatternPatternpattern translated by (AddRowAddRowAddRowAddRowaddRow,AddColAddColAddColAddColaddCol) with respect to g_{o}.

If the selected mode ModeModeModeModemode is 'diff_inside', a pixel g_{o} is selected if

       g_o - g_p - GrayOffset >= DiffLowerBound   and
       g_o - g_p - GrayOffset <= DiffUpperBound.

If the mode is set to 'diff_outside', a pixel g_{o} is selected if

       g_o - g_p - GrayOffset < DiffLowerBound   or
       g_o - g_p - GrayOffset > DiffUpperBound.

This test is performed for all points of the domain (region) of ImageImageImageImageimage, intersected with the domain of the translated PatternPatternPatternPatternpattern. All points fulfilling the above condition are aggregated in the output region. The two images may be of different size. Typically, PatternPatternPatternPatternpattern is smaller than ImageImageImageImageimage.

Parallelization

Parameters

ImageImageImageImageimage (input_object)  image(-array) objectHImageHImageHImageXHobject (byte)

Input image.

PatternPatternPatternPatternpattern (input_object)  image(-array) objectHImageHImageHImageXHobject (byte)

Comparison image.

SelectedSelectedSelectedSelectedselected (output_object)  region(-array) objectHRegionHRegionHRegionXHobject *

Points in which the two images are similar/different.

ModeModeModeModemode (input_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Mode: return similar or different pixels.

Default value: 'diff_outside' "diff_outside" "diff_outside" "diff_outside" "diff_outside"

Suggested values: 'diff_inside'"diff_inside""diff_inside""diff_inside""diff_inside", 'diff_outside'"diff_outside""diff_outside""diff_outside""diff_outside"

DiffLowerBoundDiffLowerBoundDiffLowerBoundDiffLowerBounddiffLowerBound (input_control)  number HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Lower bound of the tolerated gray value difference.

Default value: -5

Suggested values: 0, -1, -2, -3, -5, -7, -10, -12, -15, -17, -20, -25, -30

Typical range of values: -255 ≤ DiffLowerBound DiffLowerBound DiffLowerBound DiffLowerBound diffLowerBound ≤ 255 (lin)

Minimum increment: 1

Recommended increment: 2

Restriction: (-255 <= DiffLowerBound) && (DiffLowerBound <= 255)

DiffUpperBoundDiffUpperBoundDiffUpperBoundDiffUpperBounddiffUpperBound (input_control)  number HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Upper bound of the tolerated gray value difference.

Default value: 5

Suggested values: 0, 1, 2, 3, 5, 7, 10, 12, 15, 17, 20, 25, 30

Typical range of values: -255 ≤ DiffUpperBound DiffUpperBound DiffUpperBound DiffUpperBound diffUpperBound ≤ 255 (lin)

Minimum increment: 1

Recommended increment: 2

Restriction: (-255 <= DiffUpperBound) && (DiffUpperBound <= 255)

GrayOffsetGrayOffsetGrayOffsetGrayOffsetgrayOffset (input_control)  number HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Offset gray value subtracted from the input image.

Default value: 0

Suggested values: -30, -25, -20, -17, -15, -12, -10, -7, -5, -3, -2, -1, 0, 1, 2, 3, 5, 7, 10, 12, 15, 17, 20, 25, 30

Typical range of values: -255 ≤ GrayOffset GrayOffset GrayOffset GrayOffset grayOffset ≤ 255 (lin)

Minimum increment: 1

Recommended increment: 2

Restriction: (-255 <= GrayOffset) && (GrayOffset <= 255)

AddRowAddRowAddRowAddRowaddRow (input_control)  point.y HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Row coordinate by which the comparison image is translated.

Default value: 0

Suggested values: -200, -100, -20, -10, 0, 10, 20, 100, 200

Typical range of values: -32000 ≤ AddRow AddRow AddRow AddRow addRow ≤ 32000 (lin)

Minimum increment: 1

Recommended increment: 1

AddColAddColAddColAddColaddCol (input_control)  point.x HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Column coordinate by which the comparison image is translated.

Default value: 0

Suggested values: -200, -100, -20, -10, 0, 10, 20, 100, 200

Typical range of values: -32000 ≤ AddCol AddCol AddCol AddCol addCol ≤ 32000 (lin)

Minimum increment: 1

Recommended increment: 1

Complexity

Let A be the number of valid pixels. Then the runtime complexity is O(A).

Result

check_differencecheck_differencecheck_differenceCheckDifferenceCheckDifference returns 2 (H_MSG_TRUE) if all parameters are correct. The behavior with respect to the input images and output regions can be determined by setting the values of the flags 'no_object_result'"no_object_result""no_object_result""no_object_result""no_object_result", 'empty_region_result'"empty_region_result""empty_region_result""empty_region_result""empty_region_result", and 'store_empty_region'"store_empty_region""store_empty_region""store_empty_region""store_empty_region" with set_systemset_systemset_systemSetSystemSetSystem. If necessary, an exception is raised.

Possible Successors

connectionconnectionconnectionConnectionConnection, select_shapeselect_shapeselect_shapeSelectShapeSelectShape, reduce_domainreduce_domainreduce_domainReduceDomainReduceDomain, select_grayselect_grayselect_graySelectGraySelectGray, rank_regionrank_regionrank_regionRankRegionRankRegion, dilation1dilation1dilation1Dilation1Dilation1, openingopeningopeningOpeningOpening

Alternatives

sub_imagesub_imagesub_imageSubImageSubImage, dyn_thresholddyn_thresholddyn_thresholdDynThresholdDynThreshold

Module

Foundation


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