morph_hatmorph_hatMorphHatMorphHat (Operator)
Name
morph_hatmorph_hatMorphHatMorphHat
— Vereinigen von bottom_hatbottom_hatBottomHatBottomHatBottomHat
und top_hattop_hatTopHatTopHatTopHat
.
Warnung
morph_hatmorph_hatMorphHatMorphHatMorphHat
ist veraltet und wird nur aus Gründen
der Rückwärtskompatibilität zur Verfügung gestellt.
Signatur
Beschreibung
morph_hatmorph_hatMorphHatMorphHatMorphHat
vereinigt die Flächen, die bei der
openingopeningOpeningOpeningOpening
-Operation wegfallen mit den Flächen, die bei
der closingclosingClosingClosingClosing
-Operation hinzukommen. Dies entspricht also
der Vereinigung von top_hattop_hatTopHatTopHatTopHat
und bottom_hatbottom_hatBottomHatBottomHatBottomHat
.
Die Position von StructElementStructElementStructElementStructElementstructElement
ist ohne Bedeutung.
Das strukturierende Element (StructElementStructElementStructElementStructElementstructElement
) kann mit
Operatoren wie gen_circlegen_circleGenCircleGenCircleGenCircle
, gen_rectangle1gen_rectangle1GenRectangle1GenRectangle1GenRectangle1
,
gen_rectangle2gen_rectangle2GenRectangle2GenRectangle2GenRectangle2
, gen_ellipsegen_ellipseGenEllipseGenEllipseGenEllipse
,
draw_regiondraw_regionDrawRegionDrawRegionDrawRegion
, gen_region_polygongen_region_polygonGenRegionPolygonGenRegionPolygonGenRegionPolygon
,
gen_region_pointsgen_region_pointsGenRegionPointsGenRegionPointsGenRegionPoints
, etc. erzeugt werden.
Achtung
Die Regionen werden einzeln bearbeitet.
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
RegionRegionRegionRegionregion
(input_object) region(-array) →
objectHRegionHRegionHobject
Regionen, die verarbeitet werden sollen.
StructElementStructElementStructElementStructElementstructElement
(input_object) region →
objectHRegionHRegionHobject
Strukturierendes Element (lageinvariant).
RegionMorphHatRegionMorphHatRegionMorphHatRegionMorphHatregionMorphHat
(output_object) region(-array) →
objectHRegionHRegionHobject *
Vereinigung von Top-Hat und Bottom-Hat.
Beispiel (C++ (HALCON 5.0-10.0))
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"
main()
{
cout << "Reproduction of 'dilation_circle ()'" << endl;
cout << "First = original image " << endl;
cout << "Red = after segmentation " << endl;
cout << "Blue = after erosion " << endl;
HByteImage img("monkey");
HWindow w;
HRegion circ = HRegion::GenCircle (10, 10, 1.5);
HRegionArray regs = (img >= 128).Connection();
HRegionArray tophat = regs.TopHat (circ);
HRegionArray bothat = regs.BottomHat (circ);
HRegionArray unionX = tophat.Union2 (bothat);
img.Display (w); w.Click ();
w.SetColor ("red"); regs.Display (w); w.Click ();
w.SetColor ("blue"); tophat.Display (w); w.Click ();
w.SetColor ("green"); bothat.Display (w); w.Click ();
w.SetColor ("white"); unionX.Display (w); w.Click ();
return(0);
}
Beispiel (C)
my_morph_hat(Hobject *In, Hobject StructElement, Hobject *Out)
{
Hobject top, bottom;
top_hat(In,StructElement,&top);
bottom_hat(In,StructElement,&bottom);
union2(top,bottom,Out);
}
Beispiel (C++ (HALCON 5.0-10.0))
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"
main()
{
cout << "Reproduction of 'dilation_circle ()'" << endl;
cout << "First = original image " << endl;
cout << "Red = after segmentation " << endl;
cout << "Blue = after erosion " << endl;
HByteImage img("monkey");
HWindow w;
HRegion circ = HRegion::GenCircle (10, 10, 1.5);
HRegionArray regs = (img >= 128).Connection();
HRegionArray tophat = regs.TopHat (circ);
HRegionArray bothat = regs.BottomHat (circ);
HRegionArray unionX = tophat.Union2 (bothat);
img.Display (w); w.Click ();
w.SetColor ("red"); regs.Display (w); w.Click ();
w.SetColor ("blue"); tophat.Display (w); w.Click ();
w.SetColor ("green"); bothat.Display (w); w.Click ();
w.SetColor ("white"); unionX.Display (w); w.Click ();
return(0);
}
Beispiel (C++ (HALCON 5.0-10.0))
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"
main()
{
cout << "Reproduction of 'dilation_circle ()'" << endl;
cout << "First = original image " << endl;
cout << "Red = after segmentation " << endl;
cout << "Blue = after erosion " << endl;
HByteImage img("monkey");
HWindow w;
HRegion circ = HRegion::GenCircle (10, 10, 1.5);
HRegionArray regs = (img >= 128).Connection();
HRegionArray tophat = regs.TopHat (circ);
HRegionArray bothat = regs.BottomHat (circ);
HRegionArray unionX = tophat.Union2 (bothat);
img.Display (w); w.Click ();
w.SetColor ("red"); regs.Display (w); w.Click ();
w.SetColor ("blue"); tophat.Display (w); w.Click ();
w.SetColor ("green"); bothat.Display (w); w.Click ();
w.SetColor ("white"); unionX.Display (w); w.Click ();
return(0);
}
Beispiel (C++ (HALCON 5.0-10.0))
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"
main()
{
cout << "Reproduction of 'dilation_circle ()'" << endl;
cout << "First = original image " << endl;
cout << "Red = after segmentation " << endl;
cout << "Blue = after erosion " << endl;
HByteImage img("monkey");
HWindow w;
HRegion circ = HRegion::GenCircle (10, 10, 1.5);
HRegionArray regs = (img >= 128).Connection();
HRegionArray tophat = regs.TopHat (circ);
HRegionArray bothat = regs.BottomHat (circ);
HRegionArray unionX = tophat.Union2 (bothat);
img.Display (w); w.Click ();
w.SetColor ("red"); regs.Display (w); w.Click ();
w.SetColor ("blue"); tophat.Display (w); w.Click ();
w.SetColor ("green"); bothat.Display (w); w.Click ();
w.SetColor ("white"); unionX.Display (w); w.Click ();
return(0);
}
Ergebnis
Bei korrekter Parametrisierung liefert die Funktion
morph_hatmorph_hatMorphHatMorphHatMorphHat
den Wert 2 (H_MSG_TRUE). Das Funktionsverhalten für
die beiden Fälle leere und keine Eingaberegion lässt sich wie
folgt kontrollieren:
-
keine Region:
set_system('no_object_result',<RegionResult>)
-
leere Region:
set_system('empty_region_result',<RegionResult>)
Andernfalls wird eine Fehlerbehandlung durchgeführt.
Vorgänger
thresholdthresholdThresholdThresholdThreshold
,
regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowing
,
connectionconnectionConnectionConnectionConnection
,
union1union1Union1Union1Union1
,
watershedswatershedsWatershedsWatershedsWatersheds
,
class_ndim_normclass_ndim_normClassNdimNormClassNdimNormClassNdimNorm
,
gen_circlegen_circleGenCircleGenCircleGenCircle
,
gen_ellipsegen_ellipseGenEllipseGenEllipseGenEllipse
,
gen_rectangle1gen_rectangle1GenRectangle1GenRectangle1GenRectangle1
,
gen_rectangle2gen_rectangle2GenRectangle2GenRectangle2GenRectangle2
,
draw_regiondraw_regionDrawRegionDrawRegionDrawRegion
,
gen_region_pointsgen_region_pointsGenRegionPointsGenRegionPointsGenRegionPoints
,
gen_region_polygon_filledgen_region_polygon_filledGenRegionPolygonFilledGenRegionPolygonFilledGenRegionPolygonFilled
Nachfolger
reduce_domainreduce_domainReduceDomainReduceDomainReduceDomain
,
select_shapeselect_shapeSelectShapeSelectShapeSelectShape
,
area_centerarea_centerAreaCenterAreaCenterAreaCenter
,
connectionconnectionConnectionConnectionConnection
Alternativen
top_hattop_hatTopHatTopHatTopHat
,
bottom_hatbottom_hatBottomHatBottomHatBottomHat
,
union2union2Union2Union2Union2
Siehe auch
openingopeningOpeningOpeningOpening
,
closingclosingClosingClosingClosing
Modul
Foundation