dilation_circledilation_circleDilationCircleDilationCircledilation_circle (Operator)

Name

dilation_circledilation_circleDilationCircleDilationCircledilation_circle — Dilate a region with a circular structuring element.

Signature

dilation_circle(Region : RegionDilation : Radius : )

Herror dilation_circle(const Hobject Region, Hobject* RegionDilation, double Radius)

Herror T_dilation_circle(const Hobject Region, Hobject* RegionDilation, const Htuple Radius)

void DilationCircle(const HObject& Region, HObject* RegionDilation, const HTuple& Radius)

HRegion HRegion::DilationCircle(const HTuple& Radius) const

HRegion HRegion::DilationCircle(double Radius) const

static void HOperatorSet.DilationCircle(HObject region, out HObject regionDilation, HTuple radius)

HRegion HRegion.DilationCircle(HTuple radius)

HRegion HRegion.DilationCircle(double radius)

def dilation_circle(region: HObject, radius: Union[float, int]) -> HObject

Description

dilation_circledilation_circleDilationCircleDilationCircleDilationCircledilation_circle applies a Minkowski addition with a circular structuring element to the input regions RegionRegionRegionRegionregionregion. Because the circular mask is symmetrical, this is identical to a dilation. The size of the circle used as structuring element is determined by RadiusRadiusRadiusRadiusradiusradius.

The operator results in enlarged regions, smoothed region boundaries, and the holes smaller than the circular mask in the interior of the region are closed. It is useful to select only values like 3.5, 5.5, etc. for RadiusRadiusRadiusRadiusradiusradius in order to avoid a translation of a region, because integer radii result in the circle having a non-integer center of gravity which is rounded to the next integer.

Attention

dilation_circledilation_circleDilationCircleDilationCircleDilationCircledilation_circle is applied to each input region separately. If gaps between different regions are to be closed, union1union1Union1Union1Union1union1 or union2union2Union2Union2Union2union2 has to be called first.

Execution Information

Parameters

RegionRegionRegionRegionregionregion (input_object)  region(-array) objectHRegionHObjectHRegionHobject

Regions to be dilated.

RegionDilationRegionDilationRegionDilationRegionDilationregionDilationregion_dilation (output_object)  region(-array) objectHRegionHObjectHRegionHobject *

Dilated regions.

RadiusRadiusRadiusRadiusradiusradius (input_control)  real HTupleUnion[float, int]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Radius of the circular structuring element.

Default: 3.5

Suggested values: 1.5, 2.5, 3.5, 4.5, 5.5, 7.5, 9.5, 12.5, 15.5, 19.5, 25.5, 33.5, 45.5, 60.5, 110.5

Value range: 0.5 ≤ Radius Radius Radius Radius radius radius ≤ 511.5 (lin)

Minimum increment: 1.0

Recommended increment: 1.0

Example (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 << "Blue  = after dilation " << endl;
  cout << "Red   = before dilation " << endl;

  HByteImage img("monkey");
  HWindow    w;

  HRegion      circ   = HRegion::GenCircle (10, 10, 1.5);
  HRegionArray regs   = (img >= 128).Connection();
  HRegionArray minadd = regs.MinkowskiAdd1 (circ, 1);

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

  return(0);
}

Example (C)

my_dilation_circle(Hobject In, double Radius, Hobject *Out)
{
  Hobject Circle;
  gen_circle(&Circle,100.0,100.0,Radius);
  minkowski_add1(In,Circle,Out,1);
}

Example (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 << "Blue  = after dilation " << endl;
  cout << "Red   = before dilation " << endl;

  HByteImage img("monkey");
  HWindow    w;

  HRegion      circ   = HRegion::GenCircle (10, 10, 1.5);
  HRegionArray regs   = (img >= 128).Connection();
  HRegionArray minadd = regs.MinkowskiAdd1 (circ, 1);

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

  return(0);
}

Example (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 << "Blue  = after dilation " << endl;
  cout << "Red   = before dilation " << endl;

  HByteImage img("monkey");
  HWindow    w;

  HRegion      circ   = HRegion::GenCircle (10, 10, 1.5);
  HRegionArray regs   = (img >= 128).Connection();
  HRegionArray minadd = regs.MinkowskiAdd1 (circ, 1);

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

  return(0);
}

Example (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 << "Blue  = after dilation " << endl;
  cout << "Red   = before dilation " << endl;

  HByteImage img("monkey");
  HWindow    w;

  HRegion      circ   = HRegion::GenCircle (10, 10, 1.5);
  HRegionArray regs   = (img >= 128).Connection();
  HRegionArray minadd = regs.MinkowskiAdd1 (circ, 1);

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

  return(0);
}

Complexity

Let F1 be the area of an input region. Then the runtime complexity for one region is:

Result

dilation_circledilation_circleDilationCircleDilationCircleDilationCircledilation_circle returns 2 ( H_MSG_TRUE) if all parameters are correct. The behavior in case of empty or no input region can be set via:

Otherwise, an exception is raised.

Possible Predecessors

thresholdthresholdThresholdThresholdThresholdthreshold, regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing, connectionconnectionConnectionConnectionConnectionconnection, union1union1Union1Union1Union1union1, watershedswatershedsWatershedsWatershedsWatershedswatersheds, class_ndim_normclass_ndim_normClassNdimNormClassNdimNormClassNdimNormclass_ndim_norm

Possible Successors

reduce_domainreduce_domainReduceDomainReduceDomainReduceDomainreduce_domain, select_shapeselect_shapeSelectShapeSelectShapeSelectShapeselect_shape, area_centerarea_centerAreaCenterAreaCenterAreaCenterarea_center, connectionconnectionConnectionConnectionConnectionconnection

Alternatives

minkowski_add1minkowski_add1MinkowskiAdd1MinkowskiAdd1MinkowskiAdd1minkowski_add1, minkowski_add2minkowski_add2MinkowskiAdd2MinkowskiAdd2MinkowskiAdd2minkowski_add2, expand_regionexpand_regionExpandRegionExpandRegionExpandRegionexpand_region, dilation1dilation1Dilation1Dilation1Dilation1dilation1, dilation2dilation2Dilation2Dilation2Dilation2dilation2, dilation_rectangle1dilation_rectangle1DilationRectangle1DilationRectangle1DilationRectangle1dilation_rectangle1

See also

gen_circlegen_circleGenCircleGenCircleGenCirclegen_circle, erosion_circleerosion_circleErosionCircleErosionCircleErosionCircleerosion_circle, closing_circleclosing_circleClosingCircleClosingCircleClosingCircleclosing_circle, opening_circleopening_circleOpeningCircleOpeningCircleOpeningCircleopening_circle

Module

Foundation