contlength contlength Contlength Contlength (Operator)
Name
contlength contlength Contlength Contlength
— Ermitteln der Konturlänge einer Region.
Signatur
Beschreibung
contlength contlength Contlength Contlength Contlength
berechnet für jede Region aus Regions Regions Regions Regions regions
die Gesamtlänge der Kontur (Summe über alle Zusammenhangskomponenten
der Region). Dabei wird der Abstand von zwei benachbarten Konturpunkten
parallel zu den Koordinatenachsen mit 1, der Abstand in der Diagonalen
mit
bewertet.
In der Dokumentation zu diesem Kapitel (Regionen / Merkmale ) finden
Sie ein Bild mit Regionen, die sich in der Konturlänge unterscheiden.
Wird mehr als eine Region übergeben, dann werden die Zahlenwerte der
Konturlänge in einem Tupel abgespeichert, wobei die Position eines Wertes
in dem Tupel der Position einer Region im Eingabetupel entspricht.
Bei einer leeren Region liefert contlength contlength Contlength Contlength Contlength
den Wert 0.
Achtung
Die Kontur von Hohlflächen wird nicht mitgerechnet.
Ausführungsinformationen
Multithreading-Typ: reentrant (läuft parallel zu nicht-exklusiven Operatoren).
Multithreading-Bereich: global (kann von jedem Thread aufgerufen werden).
Automatisch parallelisiert auf Tupelebene.
Parameter
Regions Regions Regions Regions regions
(input_object) region(-array) →
object HRegion HRegion Hobject
Zu untersuchende Region(en).
ContLength ContLength ContLength ContLength contLength
(output_control) real(-array) →
HTuple HTuple Htuple (real) (double ) (double ) (double )
Konturlänge der Eingaberegion(en).
Zusicherung: ContLength >= 0
Beispiel (C++)
#include "HalconCpp.h"
#include <iostream>
using namespace HalconCpp;
int main (int argc, char *argv[])
{
HWindow w(10,10,512,512);
HRegion reg;
int NumOfElements = 3;
std::cout << "Draw " << NumOfElements << " regions " << std::endl;
GenEmptyObj(®);
for (int i=0; i < NumOfElements; i++)
{
reg = reg.ConcatObj(w.DrawRegion());
}
HTuple circ = reg.Circularity ();
HTuple cont = reg.Contlength ();
for (int i = 0; i < NumOfElements; i++)
{
std::cout << "region " << i+1 << ": \tcircularity = " << circ[i].D() <<
"\tcontour length =" << cont[i].D() << std::endl;
}
std::cout << "Click into the graphics window to end." << std::endl;
w.Click ();
return(0);
}
Beispiel (C++)
#include "HalconCpp.h"
#include <iostream>
using namespace HalconCpp;
int main (int argc, char *argv[])
{
HWindow w(10,10,512,512);
HRegion reg;
int NumOfElements = 3;
std::cout << "Draw " << NumOfElements << " regions " << std::endl;
GenEmptyObj(®);
for (int i=0; i < NumOfElements; i++)
{
reg = reg.ConcatObj(w.DrawRegion());
}
HTuple circ = reg.Circularity ();
HTuple cont = reg.Contlength ();
for (int i = 0; i < NumOfElements; i++)
{
std::cout << "region " << i+1 << ": \tcircularity = " << circ[i].D() <<
"\tcontour length =" << cont[i].D() << std::endl;
}
std::cout << "Click into the graphics window to end." << std::endl;
w.Click ();
return(0);
}
Beispiel (C++)
#include "HalconCpp.h"
#include <iostream>
using namespace HalconCpp;
int main (int argc, char *argv[])
{
HWindow w(10,10,512,512);
HRegion reg;
int NumOfElements = 3;
std::cout << "Draw " << NumOfElements << " regions " << std::endl;
GenEmptyObj(®);
for (int i=0; i < NumOfElements; i++)
{
reg = reg.ConcatObj(w.DrawRegion());
}
HTuple circ = reg.Circularity ();
HTuple cont = reg.Contlength ();
for (int i = 0; i < NumOfElements; i++)
{
std::cout << "region " << i+1 << ": \tcircularity = " << circ[i].D() <<
"\tcontour length =" << cont[i].D() << std::endl;
}
std::cout << "Click into the graphics window to end." << std::endl;
w.Click ();
return(0);
}
Beispiel (C++)
#include "HalconCpp.h"
#include <iostream>
using namespace HalconCpp;
int main (int argc, char *argv[])
{
HWindow w(10,10,512,512);
HRegion reg;
int NumOfElements = 3;
std::cout << "Draw " << NumOfElements << " regions " << std::endl;
GenEmptyObj(®);
for (int i=0; i < NumOfElements; i++)
{
reg = reg.ConcatObj(w.DrawRegion());
}
HTuple circ = reg.Circularity ();
HTuple cont = reg.Contlength ();
for (int i = 0; i < NumOfElements; i++)
{
std::cout << "region " << i+1 << ": \tcircularity = " << circ[i].D() <<
"\tcontour length =" << cont[i].D() << std::endl;
}
std::cout << "Click into the graphics window to end." << std::endl;
w.Click ();
return(0);
}
Beispiel (C++)
#include "HalconCpp.h"
#include <iostream>
using namespace HalconCpp;
int main (int argc, char *argv[])
{
HWindow w(10,10,512,512);
HRegion reg;
int NumOfElements = 3;
std::cout << "Draw " << NumOfElements << " regions " << std::endl;
GenEmptyObj(®);
for (int i=0; i < NumOfElements; i++)
{
reg = reg.ConcatObj(w.DrawRegion());
}
HTuple circ = reg.Circularity ();
HTuple cont = reg.Contlength ();
for (int i = 0; i < NumOfElements; i++)
{
std::cout << "region " << i+1 << ": \tcircularity = " << circ[i].D() <<
"\tcontour length =" << cont[i].D() << std::endl;
}
std::cout << "Click into the graphics window to end." << std::endl;
w.Click ();
return(0);
}
Ergebnis
contlength contlength Contlength Contlength Contlength
liefert den Wert 2 (H_MSG_TRUE), falls die Eingabe nicht leer
ist.
Das Verhalten bei leerer Eingabe (keine Eingaberegionen 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>)
festlegen.
Gegebenenfalls wird eine Fehlerbehandlung durchgeführt.
Vorgänger
threshold threshold Threshold Threshold Threshold
,
regiongrowing regiongrowing Regiongrowing Regiongrowing Regiongrowing
,
connection connection Connection Connection Connection
Nachfolger
get_region_contour get_region_contour GetRegionContour GetRegionContour GetRegionContour
Alternativen
compactness compactness Compactness Compactness Compactness
Siehe auch
area_center area_center AreaCenter AreaCenter AreaCenter
,
get_region_contour get_region_contour GetRegionContour GetRegionContour GetRegionContour
Modul
Foundation