erosion_circleerosion_circleErosionCircleErosionCircleerosion_circle (Operator)

Name

erosion_circleerosion_circleErosionCircleErosionCircleerosion_circle — Erode a region with a circular structuring element.

Signature

erosion_circle(Region : RegionErosion : Radius : )

Herror erosion_circle(const Hobject Region, Hobject* RegionErosion, double Radius)

Herror T_erosion_circle(const Hobject Region, Hobject* RegionErosion, const Htuple Radius)

void ErosionCircle(const HObject& Region, HObject* RegionErosion, const HTuple& Radius)

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

HRegion HRegion::ErosionCircle(double Radius) const

static void HOperatorSet.ErosionCircle(HObject region, out HObject regionErosion, HTuple radius)

HRegion HRegion.ErosionCircle(HTuple radius)

HRegion HRegion.ErosionCircle(double radius)

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

Description

erosion_circleerosion_circleErosionCircleErosionCircleerosion_circle applies a Minkowski subtraction with a circular structuring element to the input regions RegionRegionRegionregionregion. Because the circular mask is symmetrical, this is identical to an erosion. The size of the circle used as structuring element is determined by RadiusRadiusRadiusradiusradius.

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

Execution Information

Parameters

RegionRegionRegionregionregion (input_object)  region(-array) objectHRegionHObjectHObjectHobject

Regions to be eroded.

RegionErosionRegionErosionRegionErosionregionErosionregion_erosion (output_object)  region(-array) objectHRegionHObjectHObjectHobject *

Eroded regions.

RadiusRadiusRadiusradiusradius (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 ≤ 511.5 (lin)

Minimum increment: 1.0

Recommended increment: 1.0

Example (C++)

#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"

main()
{
  cout << "Simulation of 'erosion_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 minsub = regs.MinkowskiSub1 (circ, 1);

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

  return(0);
}

Example (C)

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

Example (C++)

#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"

main()
{
  cout << "Simulation of 'erosion_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 minsub = regs.MinkowskiSub1 (circ, 1);

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

  return(0);
}

Example (C++)

#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"

main()
{
  cout << "Simulation of 'erosion_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 minsub = regs.MinkowskiSub1 (circ, 1);

                         img.Display (w);      w.Click ();
  w.SetColor ("red");   regs.Display (w);     w.Click ();
  w.SetColor ("blue");  minsub.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

erosion_circleerosion_circleErosionCircleErosionCircleerosion_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

thresholdthresholdThresholdThresholdthreshold, regiongrowingregiongrowingRegiongrowingRegiongrowingregiongrowing, watershedswatershedsWatershedsWatershedswatersheds, class_ndim_normclass_ndim_normClassNdimNormClassNdimNormclass_ndim_norm

Possible Successors

connectionconnectionConnectionConnectionconnection, reduce_domainreduce_domainReduceDomainReduceDomainreduce_domain, select_shapeselect_shapeSelectShapeSelectShapeselect_shape, area_centerarea_centerAreaCenterAreaCenterarea_center

Alternatives

minkowski_sub1minkowski_sub1MinkowskiSub1MinkowskiSub1minkowski_sub1

See also

gen_circlegen_circleGenCircleGenCirclegen_circle, dilation_circledilation_circleDilationCircleDilationCircledilation_circle, closing_circleclosing_circleClosingCircleClosingCircleclosing_circle, opening_circleopening_circleOpeningCircleOpeningCircleopening_circle

Module

Foundation