dilation_rectangle1dilation_rectangle1DilationRectangle1DilationRectangle1dilation_rectangle1 (Operator)

Name

dilation_rectangle1dilation_rectangle1DilationRectangle1DilationRectangle1dilation_rectangle1 — Ausführen einer Dilatation mit einem Rechteck.

Signatur

dilation_rectangle1(Region : RegionDilation : Width, Height : )

Herror dilation_rectangle1(const Hobject Region, Hobject* RegionDilation, const Hlong Width, const Hlong Height)

Herror T_dilation_rectangle1(const Hobject Region, Hobject* RegionDilation, const Htuple Width, const Htuple Height)

void DilationRectangle1(const HObject& Region, HObject* RegionDilation, const HTuple& Width, const HTuple& Height)

HRegion HRegion::DilationRectangle1(Hlong Width, Hlong Height) const

static void HOperatorSet.DilationRectangle1(HObject region, out HObject regionDilation, HTuple width, HTuple height)

HRegion HRegion.DilationRectangle1(int width, int height)

def dilation_rectangle1(region: HObject, width: int, height: int) -> HObject

Beschreibung

dilation_rectangle1dilation_rectangle1DilationRectangle1DilationRectangle1DilationRectangle1dilation_rectangle1 führt eine Dilatation auf der/den angegebenen Region(en) RegionRegionRegionRegionregionregion durch. Das strukturierende Element für diese Operation bildet ein Rechteck mit der Größe WidthWidthWidthWidthwidthwidth x HeightHeightHeightHeightheightheight. Die Funktion führt zu einer Expansion der Region und zum Schließen von Löchern, die kleiner als das angegebene Rechteck sind, innerhalb der Regionen.

dilation_rectangle1dilation_rectangle1DilationRectangle1DilationRectangle1DilationRectangle1dilation_rectangle1 ist eine sehr schnelle Operation, da die Höhe des Rechtecks nur logarithmisch, die Breite gar nicht in die Komplexität eingeht. Dies führt auch bei sehr großen Rechtecken (Kante > 100) zu einem sehr gutem Laufzeitverhalten.

Achtung

dilation_rectangle1dilation_rectangle1DilationRectangle1DilationRectangle1DilationRectangle1dilation_rectangle1 wird für jede Region einzeln angewandt. Sollen Lücken zwischen den Regionen geschlossen werden, dann muss vorher ein union1union1Union1Union1Union1union1 oder union2union2Union2Union2Union2union2 ausgeführt werden.

Damit eine Region in alle Richtungen gleichmäßig vergrößert wird, müssen WidthWidthWidthWidthwidthwidth und HeightHeightHeightHeightheightheight ungerade sein. Falls das nicht der Fall ist, wird die Region rechts bzw. unten um ein Pixel weiter dilatiert als nach links bzw. oben.

Ausführungsinformationen

Parameter

RegionRegionRegionRegionregionregion (input_object)  region(-array) objectHRegionHObjectHRegionHobject

Regionen die verarbeitet werden sollen.

RegionDilationRegionDilationRegionDilationRegionDilationregionDilationregion_dilation (output_object)  region(-array) objectHRegionHObjectHRegionHobject *

Ergebnis der Dilation-Operation.

WidthWidthWidthWidthwidthwidth (input_control)  extent.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Breite des Rechtecks.

Defaultwert: 11

Wertevorschläge: 1, 2, 3, 4, 5, 11, 15, 21, 31, 51, 71, 101, 151, 201

Typischer Wertebereich: 1 ≤ Width Width Width Width width width ≤ 511 (lin)

Minimale Schrittweite: 1

Empfohlene Schrittweite: 10

HeightHeightHeightHeightheightheight (input_control)  extent.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Höhe des Rechtecks.

Defaultwert: 11

Wertevorschläge: 1, 2, 3, 4, 5, 11, 15, 21, 31, 51, 71, 101, 151, 201

Typischer Wertebereich: 1 ≤ Height Height Height Height height height ≤ 511 (lin)

Minimale Schrittweite: 1

Empfohlene Schrittweite: 10

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_rectangle ()'" << endl;
  cout << "First = original image " << endl;
  cout << "Blue  = after dilation " << endl;
  cout << "Red   = after segmentation " << endl;

  HByteImage img("monkey");
  HWindow    w;

  HRegionArray regs   = (img >= 220).Connection();
  HRegionArray dilreg = regs.DilationRectangle1 (2, 4);

                        img.Display (w);      w.Click ();
  w.SetColor ("blue");  dilreg.Display (w);   w.Click ();
  w.SetColor ("red");   regs.Display (w);     w.Click ();

  return(0);
}

Beispiel (C)

threshold(Image,&Light,220.0,255.0);
dilation_rectangle1(Light,&Wide,50,50);
set_color(WindowHandle,"red");
disp_region(Wide,WindowHandle);
set_color(WindowHandle,"white");
disp_region(Light,WindowHandle);

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_rectangle ()'" << endl;
  cout << "First = original image " << endl;
  cout << "Blue  = after dilation " << endl;
  cout << "Red   = after segmentation " << endl;

  HByteImage img("monkey");
  HWindow    w;

  HRegionArray regs   = (img >= 220).Connection();
  HRegionArray dilreg = regs.DilationRectangle1 (2, 4);

                        img.Display (w);      w.Click ();
  w.SetColor ("blue");  dilreg.Display (w);   w.Click ();
  w.SetColor ("red");   regs.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_rectangle ()'" << endl;
  cout << "First = original image " << endl;
  cout << "Blue  = after dilation " << endl;
  cout << "Red   = after segmentation " << endl;

  HByteImage img("monkey");
  HWindow    w;

  HRegionArray regs   = (img >= 220).Connection();
  HRegionArray dilreg = regs.DilationRectangle1 (2, 4);

                        img.Display (w);      w.Click ();
  w.SetColor ("blue");  dilreg.Display (w);   w.Click ();
  w.SetColor ("red");   regs.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_rectangle ()'" << endl;
  cout << "First = original image " << endl;
  cout << "Blue  = after dilation " << endl;
  cout << "Red   = after segmentation " << endl;

  HByteImage img("monkey");
  HWindow    w;

  HRegionArray regs   = (img >= 220).Connection();
  HRegionArray dilreg = regs.DilationRectangle1 (2, 4);

                        img.Display (w);      w.Click ();
  w.SetColor ("blue");  dilreg.Display (w);   w.Click ();
  w.SetColor ("red");   regs.Display (w);     w.Click ();

  return(0);
}

Komplexität

Sei F1 die Fläche einer Eingaberegion und H die Höhe des Rechtecks, dann ist die Laufzeitkomplexität für eine Region:

Ergebnis

Bei korrekter Parametrisierung liefert die Funktion dilation_rectangle1dilation_rectangle1DilationRectangle1DilationRectangle1DilationRectangle1dilation_rectangle1 den Wert 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

thresholdthresholdThresholdThresholdThresholdthreshold, regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing, connectionconnectionConnectionConnectionConnectionconnection, union1union1Union1Union1Union1union1, watershedswatershedsWatershedsWatershedsWatershedswatersheds, class_ndim_normclass_ndim_normClassNdimNormClassNdimNormClassNdimNormclass_ndim_norm

Nachfolger

reduce_domainreduce_domainReduceDomainReduceDomainReduceDomainreduce_domain, select_shapeselect_shapeSelectShapeSelectShapeSelectShapeselect_shape, area_centerarea_centerAreaCenterAreaCenterAreaCenterarea_center, connectionconnectionConnectionConnectionConnectionconnection

Alternativen

minkowski_add1minkowski_add1MinkowskiAdd1MinkowskiAdd1MinkowskiAdd1minkowski_add1, minkowski_add2minkowski_add2MinkowskiAdd2MinkowskiAdd2MinkowskiAdd2minkowski_add2, expand_regionexpand_regionExpandRegionExpandRegionExpandRegionexpand_region, dilation1dilation1Dilation1Dilation1Dilation1dilation1, dilation2dilation2Dilation2Dilation2Dilation2dilation2, dilation_circledilation_circleDilationCircleDilationCircleDilationCircledilation_circle

Siehe auch

gen_rectangle1gen_rectangle1GenRectangle1GenRectangle1GenRectangle1gen_rectangle1, gen_region_polygon_filledgen_region_polygon_filledGenRegionPolygonFilledGenRegionPolygonFilledGenRegionPolygonFilledgen_region_polygon_filled

Modul

Foundation