Compute the union of ::bottom_hat and ::top_hat.
::morph_hat computes the union of the regions that are removed by an ::opening operation with the regions that are added by a ::closing operation. Hence this is the union of the results of ::top_hat and ::bottom_hat. The position of StructElement does not influence the result.
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.
The individual regions are processed separately.
|
Region (input_object) |
region(-array) -> Hobject: HRegion(Array) |
| Regions to be processed. | |
|
StructElement (input_object) |
region -> Hobject: HRegion |
| Structuring element (position-invariant). | |
|
RegionTopHat (output_object) |
region(-array) -> Hobject * : HRegion(Array) |
| Union of top hat and bottom hat. | |
#include <iostream.h>
#include "HalconCpp.h"
main()
{
cout << "Reproduction of 'dilation_circle ()'" << endl;
cout << "First = original image " << endl;
cout << "Red = after segmentation " << endl;
cout << "Blue = after erosion " << endl;
HByteImage img("monkey");
HWindow w;
HRegion circ = HRegion::GenCircle (10, 10, 1.5);
HRegionArray regs = (img >= 128).Connection();
HRegionArray tophat = regs.TopHat (circ);
HRegionArray bothat = regs.BottomHat (circ);
HRegionArray unionX = tophat.Union2 (bothat);
img.Display (w); w.Click ();
w.SetColor ("red"); regs.Display (w); w.Click ();
w.SetColor ("blue"); tophat.Display (w); w.Click ();
w.SetColor ("green"); bothat.Display (w); w.Click ();
w.SetColor ("white"); unionX.Display (w); w.Click ();
return(0);
}
::morph_hat returns 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.
::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
::reduce_domain, ::select_shape, ::area_center, ::connection
::top_hat, ::bottom_hat, ::union2
Morphology