closing closing Closing Closing closing (Operator)
Name
closing closing Closing Closing closing
— Close a region.
Signature
Description
A closing closing Closing Closing Closing closing
operation is defined as a dilation followed
by a Minkowski subtraction. By applying closing closing Closing Closing Closing closing
to a
region, larger structures remain mostly intact, while small gaps
between adjacent regions and holes smaller than
StructElement StructElement StructElement StructElement structElement struct_element
are closed, and the regions' boundaries are
smoothed. All closing closing Closing Closing Closing closing
variants share the property that
separate regions are not merged, but remain separate objects. The
position of StructElement StructElement StructElement StructElement structElement struct_element
is meaningless, since a closing
operation is invariant with respect to the choice of the reference
point.
Structuring elements (StructElement StructElement StructElement StructElement structElement struct_element
) can be generated
with operators such as gen_circle gen_circle GenCircle GenCircle GenCircle gen_circle
, gen_rectangle1 gen_rectangle1 GenRectangle1 GenRectangle1 GenRectangle1 gen_rectangle1
,
gen_rectangle2 gen_rectangle2 GenRectangle2 GenRectangle2 GenRectangle2 gen_rectangle2
, gen_ellipse gen_ellipse GenEllipse GenEllipse GenEllipse gen_ellipse
,
draw_region draw_region DrawRegion DrawRegion DrawRegion draw_region
, gen_region_polygon gen_region_polygon GenRegionPolygon GenRegionPolygon GenRegionPolygon gen_region_polygon
,
gen_region_points gen_region_points GenRegionPoints GenRegionPoints GenRegionPoints gen_region_points
, etc.
Attention
closing closing Closing Closing Closing closing
is applied to each input region separately. If
gaps between different regions are to be closed, union1 union1 Union1 Union1 Union1 union1
or union2 union2 Union2 Union2 Union2 union2
has to be called first.
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
Region Region Region Region region region
(input_object) region(-array) →
object HRegion HObject HRegion Hobject
Regions to be closed.
StructElement StructElement StructElement StructElement structElement struct_element
(input_object) region →
object HRegion HObject HRegion Hobject
Structuring element (position-invariant).
RegionClosing RegionClosing RegionClosing RegionClosing regionClosing region_closing
(output_object) region(-array) →
object HRegion HObject HRegion Hobject *
Closed regions.
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 'closing ()' using " << endl;
cout << "'dilation()' and 'minkowski_sub1()'" << endl;
HByteImage img("monkey");
HWindow w;
HRegion circ = HRegion::GenCircle (10, 10, 1.5);
HRegionArray regs = (img >= 128).Connection();
HRegionArray dilreg = regs.Dilation1 (circ, 1);
HRegionArray minsub = dilreg.MinkowskiSub1 (circ, 1);
img.Display (w); w.Click ();
w.SetColor ("red"); regs.Display (w); w.Click ();
w.SetColor ("green"); dilreg.Display (w); w.Click ();
w.SetColor ("blue"); minsub.Display (w); w.Click ();
return(0);
}
Example (C)
my_closing(Hobject In, Hobject StructElement, Hobject *Out)
{
Hobject tmp;
dilation1(In,StructElement,&tmp,1);
minkowski_sub1(tmp,StructElement,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 'closing ()' using " << endl;
cout << "'dilation()' and 'minkowski_sub1()'" << endl;
HByteImage img("monkey");
HWindow w;
HRegion circ = HRegion::GenCircle (10, 10, 1.5);
HRegionArray regs = (img >= 128).Connection();
HRegionArray dilreg = regs.Dilation1 (circ, 1);
HRegionArray minsub = dilreg.MinkowskiSub1 (circ, 1);
img.Display (w); w.Click ();
w.SetColor ("red"); regs.Display (w); w.Click ();
w.SetColor ("green"); dilreg.Display (w); w.Click ();
w.SetColor ("blue"); minsub.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 'closing ()' using " << endl;
cout << "'dilation()' and 'minkowski_sub1()'" << endl;
HByteImage img("monkey");
HWindow w;
HRegion circ = HRegion::GenCircle (10, 10, 1.5);
HRegionArray regs = (img >= 128).Connection();
HRegionArray dilreg = regs.Dilation1 (circ, 1);
HRegionArray minsub = dilreg.MinkowskiSub1 (circ, 1);
img.Display (w); w.Click ();
w.SetColor ("red"); regs.Display (w); w.Click ();
w.SetColor ("green"); dilreg.Display (w); w.Click ();
w.SetColor ("blue"); minsub.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 'closing ()' using " << endl;
cout << "'dilation()' and 'minkowski_sub1()'" << endl;
HByteImage img("monkey");
HWindow w;
HRegion circ = HRegion::GenCircle (10, 10, 1.5);
HRegionArray regs = (img >= 128).Connection();
HRegionArray dilreg = regs.Dilation1 (circ, 1);
HRegionArray minsub = dilreg.MinkowskiSub1 (circ, 1);
img.Display (w); w.Click ();
w.SetColor ("red"); regs.Display (w); w.Click ();
w.SetColor ("green"); dilreg.Display (w); w.Click ();
w.SetColor ("blue"); minsub.Display (w); w.Click ();
return(0);
}
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
closing closing Closing Closing Closing closing
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>) set_system("no_object_result",<RegionResult>) SetSystem("no_object_result",<RegionResult>) SetSystem("no_object_result",<RegionResult>) SetSystem("no_object_result",<RegionResult>) set_system("no_object_result",<RegionResult>)
empty region:
set_system('empty_region_result',<RegionResult>) set_system("empty_region_result",<RegionResult>) SetSystem("empty_region_result",<RegionResult>) SetSystem("empty_region_result",<RegionResult>) SetSystem("empty_region_result",<RegionResult>) set_system("empty_region_result",<RegionResult>)
Otherwise, an exception is raised.
Possible Predecessors
threshold threshold Threshold Threshold Threshold threshold
,
regiongrowing regiongrowing Regiongrowing Regiongrowing Regiongrowing regiongrowing
,
connection connection Connection Connection Connection connection
,
union1 union1 Union1 Union1 Union1 union1
,
watersheds watersheds Watersheds Watersheds Watersheds watersheds
,
class_ndim_norm class_ndim_norm ClassNdimNorm ClassNdimNorm ClassNdimNorm class_ndim_norm
,
gen_circle gen_circle GenCircle GenCircle GenCircle gen_circle
,
gen_ellipse gen_ellipse GenEllipse GenEllipse GenEllipse gen_ellipse
,
gen_rectangle1 gen_rectangle1 GenRectangle1 GenRectangle1 GenRectangle1 gen_rectangle1
,
gen_rectangle2 gen_rectangle2 GenRectangle2 GenRectangle2 GenRectangle2 gen_rectangle2
,
draw_region draw_region DrawRegion DrawRegion DrawRegion draw_region
,
gen_region_points gen_region_points GenRegionPoints GenRegionPoints GenRegionPoints gen_region_points
,
gen_region_polygon_filled gen_region_polygon_filled GenRegionPolygonFilled GenRegionPolygonFilled GenRegionPolygonFilled gen_region_polygon_filled
Possible Successors
reduce_domain reduce_domain ReduceDomain ReduceDomain ReduceDomain reduce_domain
,
select_shape select_shape SelectShape SelectShape SelectShape select_shape
,
area_center area_center AreaCenter AreaCenter AreaCenter area_center
,
connection connection Connection Connection Connection connection
Alternatives
closing_circle closing_circle ClosingCircle ClosingCircle ClosingCircle closing_circle
See also
dilation1 dilation1 Dilation1 Dilation1 Dilation1 dilation1
,
erosion1 erosion1 Erosion1 Erosion1 Erosion1 erosion1
,
opening opening Opening Opening Opening opening
,
minkowski_sub1 minkowski_sub1 MinkowskiSub1 MinkowskiSub1 MinkowskiSub1 minkowski_sub1
Module
Foundation