Close a region.
A closing operation is defined as a dilation followed by a Minkowsi subtraction. By applying closing to a region, larger structures remain mostly intact, while small gaps between adjacent regions and holes smaller than StructElement are closed, and the regions' boundaries are smoothed. All closing variants share the property that separate regions are not merged, but remain separate objects. The position of StructElement is meaningless, since a closing operation is invariant with respect to the choice of the reference point.
Structuring elements (StructElement) can be generated with operators such as circle, rectangle1, rectangle2, ellipse, draw_region, store_polygon, store_coord, etc.
closing is applied to each input region separately. If gaps between different regions are to be closed, union1 or union2 has to be called first.
Region (input_object) |
region(-array) -> object |
Regions to be closed. |
StructElement (input_object) |
region -> object |
Structuring element (position-invariant). |
RegionClosing (output_object) |
region(-array) -> object |
Closed regions. |
#include#include "HCPP.H" main() { cout << "Reproduction of 'closing ()' using " << endl; cout << "'dilation()' and 'minkowski_sub1()'" << endl; HByteImage img("affe"); HWindow w; HRegion circ = HRegion::Circle (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); }
Let F1 be the area of the input region, and F2 be the area of the structuring element. The the runtime complexity for one region is:
O(2 * sqrt(F1) * sqrt(F2)) .
closing returns 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.
threshold__, regiongrowing__, connection, union1, watersheds, class_ndim1__, circle, ellipse, rectangle1, rectangle2, draw_region, store_coord, struct_elements, store_filled_polygon
reduce_domain, select_shape, area_center, connection
dilation1, erosion1, opening, minkowski_sub1