ClassesClassesClassesClasses | | | | Operators

check_differencecheck_differenceCheckDifferencecheck_differenceCheckDifferenceCheckDifference (Operator)

Name

check_differencecheck_differenceCheckDifferencecheck_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 CheckDifference(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)

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

HRegion HImage::CheckDifference(const HImage& Pattern, const char* Mode, Hlong DiffLowerBound, Hlong DiffUpperBound, Hlong GrayOffset, Hlong AddRow, Hlong 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_differenceCheckDifferencecheck_differenceCheckDifferenceCheckDifference selects from the input image ImageImageImageImageImageimage those pixels (g_{o} = g_{ImageImageImageImageImageimage}), whose gray value difference to the corresponding pixels in PatternPatternPatternPatternPatternpattern is inside (outside) of the interval [DiffLowerBoundDiffLowerBoundDiffLowerBoundDiffLowerBoundDiffLowerBounddiffLowerBound,DiffUpperBoundDiffUpperBoundDiffUpperBoundDiffUpperBoundDiffUpperBounddiffUpperBound]. The pixels of PatternPatternPatternPatternPatternpattern are translated by (AddRowAddRowAddRowAddRowAddRowaddRow,AddColAddColAddColAddColAddColaddCol) with respect to ImageImageImageImageImageimage. Let g_{p} be the gray value from PatternPatternPatternPatternPatternpattern translated by (AddRowAddRowAddRowAddRowAddRowaddRow,AddColAddColAddColAddColAddColaddCol) with respect to g_{o}.

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

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 ImageImageImageImageImageimage, intersected with the domain of the translated PatternPatternPatternPatternPatternpattern. All points fulfilling the above condition are aggregated in the output region. The two images may be of different size. Typically, PatternPatternPatternPatternPatternpattern is smaller than ImageImageImageImageImageimage.

Parallelization

Parameters

ImageImageImageImageImageimage (input_object)  singlechannelimage(-array) objectHImageHImageHImageHImageXHobject (byte)

Input image.

PatternPatternPatternPatternPatternpattern (input_object)  singlechannelimage(-array) objectHImageHImageHImageHImageXHobject (byte)

Comparison image.

SelectedSelectedSelectedSelectedSelectedselected (output_object)  region(-array) objectHRegionHRegionHRegionHRegionXHobject *

Points in which the two images are similar/different.

ModeModeModeModeModemode (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Mode: return similar or different pixels.

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

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

DiffLowerBoundDiffLowerBoundDiffLowerBoundDiffLowerBoundDiffLowerBounddiffLowerBound (input_control)  number HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (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 diffLowerBound ≤ 255 (lin)

Minimum increment: 1

Recommended increment: 2

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

DiffUpperBoundDiffUpperBoundDiffUpperBoundDiffUpperBoundDiffUpperBounddiffUpperBound (input_control)  number HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (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 diffUpperBound ≤ 255 (lin)

Minimum increment: 1

Recommended increment: 2

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

GrayOffsetGrayOffsetGrayOffsetGrayOffsetGrayOffsetgrayOffset (input_control)  number HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (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 grayOffset ≤ 255 (lin)

Minimum increment: 1

Recommended increment: 2

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

AddRowAddRowAddRowAddRowAddRowaddRow (input_control)  point.y HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (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 addRow ≤ 32000 (lin)

Minimum increment: 1

Recommended increment: 1

AddColAddColAddColAddColAddColaddCol (input_control)  point.x HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (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 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_differenceCheckDifferencecheck_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""no_object_result", 'empty_region_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""store_empty_region" with set_systemset_systemSetSystemset_systemSetSystemSetSystem. If necessary, an exception is raised.

Possible Successors

connectionconnectionConnectionconnectionConnectionConnection, select_shapeselect_shapeSelectShapeselect_shapeSelectShapeSelectShape, reduce_domainreduce_domainReduceDomainreduce_domainReduceDomainReduceDomain, select_grayselect_graySelectGrayselect_graySelectGraySelectGray, rank_regionrank_regionRankRegionrank_regionRankRegionRankRegion, dilation1dilation1Dilation1dilation1Dilation1Dilation1, openingopeningOpeningopeningOpeningOpening

Alternatives

sub_imagesub_imageSubImagesub_imageSubImageSubImage, dyn_thresholddyn_thresholdDynThresholddyn_thresholdDynThresholdDynThreshold

Module

Foundation


ClassesClassesClassesClasses | | | | Operators