ClassesClassesClassesClasses | | | | Operators

opening_segopening_segOpeningSegopening_segOpeningSegOpeningSeg (Operator)

Name

opening_segopening_segOpeningSegopening_segOpeningSegOpeningSeg — Separate overlapping regions.

Warning

opening_segopening_segOpeningSegopening_segOpeningSegOpeningSeg is obsolete and is only provided for reasons of backward compatibility.

Signature

opening_seg(Region, StructElement : RegionOpening : : )

Herror opening_seg(const Hobject Region, const Hobject StructElement, Hobject* RegionOpening)

Herror T_opening_seg(const Hobject Region, const Hobject StructElement, Hobject* RegionOpening)

Herror opening_seg(Hobject Region, Hobject StructElement, Hobject* RegionOpening)

HRegionArray HRegion::OpeningSeg(const HRegion& StructElement) const

HRegionArray HRegionArray::OpeningSeg(const HRegion& StructElement) const

void OpeningSeg(const HObject& Region, const HObject& StructElement, HObject* RegionOpening)

HRegion HRegion::OpeningSeg(const HRegion& StructElement) const

void HOperatorSetX.OpeningSeg(
[in] IHUntypedObjectX* Region, [in] IHUntypedObjectX* StructElement, [out] IHUntypedObjectX*RegionOpening)

IHRegionX* HRegionX.OpeningSeg([in] IHRegionX* StructElement)

static void HOperatorSet.OpeningSeg(HObject region, HObject structElement, out HObject regionOpening)

HRegion HRegion.OpeningSeg(HRegion structElement)

Description

The opening_segopening_segOpeningSegopening_segOpeningSegOpeningSeg operation is defined as a sequence of the following operators: erosion1erosion1Erosion1erosion1Erosion1Erosion1, connectionconnectionConnectionconnectionConnectionConnection and dilation1dilation1Dilation1dilation1Dilation1Dilation1 (see example). Only one iteration is done in erosion1erosion1Erosion1erosion1Erosion1Erosion1 and dilation1dilation1Dilation1dilation1Dilation1Dilation1.

opening_segopening_segOpeningSegopening_segOpeningSegOpeningSeg serves to separate overlapping regions whose area of overlap is smaller than StructElementStructElementStructElementStructElementStructElementstructElement. It should be noted that the resulting regions can overlap without actually merging (see expand_regionexpand_regionExpandRegionexpand_regionExpandRegionExpandRegion). opening_segopening_segOpeningSegopening_segOpeningSegOpeningSeg uses the center of gravity as the reference point of the structuring element.

Structuring elements (StructElementStructElementStructElementStructElementStructElementstructElement) can be generated with operators such as gen_circlegen_circleGenCirclegen_circleGenCircleGenCircle, gen_rectangle1gen_rectangle1GenRectangle1gen_rectangle1GenRectangle1GenRectangle1, gen_rectangle2gen_rectangle2GenRectangle2gen_rectangle2GenRectangle2GenRectangle2, gen_ellipsegen_ellipseGenEllipsegen_ellipseGenEllipseGenEllipse, draw_regiondraw_regionDrawRegiondraw_regionDrawRegionDrawRegion, gen_region_polygongen_region_polygonGenRegionPolygongen_region_polygonGenRegionPolygonGenRegionPolygon, gen_region_pointsgen_region_pointsGenRegionPointsgen_region_pointsGenRegionPointsGenRegionPoints, etc.

Parallelization

Parameters

RegionRegionRegionRegionRegionregion (input_object)  region(-array) objectHRegionHRegionHRegionHRegionXHobject

Regions to be opened.

StructElementStructElementStructElementStructElementStructElementstructElement (input_object)  region objectHRegionHRegionHRegionHRegionXHobject

Structuring element (position-invariant).

RegionOpeningRegionOpeningRegionOpeningRegionOpeningRegionOpeningregionOpening (output_object)  region-array objectHRegionHRegionHRegionArrayHRegionXHobject *

Opened regions.

Example (HDevelop)

* Simulation of opening_seg
* opening_seg(Region,StructElement,RegionOpening):
    erosion1(Region,StructElement,H1,1)
    connection(H1,H2)
    dilation1(H2,StructElement,RegionOpening,1)

Example (C)

/* Simulation of opening_seg */
my_opening_seg(Hobject Region, Hobject StructElement, Hobject *Opening)
{
  Hobject  H1,H2;
  erosion1(Region,StructElement,&H1,1);
  connection(H1,&H2);
  dilation1(H2,StructElement,Opening,1);
  clear_obj(H1); clear_obj(H2);
}

/* separation of circular objects */
gen_random_regions(&Regions,"circle",8.5,10.5,0.0,0.0,0.0,0.0,400,512,512);
union1(Regions,&UnionReg);
gen_circle(&Mask,100,100,8.5);
opening_seg(UnionReg,Mask,&RegionsNew);

Example (HDevelop)

* Simulation of opening_seg
* opening_seg(Region,StructElement,RegionOpening):
    erosion1(Region,StructElement,H1,1)
    connection(H1,H2)
    dilation1(H2,StructElement,RegionOpening,1)

Example (C++ (HALCON 5.0-10.0))

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

main()
{
  HWindow  w;
  HRegionArray regs = HRegionArray::GenRandomRegions("circle",8.5,10.5,
                                                  0,0,0,0,400,512,512);

  HRegionArray ureg = regs.Union1();
  HRegion      crc  = HRegion::GenCircle(100,100,8.5);
  HRegionArray ops  = ureg.OpeningSeg(crc);

  w.SetColor("red");   regs.Display(w);  w.Click();
  w.SetColored(12);    ops.Display(w);   w.Click();

  return(0);
}

Example (HDevelop)

* Simulation of opening_seg
* opening_seg(Region,StructElement,RegionOpening):
    erosion1(Region,StructElement,H1,1)
    connection(H1,H2)
    dilation1(H2,StructElement,RegionOpening,1)

Example (HDevelop)

* Simulation of opening_seg
* opening_seg(Region,StructElement,RegionOpening):
    erosion1(Region,StructElement,H1,1)
    connection(H1,H2)
    dilation1(H2,StructElement,RegionOpening,1)

Complexity

Let F1 be the area of the input region, and F2 be the area of the structuring element. Then the runtime complexity for one region is:

Result

opening_segopening_segOpeningSegopening_segOpeningSegOpeningSeg 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_normClassNdimNormclass_ndim_normClassNdimNormClassNdimNorm, gen_circlegen_circleGenCirclegen_circleGenCircleGenCircle, gen_ellipsegen_ellipseGenEllipsegen_ellipseGenEllipseGenEllipse, gen_rectangle1gen_rectangle1GenRectangle1gen_rectangle1GenRectangle1GenRectangle1, gen_rectangle2gen_rectangle2GenRectangle2gen_rectangle2GenRectangle2GenRectangle2, draw_regiondraw_regionDrawRegiondraw_regionDrawRegionDrawRegion, gen_region_pointsgen_region_pointsGenRegionPointsgen_region_pointsGenRegionPointsGenRegionPoints, gen_region_polygon_filledgen_region_polygon_filledGenRegionPolygonFilledgen_region_polygon_filledGenRegionPolygonFilledGenRegionPolygonFilled

Possible Successors

expand_regionexpand_regionExpandRegionexpand_regionExpandRegionExpandRegion, reduce_domainreduce_domainReduceDomainreduce_domainReduceDomainReduceDomain, select_shapeselect_shapeSelectShapeselect_shapeSelectShapeSelectShape, area_centerarea_centerAreaCenterarea_centerAreaCenterAreaCenter, connectionconnectionConnectionconnectionConnectionConnection

Alternatives

erosion1erosion1Erosion1erosion1Erosion1Erosion1, connectionconnectionConnectionconnectionConnectionConnection, dilation1dilation1Dilation1dilation1Dilation1Dilation1

Module

Foundation


ClassesClassesClassesClasses | | | | Operators