Skip to content

binary_thresholdBinaryThresholdBinaryThresholdbinary_thresholdbinary_threshold🔗

説明🔗

binary_thresholdBinaryThresholdBinaryThresholdbinary_thresholdbinary_threshold — バイナリしきい値を使用して画像を分割する。

書式🔗

binary_threshold( image Image, out region Region, string Method, string LightDark, out number UsedThreshold )void BinaryThreshold( const HObject& Image, HObject* Region, const HTuple& Method, const HTuple& LightDark, HTuple* UsedThreshold )static void HOperatorSet.BinaryThreshold( HObject image, out HObject region, HTuple method, HTuple lightDark, out HTuple usedThreshold )def binary_threshold( image: HObject, method: str, light_dark: str ) -> Tuple[HObject, Sequence[Union[str, int]]]

def binary_threshold_s( image: HObject, method: str, light_dark: str ) -> Tuple[HObject, Union[str, int]]Herror binary_threshold( const Hobject Image, Hobject* Region, const char* Method, const char* LightDark, Hlong* UsedThreshold )

Herror T_binary_threshold( const Hobject Image, Hobject* Region, const Htuple Method, const Htuple LightDark, Htuple* UsedThreshold )

HRegion HImage::BinaryThreshold( const HString& Method, const HString& LightDark, HTuple* UsedThreshold ) const

HRegion HImage::BinaryThreshold( const HString& Method, const HString& LightDark, Hlong* UsedThreshold ) const

HRegion HImage::BinaryThreshold( const char* Method, const char* LightDark, Hlong* UsedThreshold ) const

HRegion HImage::BinaryThreshold( const wchar_t* Method, const wchar_t* LightDark, Hlong* UsedThreshold ) const (Windows only)

HRegion HImage.BinaryThreshold( string method, string lightDark, out HTuple usedThreshold )

HRegion HImage.BinaryThreshold( string method, string lightDark, out int usedThreshold )

説明🔗

binary_thresholdBinaryThreshold は、自動的に決定されたグローバルなしきい 値を使用して単一チャンネル Imageimageimage を分割し、 Regionregionregion に分割された領域を返します。これは、たとえば、均一 的に明るい背景の文字の分割に役立ちます。binary_thresholdBinaryThreshold は UsedThresholdusedThresholdused_threshold に、使用されたしきい値も返します。

使用されたしきい値は、Methodmethodmethod に提供されるメソッドによって 決定されます。現在、このオペレーターは、 'max_separability'"max_separability" と 'smooth_histo'"smooth_histo" の 2 つのメ ソッドを提供します。 どちらのメソッドも、二峰性ヒストグラムのある画像のみに対して使用す る必要があります。

メソッド 'smooth_histo'"smooth_histo" は、オペレーター bin_thresholdBinThreshold によって提供されるものと同じ機能を提供しま す。メソッド 'max_separability'"max_separability" は、 UsedThresholdusedThresholdused_threshold に対してより小さい値を決定する傾向がありま す。また、残りのスペクトラムからは程遠いヒストグラムにある細く孤立 したピークには感受性が低く、多くの場合、'smooth_histo'"smooth_histo" よ りも高速になります。

最大限の分離🔗

Methodmethodmethod = 'max_separability'"max_separability" を選択することで、 Otsu(参考文献を参照)に応じてグレイレベルのヒストグラムに基づく自 動しきい値が呼び出されます。このアルゴリズムは、最初に画像のヒスト グラムを計算し、次に統計モーメントを使用して、ピクセルを前景および 背景に分割する最適なしきい値 \(T^{*}\) を見つけて、 これらの 2 つのクラス間の可分性を最大化します。このメソッドは、バ イト画像と uint2 画像のみに対して使用できます。

  • LightDarklightDarklight_dark = 'light'"light" の場合は、 \(T^{*}\) 以上のグレイ値を持つすべてのピクセルが選択されます。

  • LightDarklightDarklight_dark = 'dark'"dark" の場合は、\(T^{*}\) 未満のグレイ値を持つすべてのピクセルが選択されます。

ヒストグラムの平滑化🔗

Methodmethodmethod = 'smooth_histo'"smooth_histo" を選択することで、 binary_thresholdBinaryThreshold は、以下の方法でしきい値 \(T^{*}\) を決定します。最初に、グレイ値の相対ヒストグラムが決定さ れます。その最小値がしきい値として使用されます。抽出される最小値の 数を低減するために、auto_thresholdAutoThreshold と同様にガウス平滑化を 用いてヒストグラムをなめらかします。 なめらかにしたヒストグラムの中で、最小値がただ 1 つ決まるまでマス クサイズを拡大します。次に、しきい値 \(T^{*}\) がこ の最小値の位置に設定されます。

  • LightDarklightDarklight_dark = 'light'"light" の場合は、texttt{p(r,c)} 以上のグレイ値を持つすべてのピクセルが選択されます。

  • LightDarklightDarklight_dark = 'dark'"dark" の場合は、texttt{p(r,c)} 未満のグレイ値を持つすべてのピクセルが選択されます。

実行情報🔗

実行情報
  • マルチスレッドタイプ: リエントラント(非排他なオペレーターと並列に動作)

  • マルチスレッドスコープ: グローバル(他のスレッドから呼び出される可能性あり)

  • tupleレベルで自動的に並列演算処理を実施

  • 内部データレベルで自動的に並列演算処理を実施

パラメーター🔗

Imageimageimage (input_object) singlechannelimage(-array) → object (byte / uint2)HObject (byte / uint2)HImage (byte / uint2)HObject (byte / uint2)Hobject (byte / uint2)

入力画像

Regionregionregion (output_object) region(-array) → objectHObjectHRegionHObjectHobject *

分割された領域

Methodmethodmethod (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

分割メソッド

初期値: 'max_separability'"max_separability"
値のリスト: 'max_separability', 'smooth_histo'"max_separability", "smooth_histo"

LightDarklightDarklight_dark (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

前景または背景の抽出

初期値: 'dark'"dark"
値のリスト: 'dark', 'light'"dark", "light"

UsedThresholdusedThresholdused_threshold (output_control) number(-array) → (integer / string)HTuple (Hlong / HString)HTuple (int / long / string)Sequence[Union[str, int]]Htuple (Hlong / char*)

使用されたしきい値

他のオペレーターとの組み合わせ🔗

組み合わせ

後処理の候補

connectionConnection, select_shapeSelectShape, select_graySelectGray

他の選択候補

auto_thresholdAutoThreshold, char_thresholdCharThreshold, local_thresholdLocalThreshold

関連項目

gray_histoGrayHisto, thresholdThreshold

参考文献🔗

N. Otsu, ``A threshold selection method from gray level histograms”, IEEE Trans. Syst. Man. Cybern., Vol. SMC-9, 62-66 (1979).

モジュール🔗

Foundation