morph_hatmorph_hatMorphHatMorphHatmorph_hat (Operator)

Name

morph_hatmorph_hatMorphHatMorphHatmorph_hat — Vereinigen von bottom_hatbottom_hatBottomHatBottomHatbottom_hat und top_hattop_hatTopHatTopHattop_hat.

Warnung

morph_hatmorph_hatMorphHatMorphHatmorph_hat ist veraltet und wird nur aus Gründen der Rückwärtskompatibilität zur Verfügung gestellt.

Signatur

morph_hat(Region, StructElement : RegionMorphHat : : )

Herror morph_hat(const Hobject Region, const Hobject StructElement, Hobject* RegionMorphHat)

Herror T_morph_hat(const Hobject Region, const Hobject StructElement, Hobject* RegionMorphHat)

void MorphHat(const HObject& Region, const HObject& StructElement, HObject* RegionMorphHat)

HRegion HRegion::MorphHat(const HRegion& StructElement) const

static void HOperatorSet.MorphHat(HObject region, HObject structElement, out HObject regionMorphHat)

HRegion HRegion.MorphHat(HRegion structElement)

def morph_hat(region: HObject, struct_element: HObject) -> HObject

Beschreibung

morph_hatmorph_hatMorphHatMorphHatmorph_hat 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_hatTopHatTopHattop_hat und bottom_hatbottom_hatBottomHatBottomHatbottom_hat. Die Position von StructElementStructElementStructElementstructElementstruct_element ist ohne Bedeutung.

Das strukturierende Element (StructElementStructElementStructElementstructElementstruct_element) kann mit Operatoren wie gen_circlegen_circleGenCircleGenCirclegen_circle, gen_rectangle1gen_rectangle1GenRectangle1GenRectangle1gen_rectangle1, gen_rectangle2gen_rectangle2GenRectangle2GenRectangle2gen_rectangle2, gen_ellipsegen_ellipseGenEllipseGenEllipsegen_ellipse, draw_regiondraw_regionDrawRegionDrawRegiondraw_region, gen_region_polygongen_region_polygonGenRegionPolygonGenRegionPolygongen_region_polygon, gen_region_pointsgen_region_pointsGenRegionPointsGenRegionPointsgen_region_points, etc. erzeugt werden.

Achtung

Die Regionen werden einzeln bearbeitet.

Ausführungsinformationen

Parameter

RegionRegionRegionregionregion (input_object)  region(-array) objectHRegionHObjectHObjectHobject

Regionen, die verarbeitet werden sollen.

StructElementStructElementStructElementstructElementstruct_element (input_object)  region objectHRegionHObjectHObjectHobject

Strukturierendes Element (lageinvariant).

RegionMorphHatRegionMorphHatRegionMorphHatregionMorphHatregion_morph_hat (output_object)  region(-array) objectHRegionHObjectHObjectHobject *

Vereinigung von Top-Hat und Bottom-Hat.

Beispiel (C++)

#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++)

#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++)

#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_hatMorphHatMorphHatmorph_hat den Wert 2 ( H_MSG_TRUE) . Das Funktionsverhalten für die beiden Fälle leere und keine Eingaberegion lässt sich wie folgt kontrollieren:

Andernfalls wird eine Fehlerbehandlung durchgeführt.

Vorgänger

thresholdthresholdThresholdThresholdthreshold, regiongrowingregiongrowingRegiongrowingRegiongrowingregiongrowing, connectionconnectionConnectionConnectionconnection, union1union1Union1Union1union1, watershedswatershedsWatershedsWatershedswatersheds, class_ndim_normclass_ndim_normClassNdimNormClassNdimNormclass_ndim_norm, gen_circlegen_circleGenCircleGenCirclegen_circle, gen_ellipsegen_ellipseGenEllipseGenEllipsegen_ellipse, gen_rectangle1gen_rectangle1GenRectangle1GenRectangle1gen_rectangle1, gen_rectangle2gen_rectangle2GenRectangle2GenRectangle2gen_rectangle2, draw_regiondraw_regionDrawRegionDrawRegiondraw_region, gen_region_pointsgen_region_pointsGenRegionPointsGenRegionPointsgen_region_points, gen_region_polygon_filledgen_region_polygon_filledGenRegionPolygonFilledGenRegionPolygonFilledgen_region_polygon_filled

Nachfolger

reduce_domainreduce_domainReduceDomainReduceDomainreduce_domain, select_shapeselect_shapeSelectShapeSelectShapeselect_shape, area_centerarea_centerAreaCenterAreaCenterarea_center, connectionconnectionConnectionConnectionconnection

Alternativen

top_hattop_hatTopHatTopHattop_hat, bottom_hatbottom_hatBottomHatBottomHatbottom_hat, union2union2Union2Union2union2

Siehe auch

openingopeningOpeningOpeningopening, closingclosingClosingClosingclosing

Modul

Foundation