binary_thresholdbinary_thresholdBinaryThresholdBinaryThresholdbinary_threshold (Operator)

Name

binary_thresholdbinary_thresholdBinaryThresholdBinaryThresholdbinary_threshold — Segmentieren mit verschiedenen globalen Schwellenwertoperationen.

Signatur

binary_threshold(Image : Region : Method, LightDark : UsedThreshold)

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)

void BinaryThreshold(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   (Nur Windows)

static void HOperatorSet.BinaryThreshold(HObject image, out HObject region, HTuple method, HTuple lightDark, out HTuple usedThreshold)

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

HRegion HImage.BinaryThreshold(string method, string lightDark, out int 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]]

Beschreibung

binary_thresholdbinary_thresholdBinaryThresholdBinaryThresholdBinaryThresholdbinary_threshold segmentiert ein einkanaliges Bild ImageImageImageImageimageimage mit einem automatisch bestimmten globalen Schwellenwert und gibt die segmentierte RegionRegionRegionRegionregionregion zurück. Dies ist z.B. für die Segmentierung von Buchstaben und Zeichen auf gleichmäßig beleuchtetem Hintergrund geeignet. binary_thresholdbinary_thresholdBinaryThresholdBinaryThresholdBinaryThresholdbinary_threshold gibt auch den verwendeten Schwellenwert in UsedThresholdUsedThresholdUsedThresholdUsedThresholdusedThresholdused_threshold zurück.

Der verwendete Schwellenwert wird mit der in MethodMethodMethodMethodmethodmethod angegebenen Methode bestimmt. Derzeit stehen die beiden folgenden Methoden zur Verfügung: 'max_separability'"max_separability""max_separability""max_separability""max_separability""max_separability" und 'smooth_histo'"smooth_histo""smooth_histo""smooth_histo""smooth_histo""smooth_histo". Beide Verfahren sollten nur auf Bilder angewendet werden, die ein bimodales Histogramm haben.

Die Methode 'smooth_histo'"smooth_histo""smooth_histo""smooth_histo""smooth_histo""smooth_histo" stellt die Funktionalität zur Verfügung, die vom Operator bin_thresholdbin_thresholdBinThresholdBinThresholdBinThresholdbin_threshold bereitgestellt wurde. Die Methode 'max_separability'"max_separability""max_separability""max_separability""max_separability""max_separability" ist weniger empfindlich gegenüber dünnen und isolierten Spitzen im Histogramm. Außerdem tendiert diese Methode dazu, Werte für UsedThresholdUsedThresholdUsedThresholdUsedThresholdusedThresholdused_threshold zu bestimmen, die näher am Schwerpunkt des Histogramms liegen. In vielen Fällen ist die Methode 'max_separability'"max_separability""max_separability""max_separability""max_separability""max_separability" schneller als 'smooth_histo'"smooth_histo""smooth_histo""smooth_histo""smooth_histo""smooth_histo".

Maximierung der Trennbarkeit

Bei der Wahl von 'max_separability'"max_separability""max_separability""max_separability""max_separability""max_separability" als Verfahren in MethodMethodMethodMethodmethodmethod wird eine automatische Bestimmung eines globalen Schwellenwertes nach dem Verfahren von Otsu (siehe Referenzen) durchgeführt.

Der Algorithmus berechnet zuerst das Histogramm des Bildes und verwendet dann statistische Momente um die optimale Schwelle zu bestimmen. Die Schwelle trennt die Pixel so in Vordergrund und Hintergrund, dass die Streuung zwischen den beiden Klassen maximiert wird.

Das Verfahren 'max_separability' ist nur für byte- und uint2-Bilder verfügbar.

Verfahren mit Glättung des Histogramms

Bei der Wahl von 'smooth_histo'"smooth_histo""smooth_histo""smooth_histo""smooth_histo""smooth_histo" als Verfahren in MethodMethodMethodMethodmethodmethod wird der optimale Schwellenwert (r,c) wie folgt bestimmt: Als erstes wird dabei das relative Histogramm über den Grauwerten ermittelt. Dann werden im Histogramm relevante Minima gesucht, die als Schwellen für die Schwellenwertsegmentierung dienen. Um die Anzahl der Minima zu reduzieren, wird das Histogramm wie bei auto_thresholdauto_thresholdAutoThresholdAutoThresholdAutoThresholdauto_threshold mit einer Gaußmaske geglättet. Die Maske wird dabei so lange vergrößert, bis nur noch ein Minimum vorhanden ist.

Ausführungsinformationen

Parameter

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

Eingabebild.

RegionRegionRegionRegionregionregion (output_object)  region(-array) objectHRegionHObjectHRegionHobject *

Segmentierte Ausgaberegion.

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

Auswahl des Verfahrens.

Defaultwert: 'max_separability' "max_separability" "max_separability" "max_separability" "max_separability" "max_separability"

Werteliste: 'max_separability'"max_separability""max_separability""max_separability""max_separability""max_separability", 'smooth_histo'"smooth_histo""smooth_histo""smooth_histo""smooth_histo""smooth_histo"

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

Segmentierung des Vordergrunds oder des Hintergrunds.

Defaultwert: 'dark' "dark" "dark" "dark" "dark" "dark"

Werteliste: 'dark'"dark""dark""dark""dark""dark", 'light'"light""light""light""light""light"

UsedThresholdUsedThresholdUsedThresholdUsedThresholdusedThresholdused_threshold (output_control)  number(-array) HTupleSequence[Union[str, int]]HTupleHtuple (integer / string) (int / long / string) (Hlong / HString) (Hlong / char*)

Angewandte Schwelle.

Nachfolger

connectionconnectionConnectionConnectionConnectionconnection, select_shapeselect_shapeSelectShapeSelectShapeSelectShapeselect_shape, select_grayselect_graySelectGraySelectGraySelectGrayselect_gray

Alternativen

auto_thresholdauto_thresholdAutoThresholdAutoThresholdAutoThresholdauto_threshold, char_thresholdchar_thresholdCharThresholdCharThresholdCharThresholdchar_threshold, local_thresholdlocal_thresholdLocalThresholdLocalThresholdLocalThresholdlocal_threshold

Siehe auch

gray_histogray_histoGrayHistoGrayHistoGrayHistogray_histo, thresholdthresholdThresholdThresholdThresholdthreshold

Literatur

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

Modul

Foundation