check_differenceCheckDifferenceCheckDifferencecheck_differencecheck_difference
説明
check_differenceCheckDifferenceCheckDifferencecheck_differencecheck_difference — ピクセルごとに 2 つの画像を比較する。
書式
check_difference( image Image, image Pattern, out region Selected, string Mode, number DiffLowerBound, number DiffUpperBound, number GrayOffset, point.y AddRow, point.x 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 )static void HOperatorSet.CheckDifference( HObject image, HObject pattern, out HObject selected, HTuple mode, HTuple diffLowerBound, HTuple diffUpperBound, HTuple grayOffset, HTuple addRow, HTuple 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
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 )
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)
HRegion HImage.CheckDifference( HImage pattern, string mode, int diffLowerBound, int diffUpperBound, int grayOffset, int addRow, int addCol )
説明
check_differenceCheckDifference は入力画像 Imageimageimage から、
Patternpatternpattern 内の対応するピクセルに対するグレイ値の差が間隔
\([\textrm{DiffLowerBound}, \textrm{DiffUpperBound}]\). の内側(外側)に
あるピクセル(\(g_{o} = g_{\textrm{Image}}\))を選択します。
Patternpatternpattern のピクセルは、Imageimageimage に関する
\((\textrm{AddRow},\textrm{AddCol})\)
によって移動します。\(g_{p}\) を \(g_{o}\)
に関する \((\textrm{AddRow},\textrm{AddCol})\) によって移動し
た Patternpatternpattern からのグレイ値であるとします。
選択されたモード Modemodemode が 'diff_inside'"diff_inside"であ
るとき、ピクセル \(g_{o}\) が選ばれます。
\[\begin{eqnarray*}
g_o - g_p - \textrm{GrayOffset} \ge \textrm{DiffLowerBound} & &
\mbox{\rm and} \\
g_o - g_p - \textrm{GrayOffset} \le \textrm{DiffUpperBound}. & &
\end{eqnarray*}\]
また、モードが 'diff_outside'"diff_outside"であるとき、ピクセル \(g_{o}\) が選ばれます。
g_o - g_p - GrayOffset < DiffLowerBound もしくは
g_o - g_p - GrayOffset > DiffUpperBound.
このテストは、移動した Patternpatternpattern の領域との共通部分である
Imageimageimage に関する領域のすべての点に対して実行されます。上述
の条件を満足するすべての点が出力領域内に集められます。2 つの画像は
異なる大きさをもつことが可能です。通常 Patternpatternpattern は
Imageimageimage より小さいです。
実行情報
実行情報
パラメーター
Imageimageimage (input_object) singlechannelimage(-array) → object (byte)HObject (byte)HImage (byte)HObject (byte)Hobject (byte)
入力画像
Patternpatternpattern (input_object) singlechannelimage(-array) → object (byte)HObject (byte)HImage (byte)HObject (byte)Hobject (byte)
比較画像
Selectedselectedselected (output_object) region(-array) → objectHObjectHRegionHObjectHobject *
2 つの画像が類似しているあるいは異なる点
Modemodemode (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)
類似したあるいは異なるピクセルを返すかの選択
初期値: 'diff_outside'"diff_outside"
推奨値: 'diff_inside', 'diff_outside'"diff_inside", "diff_outside"
DiffLowerBounddiffLowerBounddiff_lower_bound (input_control) number → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)
許容するグレイ値の差の下限
初期値: -5-5
推奨値: 0, -1, -2, -3, -5, -7, -10, -12, -15, -17, -20, -25, -300, -1, -2, -3, -5, -7, -10, -12, -15, -17, -20, -25, -30
値域: -255 ≤ DiffLowerBound ≤ 255 (lin)
最小増分: 1
推奨増分: 2
DiffUpperBounddiffUpperBounddiff_upper_bound (input_control) number → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)
許容するグレイ値の差の上限
初期値: 55
推奨値: 0, 1, 2, 3, 5, 7, 10, 12, 15, 17, 20, 25, 300, 1, 2, 3, 5, 7, 10, 12, 15, 17, 20, 25, 30
値域: -255 ≤ DiffUpperBound ≤ 255 (lin)
最小増分: 1
推奨増分: 2
GrayOffsetgrayOffsetgray_offset (input_control) number → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)
入力画像から引くグレイ値のオフセット
初期値: 00
推奨値: -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-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 ≤ 255 (lin)
最小増分: 1
推奨増分: 2
AddRowaddRowadd_row (input_control) point.y → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)
Pattern の行座標移動量
初期値: 00
推奨値: -200, -100, -20, -10, 0, 10, 20, 100, 200-200, -100, -20, -10, 0, 10, 20, 100, 200
値域: -32000 ≤ AddRow ≤ 32000 (lin)
最小増分: 1
推奨増分: 1
AddColaddColadd_col (input_control) point.x → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)
Patternの列座標移動量
初期値: 00
推奨値: -200, -100, -20, -10, 0, 10, 20, 100, 200-200, -100, -20, -10, 0, 10, 20, 100, 200
値域: -32000 ≤ AddCol ≤ 32000 (lin)
最小増分: 1
推奨増分: 1
複雑性
有効なピクセル数を \(A\) とします。その場合、実行時間は
\(O(A)\) です。
結果
check_differenceCheckDifference は、すべてのパラメーターが正しい場合に
2 (H_MSG_TRUE) を返します。入力画像と出力領域に関する動作は、
set_systemSetSystem でフラグ 'no_object_result'"no_object_result"、
'empty_region_result'"empty_region_result"、および
'store_empty_region'"store_empty_region" の値を設定することによって決定されま
す。
必要に応じて、例外が発生します。
他のオペレーターとの組み合わせ
組み合わせ
後処理の候補
connectionConnection, select_shapeSelectShape, reduce_domainReduceDomain, select_graySelectGray, rank_regionRankRegion, dilation1Dilation1, openingOpening
他の選択候補
sub_imageSubImage, dyn_thresholdDynThreshold
モジュール
Foundation