Skip to content

boundaryBoundaryBoundaryboundaryboundary🔗

Short description🔗

boundaryBoundaryBoundaryboundaryboundary — Reduce a region to its boundary.

Signature🔗

boundary( region Region, out region RegionBorder, string BoundaryType )void Boundary( const HObject& Region, HObject* RegionBorder, const HTuple& BoundaryType )static void HOperatorSet.Boundary( HObject region, out HObject regionBorder, HTuple boundaryType )def boundary( region: HObject, boundary_type: str ) -> HObject

Herror boundary( const Hobject Region, Hobject* RegionBorder, const char* BoundaryType )

Herror T_boundary( const Hobject Region, Hobject* RegionBorder, const Htuple BoundaryType )

HRegion HRegion::Boundary( const HString& BoundaryType ) const

HRegion HRegion::Boundary( const char* BoundaryType ) const

HRegion HRegion::Boundary( const wchar_t* BoundaryType ) const (Windows only)

HRegion HRegion.Boundary( string boundaryType )

Description🔗

boundaryBoundary computes the boundary of each input region in Regionregionregion and returns them in RegionBorderregionBorderregion_border. The parameter BoundaryTypeboundaryTypeboundary_type determines the type of boundary computation.

The contour computation is done using morphological operations. The resulting output regions consist only of the minimal border of the input regions. Their positions depend on the value of BoundaryTypeboundaryTypeboundary_type, accepting the following values:

  • 'inner'"inner": The contour lies within the original region.

  • 'inner_filled'"inner_filled": The contour lies within the original region, holes in the interior of the input region are suppressed. Due to algorithm optimization this contours may slightly differ from corresponding ones obtained with 'inner'"inner".

  • 'outer'"outer": The contour is one pixel outside of the original region.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on tuple level.

Parameters🔗

Regionregionregion (input_object) region(-array) → objectHObjectHRegionHObjectHobject

Regions for which the boundary is to be computed.

RegionBorderregionBorderregion_border (output_object) region(-array) → objectHObjectHRegionHObjectHobject *

Resulting boundaries.

BoundaryTypeboundaryTypeboundary_type (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Boundary type.

Default: 'inner'"inner"
List of values: 'inner', 'inner_filled', 'outer'"inner", "inner_filled", "outer"

Example🔗

(C)

/* Intersections of two circles: */
gen_circle(&Circle1,200.0,100.0,100.5)\;
gen_circle(&Circle2,200.0,150.0,100.5)\;
boundary(Circle1,&Margin1,"inner")\;
boundary(Circle2,&Margin2,"inner")\;
intersection(Margin1,Margin2,&Intersections)\;
connection(Intersections,&Single)\;
T_area_center(Single,NULL,&Rows,&Columns)\;

/* simulation of Mode 'inner' */
void inner(Hobject Region, Hobject *Border)
{
  Hobject  Smaller\;
  erosion_circle(Region,&Smaller,1.5)\;
  difference(Region,Smaller,Border)\;
}
(C++)
#include "HalconCpp.h"
using namespace Halcon\;

main()
{
  HWindow  w\;
  HRegion  circ1 = HRegion::GenCircle (20, 10, 10.5)\;
 circ1.Display (w)\;
  w.Click ()\;
 HRegion marg1 = circ1.Boundary ("inner")\;
  w.SetColor ("red")\;
  marg1.Display (w)\;
  w.Click ()\;
 return(0)\;
}

Complexity🔗

Let \(A\) be the area of the input region. Then the runtime complexity for one region is

\[\begin{eqnarray*} O(3 \sqrt{A}) \enspace . \end{eqnarray*}\]

Result🔗

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

  • no region: set_system('no_object_result',<RegionResult>)

  • empty region: set_system('empty_region_result',<RegionResult>)

Otherwise, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

thresholdThreshold, regiongrowingRegiongrowing, connectionConnection, union1Union1, watershedsWatersheds, class_ndim_normClassNdimNorm

Possible successors

reduce_domainReduceDomain, select_shapeSelectShape, area_centerAreaCenter, connectionConnection

Alternatives

dilation_circleDilationCircle, erosion_circleErosionCircle, differenceDifference

See also

fill_upFillUp

Module🔗

Foundation