KlassenKlassenKlassenKlassen | | | | Operatoren

approx_chainT_approx_chainApproxChainapprox_chainApproxChainApproxChain (Operator)

Name

approx_chainT_approx_chainApproxChainapprox_chainApproxChainApproxChain — Approximation einer Kontur durch Bögen und Linien.

Signatur

approx_chain( : : Row, Column, MinWidthCoord, MaxWidthCoord, ThreshStart, ThreshEnd, ThreshStep, MinWidthSmooth, MaxWidthSmooth, MinWidthCurve, MaxWidthCurve, Weight1, Weight2, Weight3 : ArcCenterRow, ArcCenterCol, ArcAngle, ArcBeginRow, ArcBeginCol, LineBeginRow, LineBeginCol, LineEndRow, LineEndCol, Order)

Herror T_approx_chain(const Htuple Row, const Htuple Column, const Htuple MinWidthCoord, const Htuple MaxWidthCoord, const Htuple ThreshStart, const Htuple ThreshEnd, const Htuple ThreshStep, const Htuple MinWidthSmooth, const Htuple MaxWidthSmooth, const Htuple MinWidthCurve, const Htuple MaxWidthCurve, const Htuple Weight1, const Htuple Weight2, const Htuple Weight3, Htuple* ArcCenterRow, Htuple* ArcCenterCol, Htuple* ArcAngle, Htuple* ArcBeginRow, Htuple* ArcBeginCol, Htuple* LineBeginRow, Htuple* LineBeginCol, Htuple* LineEndRow, Htuple* LineEndCol, Htuple* Order)

Herror approx_chain(const HTuple& Row, const HTuple& Column, const HTuple& MinWidthCoord, const HTuple& MaxWidthCoord, const HTuple& ThreshStart, const HTuple& ThreshEnd, const HTuple& ThreshStep, const HTuple& MinWidthSmooth, const HTuple& MaxWidthSmooth, const HTuple& MinWidthCurve, const HTuple& MaxWidthCurve, const HTuple& Weight1, const HTuple& Weight2, const HTuple& Weight3, HTuple* ArcCenterRow, HTuple* ArcCenterCol, HTuple* ArcAngle, HTuple* ArcBeginRow, HTuple* ArcBeginCol, HTuple* LineBeginRow, HTuple* LineBeginCol, HTuple* LineEndRow, HTuple* LineEndCol, HTuple* Order)

void ApproxChain(const HTuple& Row, const HTuple& Column, const HTuple& MinWidthCoord, const HTuple& MaxWidthCoord, const HTuple& ThreshStart, const HTuple& ThreshEnd, const HTuple& ThreshStep, const HTuple& MinWidthSmooth, const HTuple& MaxWidthSmooth, const HTuple& MinWidthCurve, const HTuple& MaxWidthCurve, const HTuple& Weight1, const HTuple& Weight2, const HTuple& Weight3, HTuple* ArcCenterRow, HTuple* ArcCenterCol, HTuple* ArcAngle, HTuple* ArcBeginRow, HTuple* ArcBeginCol, HTuple* LineBeginRow, HTuple* LineBeginCol, HTuple* LineEndRow, HTuple* LineEndCol, HTuple* Order)

static void HMisc::ApproxChain(const HTuple& Row, const HTuple& Column, double MinWidthCoord, double MaxWidthCoord, double ThreshStart, double ThreshEnd, double ThreshStep, double MinWidthSmooth, double MaxWidthSmooth, Hlong MinWidthCurve, Hlong MaxWidthCurve, double Weight1, double Weight2, double Weight3, HTuple* ArcCenterRow, HTuple* ArcCenterCol, HTuple* ArcAngle, HTuple* ArcBeginRow, HTuple* ArcBeginCol, HTuple* LineBeginRow, HTuple* LineBeginCol, HTuple* LineEndRow, HTuple* LineEndCol, HTuple* Order)

void HOperatorSetX.ApproxChain(
[in] VARIANT Row, [in] VARIANT Column, [in] VARIANT MinWidthCoord, [in] VARIANT MaxWidthCoord, [in] VARIANT ThreshStart, [in] VARIANT ThreshEnd, [in] VARIANT ThreshStep, [in] VARIANT MinWidthSmooth, [in] VARIANT MaxWidthSmooth, [in] VARIANT MinWidthCurve, [in] VARIANT MaxWidthCurve, [in] VARIANT Weight1, [in] VARIANT Weight2, [in] VARIANT Weight3, [out] VARIANT* ArcCenterRow, [out] VARIANT* ArcCenterCol, [out] VARIANT* ArcAngle, [out] VARIANT* ArcBeginRow, [out] VARIANT* ArcBeginCol, [out] VARIANT* LineBeginRow, [out] VARIANT* LineBeginCol, [out] VARIANT* LineEndRow, [out] VARIANT* LineEndCol, [out] VARIANT* Order)

VARIANT HMiscX.ApproxChain(
[in] VARIANT Row, [in] VARIANT Column, [in] double MinWidthCoord, [in] double MaxWidthCoord, [in] double ThreshStart, [in] double ThreshEnd, [in] double ThreshStep, [in] double MinWidthSmooth, [in] double MaxWidthSmooth, [in] Hlong MinWidthCurve, [in] Hlong MaxWidthCurve, [in] double Weight1, [in] double Weight2, [in] double Weight3, [out] VARIANT* ArcCenterCol, [out] VARIANT* ArcAngle, [out] VARIANT* ArcBeginRow, [out] VARIANT* ArcBeginCol, [out] VARIANT* LineBeginRow, [out] VARIANT* LineBeginCol, [out] VARIANT* LineEndRow, [out] VARIANT* LineEndCol, [out] VARIANT* Order)

static void HOperatorSet.ApproxChain(HTuple row, HTuple column, HTuple minWidthCoord, HTuple maxWidthCoord, HTuple threshStart, HTuple threshEnd, HTuple threshStep, HTuple minWidthSmooth, HTuple maxWidthSmooth, HTuple minWidthCurve, HTuple maxWidthCurve, HTuple weight1, HTuple weight2, HTuple weight3, out HTuple arcCenterRow, out HTuple arcCenterCol, out HTuple arcAngle, out HTuple arcBeginRow, out HTuple arcBeginCol, out HTuple lineBeginRow, out HTuple lineBeginCol, out HTuple lineEndRow, out HTuple lineEndCol, out HTuple order)

static void HMisc.ApproxChain(HTuple row, HTuple column, double minWidthCoord, double maxWidthCoord, double threshStart, double threshEnd, double threshStep, double minWidthSmooth, double maxWidthSmooth, int minWidthCurve, int maxWidthCurve, double weight1, double weight2, double weight3, out HTuple arcCenterRow, out HTuple arcCenterCol, out HTuple arcAngle, out HTuple arcBeginRow, out HTuple arcBeginCol, out HTuple lineBeginRow, out HTuple lineBeginCol, out HTuple lineEndRow, out HTuple lineEndCol, out HTuple order)

Beschreibung

Die Koordinaten einer Kurve werden durch eine Folge von Linien und Kreisbögen approximiert. Das Verfahren durchläuft dabei für bestimmte Parameter Wertebereiche. In der Parameterliste der Funktion werden die Grenzen dieser Bereiche explizit angegeben (MinWidthCoord ... MaxWidthCoord, ThreshStart ... ThreshEnd, MinWidthSmooth ... MaxWidthSmooth, MinWidthCurve ... MaxWidthCurve). Zusätzlich muss für den Parameterbereich des Schwellenwertes für spitze Ecken auch die Schrittweite angegeben werden (ThreshStep). Durch Einengung der durchlaufenen Bereiche kann die Laufzeit der Berechnung verkürzt, das Ergebnis aber eventuell verschlechtert werden.

Durch die Parameter Weight1, Weight2 und Weight3 kann angegeben werden, ob die gewünschte Gewichtung mehr auf Genauigkeit der Approximation oder Erhalt möglichst vieler großer oder möglichst weniger kleiner Segmente liegt. Für (Weight1,Weight2,Weight3) erzeugt also (1,0,0) eine sehr genaue Approximation (0,1,1) eine Approximation mit möglichst wenigen und großen Segmenten.

Das Ergebnis des Verfahren wird getrennt nach Bögen und Linien zurückgegeben. Ist man an der Reihenfolge der Segmente interessiert, so können die einzelnen Ergebniselemente sukzessive aus den Ergebnistupeln ausgelesen werden, wobei dem Rückgabeparameter Order die Reihenfolge entnommen werden kann (0: nächstes Element ist nächstes Liniensegment, 1: nächstes Element ist nächstes Bogensegment).

Achtung

Konturen, die eventuell nur aus einem Segment bestehen können, sollten auch mit einem Schwellenwertmaximum (ThreshEnd) > 1.0 untersucht werden, da ansonsten auf jeden Fall mindestens ein „Eckpunkt“ bestimmt wird.

Parallelisierung

Parameter

RowRowRowRowRowrow (input_control)  point.y-array HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Zeilenwert der Kontur.

Defaultwert: 32

ColumnColumnColumnColumnColumncolumn (input_control)  point.x-array HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Spaltenwert der Kontur.

Defaultwert: 32

MinWidthCoordMinWidthCoordMinWidthCoordMinWidthCoordMinWidthCoordminWidthCoord (input_control)  real HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Minimale Breite des Gaußoperators zur Koordinatenglättung (> 0.4).

Defaultwert: 0.5

Wertevorschläge: 0.5, 0.7, 1.0, 1.2, 1.5, 1.7

Typischer Wertebereich: 0.4 ≤ MinWidthCoord MinWidthCoord MinWidthCoord MinWidthCoord MinWidthCoord minWidthCoord ≤ 3.0 (lin)

Minimale Schrittweite: 0.01

Empfohlene Schrittweite: 0.1

MaxWidthCoordMaxWidthCoordMaxWidthCoordMaxWidthCoordMaxWidthCoordmaxWidthCoord (input_control)  real HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Maximale Breite des Gaußoperators zur Koordinatenglättung.

Defaultwert: 2.4

Wertevorschläge: 0.5, 0.7, 1.0, 1.2, 1.5, 1.7

Typischer Wertebereich: 0.4 ≤ MaxWidthCoord MaxWidthCoord MaxWidthCoord MaxWidthCoord MaxWidthCoord maxWidthCoord ≤ 3.0 (lin)

Minimale Schrittweite: 0.01

Empfohlene Schrittweite: 0.1

ThreshStartThreshStartThreshStartThreshStartThreshStartthreshStart (input_control)  real HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Minimaler Schwellenwert der Krümmung für die Akzeptierung einer Ecke (relativ zur größten auftretenden Krümmung).

Defaultwert: 0.3

Wertevorschläge: 0.3, 0.4, 0.5, 0.6, 0.7, 0.8

Typischer Wertebereich: 0.1 ≤ ThreshStart ThreshStart ThreshStart ThreshStart ThreshStart threshStart ≤ 0.9 (lin)

Minimale Schrittweite: 0.01

Empfohlene Schrittweite: 0.1

ThreshEndThreshEndThreshEndThreshEndThreshEndthreshEnd (input_control)  real HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Maximaler Schwellenwert der Krümmung für die Akzeptierung einer Ecke (relativ zur größten auftretenden Krümmung).

Defaultwert: 0.9

Wertevorschläge: 0.3, 0.4, 0.5, 0.6, 0.7, 0.8

Typischer Wertebereich: 0.1 ≤ ThreshEnd ThreshEnd ThreshEnd ThreshEnd ThreshEnd threshEnd ≤ 0.9 (lin)

Minimale Schrittweite: 0.01

Empfohlene Schrittweite: 0.1

ThreshStepThreshStepThreshStepThreshStepThreshStepthreshStep (input_control)  real HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Schrittweite für den Schwellenwertanstieg.

Defaultwert: 0.2

Wertevorschläge: 0.3, 0.4, 0.5

Typischer Wertebereich: 0.1 ≤ ThreshStep ThreshStep ThreshStep ThreshStep ThreshStep threshStep ≤ 0.9 (lin)

Minimale Schrittweite: 0.01

Empfohlene Schrittweite: 0.1

MinWidthSmoothMinWidthSmoothMinWidthSmoothMinWidthSmoothMinWidthSmoothminWidthSmooth (input_control)  real HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Minimale Breite des Gaußoperators zur Glättung der Krümmungsfunktion (> 0.4).

Defaultwert: 0.5

Wertevorschläge: 0.5, 0.7, 1.0, 1.2, 1.5, 1.7

Typischer Wertebereich: 0.4 ≤ MinWidthSmooth MinWidthSmooth MinWidthSmooth MinWidthSmooth MinWidthSmooth minWidthSmooth ≤ 3.0 (lin)

Minimale Schrittweite: 0.01

Empfohlene Schrittweite: 0.1

MaxWidthSmoothMaxWidthSmoothMaxWidthSmoothMaxWidthSmoothMaxWidthSmoothmaxWidthSmooth (input_control)  real HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Maximale Breite des Gaußoperators zur Glättung der Krümmungsfunktion.

Defaultwert: 2.4

Wertevorschläge: 0.5, 0.7, 1.0, 1.2, 1.5, 1.7

Typischer Wertebereich: 0.4 ≤ MaxWidthSmooth MaxWidthSmooth MaxWidthSmooth MaxWidthSmooth MaxWidthSmooth maxWidthSmooth ≤ 3.0 (lin)

Minimale Schrittweite: 0.01

Empfohlene Schrittweite: 0.1

MinWidthCurveMinWidthCurveMinWidthCurveMinWidthCurveMinWidthCurveminWidthCurve (input_control)  integer HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Minimale Breite des Kurvenbereichs zur Krümmungsbestimmung (> 0).

Defaultwert: 2

Wertevorschläge: 2, 5, 7

Typischer Wertebereich: 1 ≤ MinWidthCurve MinWidthCurve MinWidthCurve MinWidthCurve MinWidthCurve minWidthCurve ≤ 12 (lin)

Minimale Schrittweite: 1

Empfohlene Schrittweite: 2

MaxWidthCurveMaxWidthCurveMaxWidthCurveMaxWidthCurveMaxWidthCurvemaxWidthCurve (input_control)  integer HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Maximale Breite des Kurvenbereichs zur Krümmungsbestimmung.

Defaultwert: 12

Wertevorschläge: 2, 5, 7

Typischer Wertebereich: 1 ≤ MaxWidthCurve MaxWidthCurve MaxWidthCurve MaxWidthCurve MaxWidthCurve maxWidthCurve ≤ 20 (lin)

Minimale Schrittweite: 1

Empfohlene Schrittweite: 2

Weight1Weight1Weight1Weight1Weight1weight1 (input_control)  real HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Gewichtungsfaktor für die Approximationsgenauigkeit.

Defaultwert: 1.0

Wertevorschläge: 0.0, 0.5, 1.0

Typischer Wertebereich: 0.0 ≤ Weight1 Weight1 Weight1 Weight1 Weight1 weight1 ≤ 1.0 (lin)

Minimale Schrittweite: 0.1

Empfohlene Schrittweite: 0.5

Weight2Weight2Weight2Weight2Weight2weight2 (input_control)  real HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Gewichtungsfaktor für große Segmente.

Defaultwert: 1.0

Wertevorschläge: 0.0, 0.5, 1.0

Typischer Wertebereich: 0.0 ≤ Weight2 Weight2 Weight2 Weight2 Weight2 weight2 ≤ 1.0 (lin)

Minimale Schrittweite: 0.1

Empfohlene Schrittweite: 0.5

Weight3Weight3Weight3Weight3Weight3weight3 (input_control)  real HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Gewichtungsfaktor für kleine Segmente.

Defaultwert: 1.0

Wertevorschläge: 0.0, 0.5, 1.0

Typischer Wertebereich: 0.0 ≤ Weight3 Weight3 Weight3 Weight3 Weight3 weight3 ≤ 1.0 (lin)

Minimale Schrittweite: 0.1

Empfohlene Schrittweite: 0.5

ArcCenterRowArcCenterRowArcCenterRowArcCenterRowArcCenterRowarcCenterRow (output_control)  arc.center.y-array HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Zeile des Mittelpunkts eines Bogens.

ArcCenterColArcCenterColArcCenterColArcCenterColArcCenterColarcCenterCol (output_control)  arc.center.x-array HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Spalte des Mittelpunkts eines Bogens.

ArcAngleArcAngleArcAngleArcAngleArcAnglearcAngle (output_control)  arc.angle.rad-array HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Winkel eines Bogens.

ArcBeginRowArcBeginRowArcBeginRowArcBeginRowArcBeginRowarcBeginRow (output_control)  arc.begin.y-array HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Zeile des Startpunkts eines Bogens.

ArcBeginColArcBeginColArcBeginColArcBeginColArcBeginColarcBeginCol (output_control)  arc.begin.x-array HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Spalte des Startpunkts eines Bogens.

LineBeginRowLineBeginRowLineBeginRowLineBeginRowLineBeginRowlineBeginRow (output_control)  line.begin.y-array HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Zeile des Startpunkts einer Linie.

LineBeginColLineBeginColLineBeginColLineBeginColLineBeginCollineBeginCol (output_control)  line.begin.x-array HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Spalte des Startpunkts einer Linie.

LineEndRowLineEndRowLineEndRowLineEndRowLineEndRowlineEndRow (output_control)  line.end.y-array HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Zeile des Endpunkts einer Linie.

LineEndColLineEndColLineEndColLineEndColLineEndCollineEndCol (output_control)  line.end.x-array HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Spalte des Endpunkts einer Linie.

OrderOrderOrderOrderOrderorder (output_control)  integer-array HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Reihenfolge von Linien- (Wert 0) und Bogensegmenten (Wert1).

Beispiel (C)

/* read edge image  */
read_image(&Image,"fig1_kan");
/* construct edge region  */
hysteresis_threshold(Image,&RK1,64,255,40,1);
connection(RK1,&Rand);
/* fetch chain code  */
T_get_region_contour(Rand,&Rows,&Columns);
firstline = get_i(Tline,0);
firstcol = get_i(Tcol,0);
/* approximation with lines and circular arcs */
set_d(t1,0.4,0);
set_d(t2,2.4,0);

set_d(t3,0.3,0);
set_d(t4,0.9,0);

set_d(t5,0.2,0);

set_d(t6,0.4,0);
set_d(t7,2.4,0);

set_i(t8,2,0);
set_i(t9,12,0);

set_d(t10,1.0,0);
set_d(t11,1.0,0);
set_d(t12,1.0,0);

T_approx_chain(Rows,Columns,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,
                &Bzl,&Bzc,&Br,&Bwl,&Bwc,&Ll0,&Lc0,&Ll1,&Lc1,&order);
nob = length_tuple(Bzl);
nol = length_tuple(Ll0);
/* draw lines and arcs */
set_i(WindowHandleTuple,WindowHandle,0) ;
set_line_width(WindowHandle,4);
if (nob>0) T_disp_arc(Bzl,Bzc,Br,Bwl,Bwc);
set_line_width(WindowHandle,1);
if (nol>0) T_disp_line(WindowHandleTuple,Ll0,Lc0,Ll1,Lc1);

Ergebnis

approx_chainapprox_chainApproxChainapprox_chainApproxChainApproxChain liefert den Wert 2 (H_MSG_TRUE), falls die Parameter korrekt sind. Ansonsten wird eine Fehlerbehandlung durchgeführt.

Vorgänger

sobel_ampsobel_ampSobelAmpsobel_ampSobelAmpSobelAmp, edges_imageedges_imageEdgesImageedges_imageEdgesImageEdgesImage, get_region_contourget_region_contourGetRegionContourget_region_contourGetRegionContourGetRegionContour, thresholdthresholdThresholdthresholdThresholdThreshold, hysteresis_thresholdhysteresis_thresholdHysteresisThresholdhysteresis_thresholdHysteresisThresholdHysteresisThreshold

Nachfolger

set_line_widthset_line_widthSetLineWidthset_line_widthSetLineWidthSetLineWidth, disp_arcdisp_arcDispArcdisp_arcDispArcDispArc, disp_linedisp_lineDispLinedisp_lineDispLineDispLine

Alternativen

get_region_polygonget_region_polygonGetRegionPolygonget_region_polygonGetRegionPolygonGetRegionPolygon, approx_chain_simpleapprox_chain_simpleApproxChainSimpleapprox_chain_simpleApproxChainSimpleApproxChainSimple

Siehe auch

get_region_chainget_region_chainGetRegionChainget_region_chainGetRegionChainGetRegionChain, smallest_circlesmallest_circleSmallestCirclesmallest_circleSmallestCircleSmallestCircle, disp_circledisp_circleDispCircledisp_circleDispCircleDispCircle, disp_linedisp_lineDispLinedisp_lineDispLineDispLine

Modul

Foundation


KlassenKlassenKlassenKlassen | | | | Operatoren