binary_thresholdbinary_thresholdBinaryThresholdBinaryThreshold (Operator)

Name

binary_thresholdbinary_thresholdBinaryThresholdBinaryThreshold — Segmentieren mit verschiedenen globalen Schwellwertoperationen.

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)

Beschreibung

binary_thresholdbinary_thresholdBinaryThresholdBinaryThresholdBinaryThreshold segmentiert ein einkanaliges Bild ImageImageImageImageimage mit einem automatisch bestimmten globalen Schwellwert und gibt die segmentierte RegionRegionRegionRegionregion zurück. Dies ist z.B. für die Segmentierung von Buchstaben und Zeichen auf gleichmäßig beleuchtetem Hintergrund geeignet. binary_thresholdbinary_thresholdBinaryThresholdBinaryThresholdBinaryThreshold gibt auch den verwendeten Schwellwert in UsedThresholdUsedThresholdUsedThresholdUsedThresholdusedThreshold zurück.

Der verwendete Schwellwert wird mit der in MethodMethodMethodMethodmethod angegebenen Methode bestimmt. Derzeit stehen die beiden folgenden Methoden zur Verfügung: 'max_separability'"max_separability""max_separability""max_separability""max_separability" und '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" stellt die Funktionalität zur Verfügung, die vom Operator bin_thresholdbin_thresholdBinThresholdBinThresholdBinThreshold bereitgestellt wurde. Die Methode '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 UsedThresholdUsedThresholdUsedThresholdUsedThresholdusedThreshold 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" schneller als '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" als Verfahren in MethodMethodMethodMethodmethod wird eine automatische Bestimmung eines globalen Schwellwertes 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 Histograms

Bei der Wahl von 'smooth_histo'"smooth_histo""smooth_histo""smooth_histo""smooth_histo" als Verfahren in MethodMethodMethodMethodmethod wird der optimale Schwellwert (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 Schwellenwertsegmentation dienen. Um die Anzahl der Minima zu reduzieren, wird das Histogramm wie bei auto_thresholdauto_thresholdAutoThresholdAutoThresholdAutoThreshold mit einer Gaußmaske geglättet. Die Maske wird dabei so lange vergrößert, bis nur noch ein Minimum vorhanden ist.

Ausführungsinformationen

Parameter

ImageImageImageImageimage (input_object)  singlechannelimage(-array) objectHImageHImageHobject (byte / uint2)

Eingabebild.

RegionRegionRegionRegionregion (output_object)  region(-array) objectHRegionHRegionHobject *

Segmentierte Ausgaberegion.

MethodMethodMethodMethodmethod (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Auswahl des Verfahrens.

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

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

LightDarkLightDarkLightDarkLightDarklightDark (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Segmentierung des Vordergunds oder des Hintergrunds.

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

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

UsedThresholdUsedThresholdUsedThresholdUsedThresholdusedThreshold (output_control)  number(-array) HTupleHTupleHtuple (integer / string) (int / long / string) (Hlong / HString) (Hlong / char*)

Angewandte Schwelle.

Nachfolger

connectionconnectionConnectionConnectionConnection, select_shapeselect_shapeSelectShapeSelectShapeSelectShape, select_grayselect_graySelectGraySelectGraySelectGray

Alternativen

auto_thresholdauto_thresholdAutoThresholdAutoThresholdAutoThreshold, char_thresholdchar_thresholdCharThresholdCharThresholdCharThreshold, local_thresholdlocal_thresholdLocalThresholdLocalThresholdLocalThreshold

Siehe auch

gray_histogray_histoGrayHistoGrayHistoGrayHisto, thresholdthresholdThresholdThresholdThreshold

Literatur

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

Modul

Foundation