check_differencecheck_differenceCheckDifferenceCheckDifferencecheck_difference (Operator)

名称

check_differencecheck_differenceCheckDifferenceCheckDifferencecheck_difference — 逐像素比较两幅图像。

签名

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)

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

HRegion HImage::CheckDifference(const HImage& Pattern, const wchar_t* Mode, Hlong DiffLowerBound, Hlong DiffUpperBound, Hlong GrayOffset, Hlong AddRow, Hlong AddCol) const   ( Windows only)

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)

def check_difference(image: HObject, pattern: HObject, mode: str, diff_lower_bound: int, diff_upper_bound: int, gray_offset: int, add_row: int, add_col: int) -> HObject

描述

check_differencecheck_differenceCheckDifferenceCheckDifferenceCheckDifferencecheck_difference selects from the input image ImageImageImageImageimageimage those pixels ( ), whose gray value difference to the corresponding pixels in PatternPatternPatternPatternpatternpattern is inside (outside) of the interval . The pixels of PatternPatternPatternPatternpatternpattern are translated by with respect to ImageImageImageImageimageimage. Let be the gray value from PatternPatternPatternPatternpatternpattern translated by with respect to .

If the selected mode ModeModeModeModemodemode is 'diff_inside'"diff_inside""diff_inside""diff_inside""diff_inside""diff_inside", a pixel is selected if If the mode is set to 'diff_outside'"diff_outside""diff_outside""diff_outside""diff_outside""diff_outside", a pixel 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.

执行信息

参数

ImageImageImageImageimageimage (input_object)  singlechannelimage(-array) objectHImageHObjectHImageHobject (byte)

Input image.

PatternPatternPatternPatternpatternpattern (input_object)  singlechannelimage(-array) objectHImageHObjectHImageHobject (byte)

Comparison image.

SelectedSelectedSelectedSelectedselectedselected (output_object)  region(-array) objectHRegionHObjectHRegionHobject *

Points in which the two images are similar/different.

ModeModeModeModemodemode (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Mode: return similar or different pixels.

默认值: 'diff_outside' "diff_outside" "diff_outside" "diff_outside" "diff_outside" "diff_outside"

建议值: 'diff_inside'"diff_inside""diff_inside""diff_inside""diff_inside""diff_inside", 'diff_outside'"diff_outside""diff_outside""diff_outside""diff_outside""diff_outside"

DiffLowerBoundDiffLowerBoundDiffLowerBoundDiffLowerBounddiffLowerBounddiff_lower_bound (input_control)  number HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Lower bound of the tolerated gray value difference.

默认值: -5

建议值: 0, -1, -2, -3, -5, -7, -10, -12, -15, -17, -20, -25, -30

值范围: -255 ≤ DiffLowerBound DiffLowerBound DiffLowerBound DiffLowerBound diffLowerBound diff_lower_bound ≤ 255 (lin)

最小增量: 1

建议增量: 2

DiffUpperBoundDiffUpperBoundDiffUpperBoundDiffUpperBounddiffUpperBounddiff_upper_bound (input_control)  number HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Upper bound of the tolerated gray value difference.

默认值: 5

建议值: 0, 1, 2, 3, 5, 7, 10, 12, 15, 17, 20, 25, 30

值范围: -255 ≤ DiffUpperBound DiffUpperBound DiffUpperBound DiffUpperBound diffUpperBound diff_upper_bound ≤ 255 (lin)

最小增量: 1

建议增量: 2

GrayOffsetGrayOffsetGrayOffsetGrayOffsetgrayOffsetgray_offset (input_control)  number HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Offset gray value subtracted from the input image.

默认值: 0

建议值: -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

值范围: -255 ≤ GrayOffset GrayOffset GrayOffset GrayOffset grayOffset gray_offset ≤ 255 (lin)

最小增量: 1

建议增量: 2

AddRowAddRowAddRowAddRowaddRowadd_row (input_control)  point.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Row coordinate by which the comparison image is translated.

默认值: 0

建议值: -200, -100, -20, -10, 0, 10, 20, 100, 200

值范围: -32000 ≤ AddRow AddRow AddRow AddRow addRow add_row ≤ 32000 (lin)

最小增量: 1

建议增量: 1

AddColAddColAddColAddColaddColadd_col (input_control)  point.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Column coordinate by which the comparison image is translated.

默认值: 0

建议值: -200, -100, -20, -10, 0, 10, 20, 100, 200

值范围: -32000 ≤ AddCol AddCol AddCol AddCol addCol add_col ≤ 32000 (lin)

最小增量: 1

建议增量: 1

Complexity

Let be the number of valid pixels. Then the runtime complexity is .

结果

check_differencecheck_differenceCheckDifferenceCheckDifferenceCheckDifferencecheck_difference 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_systemSetSystemSetSystemSetSystemset_system. If necessary, an exception is raised.

可能的后继算子

connectionconnectionConnectionConnectionConnectionconnection, select_shapeselect_shapeSelectShapeSelectShapeSelectShapeselect_shape, reduce_domainreduce_domainReduceDomainReduceDomainReduceDomainreduce_domain, select_grayselect_graySelectGraySelectGraySelectGrayselect_gray, rank_regionrank_regionRankRegionRankRegionRankRegionrank_region, dilation1dilation1Dilation1Dilation1Dilation1dilation1, openingopeningOpeningOpeningOpeningopening

替代算子

sub_imagesub_imageSubImageSubImageSubImagesub_image, dyn_thresholddyn_thresholdDynThresholdDynThresholdDynThresholddyn_threshold

模块

Foundation