dilation_rectangle1dilation_rectangle1DilationRectangle1DilationRectangle1 (Operator)

Name

dilation_rectangle1dilation_rectangle1DilationRectangle1DilationRectangle1 — 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)

Beschreibung

dilation_rectangle1dilation_rectangle1DilationRectangle1DilationRectangle1DilationRectangle1 führt eine Dilatation auf der/den angegebenen Region(en) RegionRegionRegionRegionregion durch. Das strukturierende Element für diese Operation bildet ein Rechteck mit der Größe WidthWidthWidthWidthwidth x HeightHeightHeightHeightheight. 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_rectangle1DilationRectangle1DilationRectangle1DilationRectangle1 ist eine sehr schnelle Operation, da die Höhe des Rechtecks nur logarithmisch, die Breite gar nicht in die Komplexita"t eingeht. Dies führt auch bei sehr großen Rechtecken (Kante > 100) zu einem sehr gutem Laufzeitverhalten.

Achtung

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

Damit eine Region in alle Richtungen gleichmäßig vergrößert wird, müssen WidthWidthWidthWidthwidth und HeightHeightHeightHeightheight 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

RegionRegionRegionRegionregion (input_object)  region(-array) objectHRegionHRegionHobject

Regionen die verarbeitet werden sollen.

RegionDilationRegionDilationRegionDilationRegionDilationregionDilation (output_object)  region(-array) objectHRegionHRegionHobject *

Ergebnis der Dilation-Operation.

WidthWidthWidthWidthwidth (input_control)  extent.x HTupleHTupleHtuple (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 ≤ 511 (lin)

Minimale Schrittweite: 1

Empfohlene Schrittweite: 10

HeightHeightHeightHeightheight (input_control)  extent.y HTupleHTupleHtuple (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 ≤ 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_rectangle1DilationRectangle1DilationRectangle1DilationRectangle1 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_normClassNdimNormClassNdimNormClassNdimNorm

Nachfolger

reduce_domainreduce_domainReduceDomainReduceDomainReduceDomain, select_shapeselect_shapeSelectShapeSelectShapeSelectShape, area_centerarea_centerAreaCenterAreaCenterAreaCenter, connectionconnectionConnectionConnectionConnection

Alternativen

minkowski_add1minkowski_add1MinkowskiAdd1MinkowskiAdd1MinkowskiAdd1, minkowski_add2minkowski_add2MinkowskiAdd2MinkowskiAdd2MinkowskiAdd2, expand_regionexpand_regionExpandRegionExpandRegionExpandRegion, dilation1dilation1Dilation1Dilation1Dilation1, dilation2dilation2Dilation2Dilation2Dilation2, dilation_circledilation_circleDilationCircleDilationCircleDilationCircle

Siehe auch

gen_rectangle1gen_rectangle1GenRectangle1GenRectangle1GenRectangle1, gen_region_polygon_filledgen_region_polygon_filledGenRegionPolygonFilledGenRegionPolygonFilledGenRegionPolygonFilled

Modul

Foundation