HALCON Reference Manual / Morphology / Region Operators

opening (Operator)

Name

opening — Open a region.

Synopsis

opening(Region, StructElement : RegionOpening : : )

Description

An opening operation is defined as an erosion followed by a Minkowsi addition. By applying opening to a region, larger structures remain mostly intact, while small structures like lines or points are eliminated. In contrast, a closing operation results in small gaps being retained or filled up (see closing).

opening serves to eliminate small regions (smaller than StructElement) and to smooth the boundaries of a region. The position of StructElement is meaningless, since an opening operation is invariant with respect to the choice of the reference point.

Structuring elements (StructElement) can be generated with operators such as gen_circle, gen_rectangle1, gen_rectangle2, gen_ellipse, draw_region, gen_region_polygon, gen_region_points, etc.

Parameters

Region (input_object) region(-array) object
Regions to be opened.

StructElement (input_object) region object
Structuring element (position-invariant).

RegionOpening (output_object) region(-array) object
Opened regions.

Example

* Large regions in an aerial picture (beech trees or meadows):
read_image(Image,'wald1')
threshold(Image,Light,80,255)
gen_circle(StructElement1,100,100,2)
gen_circle(StructElement2,100,100,20)
* close the small gap
closing(Light,StructElement1,H)
* selecting the large regions
opening(H,StructElement2,Large)

* Selecting of edges with certain orientation:
read_image(Image,'fabrik')
sobel_amp(Image,Sobel,'sum_abs',3)
threshold(Sobel,Edges,10,255)
gen_rectangle2(StructElement,100,100,3.07819,20,1)
opening(Edges,StructElement,Direction)

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:

    O(2 * sqrt(F1) * sqrt(F2)) .

Result

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

  a) no region:    set_system('no_object_result',<RegionResult>)
  b) empty region: set_system('empty_region_result',<RegionResult>)

Otherwise, an exception is raised.

Parallelization Information

opening is reentrant and automatically parallelized (on tuple level).

Possible Predecessors

threshold, regiongrowing, connection, union1, watersheds, class_ndim_norm, gen_circle, gen_ellipse, gen_rectangle1, gen_rectangle2, draw_region, gen_region_points, gen_struct_elements, gen_region_polygon_filled

Possible Successors

reduce_domain, select_shape, area_center, connection

Alternatives

minkowski_add1, erosion1, opening_circle

See also

gen_circle, gen_rectangle2, gen_region_polygon

Module

Foundation


HALCON Reference Manual / Morphology / Region Operators
Version 9.0.2 Copyright © 1996-2010 MVTec Software GmbH