fit_line_contour_xld fit_line_contour_xld FitLineContourXld FitLineContourXld fit_line_contour_xld (Operator)
Name
fit_line_contour_xld fit_line_contour_xld FitLineContourXld FitLineContourXld fit_line_contour_xld — Approximieren von XLD-Konturen durch Liniensegmente.
Signatur
fit_line_contour_xld (Contours : : Algorithm , MaxNumPoints , ClippingEndPoints , Iterations , ClippingFactor : RowBegin , ColBegin , RowEnd , ColEnd , Nr , Nc , Dist )
Herror fit_line_contour_xld (const Hobject Contours , const char* Algorithm , const Hlong MaxNumPoints , const Hlong ClippingEndPoints , const Hlong Iterations , double ClippingFactor , double* RowBegin , double* ColBegin , double* RowEnd , double* ColEnd , double* Nr , double* Nc , double* Dist )
Herror T_fit_line_contour_xld (const Hobject Contours , const Htuple Algorithm , const Htuple MaxNumPoints , const Htuple ClippingEndPoints , const Htuple Iterations , const Htuple ClippingFactor , Htuple* RowBegin , Htuple* ColBegin , Htuple* RowEnd , Htuple* ColEnd , Htuple* Nr , Htuple* Nc , Htuple* Dist )
void FitLineContourXld (const HObject& Contours , const HTuple& Algorithm , const HTuple& MaxNumPoints , const HTuple& ClippingEndPoints , const HTuple& Iterations , const HTuple& ClippingFactor , HTuple* RowBegin , HTuple* ColBegin , HTuple* RowEnd , HTuple* ColEnd , HTuple* Nr , HTuple* Nc , HTuple* Dist )
void HXLDCont ::FitLineContourXld (const HString& Algorithm , Hlong MaxNumPoints , Hlong ClippingEndPoints , Hlong Iterations , double ClippingFactor , HTuple* RowBegin , HTuple* ColBegin , HTuple* RowEnd , HTuple* ColEnd , HTuple* Nr , HTuple* Nc , HTuple* Dist ) const
void HXLDCont ::FitLineContourXld (const HString& Algorithm , Hlong MaxNumPoints , Hlong ClippingEndPoints , Hlong Iterations , double ClippingFactor , double* RowBegin , double* ColBegin , double* RowEnd , double* ColEnd , double* Nr , double* Nc , double* Dist ) const
void HXLDCont ::FitLineContourXld (const char* Algorithm , Hlong MaxNumPoints , Hlong ClippingEndPoints , Hlong Iterations , double ClippingFactor , double* RowBegin , double* ColBegin , double* RowEnd , double* ColEnd , double* Nr , double* Nc , double* Dist ) const
void HXLDCont ::FitLineContourXld (const wchar_t* Algorithm , Hlong MaxNumPoints , Hlong ClippingEndPoints , Hlong Iterations , double ClippingFactor , double* RowBegin , double* ColBegin , double* RowEnd , double* ColEnd , double* Nr , double* Nc , double* Dist ) const
(Nur Windows)
static void HOperatorSet .FitLineContourXld (HObject contours , HTuple algorithm , HTuple maxNumPoints , HTuple clippingEndPoints , HTuple iterations , HTuple clippingFactor , out HTuple rowBegin , out HTuple colBegin , out HTuple rowEnd , out HTuple colEnd , out HTuple nr , out HTuple nc , out HTuple dist )
void HXLDCont .FitLineContourXld (string algorithm , int maxNumPoints , int clippingEndPoints , int iterations , double clippingFactor , out HTuple rowBegin , out HTuple colBegin , out HTuple rowEnd , out HTuple colEnd , out HTuple nr , out HTuple nc , out HTuple dist )
void HXLDCont .FitLineContourXld (string algorithm , int maxNumPoints , int clippingEndPoints , int iterations , double clippingFactor , out double rowBegin , out double colBegin , out double rowEnd , out double colEnd , out double nr , out double nc , out double dist )
def fit_line_contour_xld (contours : HObject, algorithm : str, max_num_points : int, clipping_end_points : int, iterations : int, clipping_factor : float) -> Tuple[Sequence[float], Sequence[float], Sequence[float], Sequence[float], Sequence[float], Sequence[float], Sequence[float]]
def fit_line_contour_xld_s (contours : HObject, algorithm : str, max_num_points : int, clipping_end_points : int, iterations : int, clipping_factor : float) -> Tuple[float, float, float, float, float, float, float]
Beschreibung
fit_line_contour_xld fit_line_contour_xld FitLineContourXld FitLineContourXld FitLineContourXld fit_line_contour_xld approximiert die XLD-Konturen
Contours Contours Contours Contours contours contours durch Liniensegmente. Eine Segmentierung der
Eingabekonturen erfolgt dabei nicht. Es muss also sichergestellt
sein, dass jede Kontur in Contours Contours Contours Contours contours contours genau einem
Liniensegment entspricht. Zurückgegeben wird der Anfangs-
(RowBegin RowBegin RowBegin RowBegin rowBegin row_begin , ColBegin ColBegin ColBegin ColBegin colBegin col_begin ) bzw. Endpunkt
(RowEnd RowEnd RowEnd RowEnd rowEnd row_end , ColEnd ColEnd ColEnd ColEnd colEnd col_end ), sowie die Geradengleichung jedes
Liniensegments, codiert durch den Normalenvektor (Nr Nr Nr Nr nr nr ,
Nc Nc Nc Nc nc nc ) der Gerade und dem Abstand Dist Dist Dist Dist dist dist der Gerade vom
Ursprung, d.h. die Geradengleichung ist gegeben durch
.
Das gewünschte Approximationsverfahren wird über den Parameter
Algorithm Algorithm Algorithm Algorithm algorithm algorithm ausgewählt:
'regression' "regression" "regression" "regression" "regression" "regression" :
Standard-Least-Squares-Geradenanpassung.
'huber' "huber" "huber" "huber" "huber" "huber" :
Gewichtete Least-Squares -Geradenanpassung, bei der Ausreißer
nach dem Ansatz von Huber gedämpft werden (siehe unten).
'tukey' "tukey" "tukey" "tukey" "tukey" "tukey" :
Gewichtete Least-Squares -Geradenanpassung, bei der Ausreißer
nach dem Ansatz von Tukey ignoriert werden (siehe unten).
'drop' "drop" "drop" "drop" "drop" "drop" :
Gewichtete Least-Squares -Geradenanpassung, bei der Ausreißer
ignoriert werden, d.h. alle Konturpunkte, die
weiter von der Kontur entfernt liegen als die mittlere Entfernung von der
Regressionsgeraden multipliziert mit dem ClippingFactor ClippingFactor ClippingFactor ClippingFactor clippingFactor clipping_factor (s.u.).
'gauss' "gauss" "gauss" "gauss" "gauss" "gauss" :
Gewichtete Least-Squares -Geradenanpassung,
bei der Ausreißer gestützt auf Mittelwert und Standardabweichung der
Abweichungen aller Konturpunkte von der Geraden gedämpft werden.
In den Modi 'huber' "huber" "huber" "huber" "huber" "huber" , 'tukey' "tukey" "tukey" "tukey" "tukey" "tukey" und 'drop' "drop" "drop" "drop" "drop" "drop"
wird eine robuste Fehlerstatistik
verwendet, um die Standardabweichung der Abstände der Konturpunkte (ohne
Ausreißer) von der approximierenden Geraden zu ermitteln. Der Parameter
ClippingFactor ClippingFactor ClippingFactor ClippingFactor clippingFactor clipping_factor (ein Skalierungsfaktor für diese Standardabweichung)
steuert in diesen Modi den Grad der Ausreißerdämpfung: Je kleiner der Wert
gewählt wird, desto mehr Punkte werden als Ausreißer behandelt.
Die Ausreißerdetektion wird iteriert.
Der Parameter Iterations Iterations Iterations Iterations iterations iterations enthält die Anzahl durchzuführender
Iterationen. Er wird im Modus 'regression' "regression" "regression" "regression" "regression" "regression" ignoriert. Bei
dem Ansatz nach Tukey ('tukey' "tukey" "tukey" "tukey" "tukey" "tukey" ) werden Ausreißer noch vor der Kreisanpassung
eliminiert (und die übrigen Punkte werden gewichtet), während die Ausreißer
bei dem Ansatz nach Huber ('huber' "huber" "huber" "huber" "huber" "huber" ) noch in geringem Maße in die Optimierung
eingehen. Speziell gehen bei Letzterem die Ausreißer linear und die übrigen
Punkte quadratisch in die Optimierung ein. In der Praxis ist der
Ansatz nach Tukey zu empfehlen.
Zur Reduktion des Aufwandes lässt sich die Berechnung auf eine
Teilmenge der Konturpunkte einschränken: Wird für
MaxNumPoints MaxNumPoints MaxNumPoints MaxNumPoints maxNumPoints max_num_points eine Zahl ungleich -1 übergeben, werden nur
maximal MaxNumPoints MaxNumPoints MaxNumPoints MaxNumPoints maxNumPoints max_num_points gleichmäßig über die Kontur
verteilte Punkte verwendet.
Die Anfangs- und Endpunkte werden bestimmt, indem zu den Anfangs-
und Endpunkten der Eingabekonturen die nächstgelegenen Punkte auf
den zugrundeliegenden Regressionsgeraden ermittelt werden. Da die
Start- und Endpunkte einer Kontur je nach Vorverarbeitung nicht
exakt bekannt sein können, besteht die Möglichkeit,
ClippingEndPoints ClippingEndPoints ClippingEndPoints ClippingEndPoints clippingEndPoints clipping_end_points Punkte am Anfang und Ende der Kontur von
der Geradenanpassung auszuschließen. Sie werden jedoch weiterhin
für die Bestimmung der Anfangs- und Endpunkte verwendet.
Die notwendige, minimale Anzahl an Konturpunkten zur Anpassung einer Linie
ist zwei. Es wird daher vorausgesetzt, dass die Konturen mindestens
Punkte enthalten.
Ausführungsinformationen
Multithreading-Typ: reentrant (läuft parallel zu nicht-exklusiven Operatoren).
Multithreading-Bereich: global (kann von jedem Thread aufgerufen werden).
Wird ohne Parallelisierung verarbeitet.
Parameter
Contours Contours Contours Contours contours contours (input_object) xld_cont(-array) → object HXLDCont HObject HXLDCont Hobject
Eingabekonturen.
Algorithm Algorithm Algorithm Algorithm algorithm algorithm (input_control) string → HTuple str HTuple Htuple (string) (string ) (HString ) (char* )
Algorithmus zur Geradenanpassung.
Defaultwert:
'tukey'
"tukey"
"tukey"
"tukey"
"tukey"
"tukey"
Werteliste: 'drop' "drop" "drop" "drop" "drop" "drop" , 'gauss' "gauss" "gauss" "gauss" "gauss" "gauss" , 'huber' "huber" "huber" "huber" "huber" "huber" , 'regression' "regression" "regression" "regression" "regression" "regression" , 'tukey' "tukey" "tukey" "tukey" "tukey" "tukey"
MaxNumPoints MaxNumPoints MaxNumPoints MaxNumPoints maxNumPoints max_num_points (input_control) integer → HTuple int HTuple Htuple (integer) (int / long) (Hlong ) (Hlong )
Maximale Anzahl Konturpunkte zur Geradenanpassung
(-1 für alle Punkte).
Defaultwert: -1
Restriktion: MaxNumPoints >= 2
ClippingEndPoints ClippingEndPoints ClippingEndPoints ClippingEndPoints clippingEndPoints clipping_end_points (input_control) integer → HTuple int HTuple Htuple (integer) (int / long) (Hlong ) (Hlong )
Anzahl der Konturpunkte am Anfang und Ende der Kontur,
die für die Geradenanpassung ignoriert werden sollen.
Defaultwert: 0
Restriktion: ClippingEndPoints >= 0
Iterations Iterations Iterations Iterations iterations iterations (input_control) integer → HTuple int HTuple Htuple (integer) (int / long) (Hlong ) (Hlong )
Maximale Anzahl von Iterationen
(unbenutzt bei 'regression' "regression" "regression" "regression" "regression" "regression" ).
Defaultwert: 5
Restriktion: Iterations >= 0
ClippingFactor ClippingFactor ClippingFactor ClippingFactor clippingFactor clipping_factor (input_control) real → HTuple float HTuple Htuple (real) (double ) (double ) (double )
Clipping Faktor für die Ausreißerdämpfung
(typische Werte: 1.0 bei 'huber' "huber" "huber" "huber" "huber" "huber" und
'drop' "drop" "drop" "drop" "drop" "drop" sowie 2.0 bei 'tukey' "tukey" "tukey" "tukey" "tukey" "tukey" ).
Defaultwert: 2.0
Wertevorschläge: 1.0, 1.5, 2.0, 2.5, 3.0
Restriktion: ClippingFactor > 0
RowBegin RowBegin RowBegin RowBegin rowBegin row_begin (output_control) line.begin.y(-array) → HTuple Sequence[float] HTuple Htuple (real) (double ) (double ) (double )
Zeilenkoordinate der Anfangspunkte der Liniensegmente.
ColBegin ColBegin ColBegin ColBegin colBegin col_begin (output_control) line.begin.x(-array) → HTuple Sequence[float] HTuple Htuple (real) (double ) (double ) (double )
Spaltenkoordinate der Anfangspunkte der Liniensegmente.
RowEnd RowEnd RowEnd RowEnd rowEnd row_end (output_control) line.end.y(-array) → HTuple Sequence[float] HTuple Htuple (real) (double ) (double ) (double )
Zeilenkoordinate der Endpunkte der Liniensegmente.
ColEnd ColEnd ColEnd ColEnd colEnd col_end (output_control) line.end.x(-array) → HTuple Sequence[float] HTuple Htuple (real) (double ) (double ) (double )
Spaltenkoordinate der Endpunkte der Liniensegmente.
Nr Nr Nr Nr nr nr (output_control) number(-array) → HTuple Sequence[float] HTuple Htuple (real) (double ) (double ) (double )
Geradenparameter: Zeilenkoordinate von Normalenvektor
Nc Nc Nc Nc nc nc (output_control) number(-array) → HTuple Sequence[float] HTuple Htuple (real) (double ) (double ) (double )
Geradenparameter: Spaltenkoordinate von Normalenvektor
Dist Dist Dist Dist dist dist (output_control) number(-array) → HTuple Sequence[float] HTuple Htuple (real) (double ) (double ) (double )
Geradenparameter: Abstand der Geraden vom Ursprung
Beispiel (HDevelop)
read_image (Image, 'mreut')
edges_sub_pix (Image, Edges, 'lanser2', 0.5, 20, 40)
gen_polygons_xld (Edges, Polygons, 'ramer', 2)
split_contours_xld (Polygons, Contours, 'polygon', 1, 5)
fit_line_contour_xld (Contours, 'regression', -1, 0, 5, 2, RowBegin, \
ColBegin, RowEnd, ColEnd, Nr, Nc, Dist)
Beispiel (HDevelop)
read_image (Image, 'mreut')
edges_sub_pix (Image, Edges, 'lanser2', 0.5, 20, 40)
gen_polygons_xld (Edges, Polygons, 'ramer', 2)
split_contours_xld (Polygons, Contours, 'polygon', 1, 5)
fit_line_contour_xld (Contours, 'regression', -1, 0, 5, 2, RowBegin, \
ColBegin, RowEnd, ColEnd, Nr, Nc, Dist)
Beispiel (HDevelop)
read_image (Image, 'mreut')
edges_sub_pix (Image, Edges, 'lanser2', 0.5, 20, 40)
gen_polygons_xld (Edges, Polygons, 'ramer', 2)
split_contours_xld (Polygons, Contours, 'polygon', 1, 5)
fit_line_contour_xld (Contours, 'regression', -1, 0, 5, 2, RowBegin, \
ColBegin, RowEnd, ColEnd, Nr, Nc, Dist)
Beispiel (HDevelop)
read_image (Image, 'mreut')
edges_sub_pix (Image, Edges, 'lanser2', 0.5, 20, 40)
gen_polygons_xld (Edges, Polygons, 'ramer', 2)
split_contours_xld (Polygons, Contours, 'polygon', 1, 5)
fit_line_contour_xld (Contours, 'regression', -1, 0, 5, 2, RowBegin, \
ColBegin, RowEnd, ColEnd, Nr, Nc, Dist)
Beispiel (HDevelop)
read_image (Image, 'mreut')
edges_sub_pix (Image, Edges, 'lanser2', 0.5, 20, 40)
gen_polygons_xld (Edges, Polygons, 'ramer', 2)
split_contours_xld (Polygons, Contours, 'polygon', 1, 5)
fit_line_contour_xld (Contours, 'regression', -1, 0, 5, 2, RowBegin, \
ColBegin, RowEnd, ColEnd, Nr, Nc, Dist)
Ergebnis
Sind die Parameterwerte korrekt und konnte eine Geradenanpassung
durchgeführt werden, liefert fit_line_contour_xld fit_line_contour_xld FitLineContourXld FitLineContourXld FitLineContourXld fit_line_contour_xld den Wert TRUE.
Das Verhalten bei leerer Eingabe (keine Eingabebilder vorhanden) lässt
sich mittels set_system('no_object_result',<Result>) set_system("no_object_result",<Result>) SetSystem("no_object_result",<Result>) SetSystem("no_object_result",<Result>) SetSystem("no_object_result",<Result>) set_system("no_object_result",<Result>) festlegen.
Gegebenenfalls wird eine Fehlerbehandlung durchgeführt.
Wenn der Parameter ClippingFactor ClippingFactor ClippingFactor ClippingFactor clippingFactor clipping_factor so klein gewählt worden ist,
dass alle Punkte als Ausreißer klassifiziert werden, wird die Fehlermeldung
3264 zurückgeliefert.
Vorgänger
gen_contours_skeleton_xld gen_contours_skeleton_xld GenContoursSkeletonXld GenContoursSkeletonXld GenContoursSkeletonXld gen_contours_skeleton_xld ,
lines_gauss lines_gauss LinesGauss LinesGauss LinesGauss lines_gauss ,
lines_facet lines_facet LinesFacet LinesFacet LinesFacet lines_facet ,
edges_sub_pix edges_sub_pix EdgesSubPix EdgesSubPix EdgesSubPix edges_sub_pix ,
smooth_contours_xld smooth_contours_xld SmoothContoursXld SmoothContoursXld SmoothContoursXld smooth_contours_xld
Nachfolger
disp_line disp_line DispLine DispLine DispLine disp_line ,
line_orientation line_orientation LineOrientation LineOrientation LineOrientation line_orientation
Siehe auch
regress_contours_xld regress_contours_xld RegressContoursXld RegressContoursXld RegressContoursXld regress_contours_xld ,
get_regress_params_xld get_regress_params_xld GetRegressParamsXld GetRegressParamsXld GetRegressParamsXld get_regress_params_xld
Modul
Foundation