Skip to content

bottom_hatBottomHatBottomHatbottom_hatbottom_hat🔗

Short description🔗

bottom_hatBottomHatBottomHatbottom_hatbottom_hat — Compute the bottom hat of regions.

Signature🔗

bottom_hat( region Region, region StructElement, out region RegionBottomHat )void BottomHat( const HObject& Region, const HObject& StructElement, HObject* RegionBottomHat )static void HOperatorSet.BottomHat( HObject region, HObject structElement, out HObject regionBottomHat )def bottom_hat( region: HObject, struct_element: HObject ) -> HObject

Herror bottom_hat( const Hobject Region, const Hobject StructElement, Hobject* RegionBottomHat )

Herror T_bottom_hat( const Hobject Region, const Hobject StructElement, Hobject* RegionBottomHat )

HRegion HRegion::BottomHat( const HRegion& StructElement ) const

HRegion HRegion.BottomHat( HRegion structElement )

Description🔗

bottom_hatBottomHat computes the closingClosing of Regionregionregion with StructElementstructElementstruct_element. The difference between the result of the closing and the original region is called the bottom hat. In contrast to closingClosing, which merges regions under certain circumstances, bottom_hatBottomHat computes the regions generated by such a merge.

The position of StructElementstructElementstruct_element is meaningless, since a closing operation is invariant with respect to the choice of the reference point.

Structuring elements (StructElementstructElementstruct_element) can be generated with operators such as gen_circleGenCircle, gen_rectangle1GenRectangle1, gen_rectangle2GenRectangle2, gen_ellipseGenEllipse, draw_regionDrawRegion, gen_region_polygonGenRegionPolygon, gen_region_pointsGenRegionPoints, etc.

Execution information🔗

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

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

Parameters🔗

Regionregionregion (input_object) region(-array) → objectHObjectHRegionHObjectHobject

Regions to be processed.

StructElementstructElementstruct_element (input_object) region → objectHObjectHRegionHObjectHobject

Structuring element (position independent).

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

Result of the bottom hat operator.

Example🔗

(HDevelop)

read_image (Image, 'brake_disk/brake_disk_bike_01')
threshold (Image, Regions, 128, 255)
gen_circle (Circle, 40, 40, 20)
bottom_hat (Regions, Circle, RegionBottomHat)
(C)
threshold(Image,&Regions,128.0,255.0)\;
gen_circle(&Circle,100.0,100.0,16.0)\;
bottom_hat(Regions,Circle,&RegionBottomHat)\;
(C)
threshold(Image,&Regions,128.0,255.0)\;
gen_circle(&Circle,128.0,128.0,16.0)\;
bottom_hat(Regions,Circle,&RegionBottomHat)\;
set_color(WindowHandle,"red")\;
disp_region(Regions,WindowHandle)\;
set_color(WindowHandle,"green")\;
disp_region(RegionBottomHat,WindowHandle)\;
(C++)
#include "HalconCpp.h"

main()
{
  HByteImage    Monkey("monkey")\;
  HWindow       w\;
 HRegion regs = (Monkey >= 128)\;
  HRegion circ = HRegion::GenCircle (128, 128, 3)\;
 HRegion rbht = regs.BottomHat (circ)\;
 Monkey.Display (w)\;  w.Click ()\;
  w.SetColor ("red")\;     regs.Display (w)\;  w.Click ()\;
  w.SetColor ("green")\;   rbht.Display (w)\;  w.Click ()\;
 return(0)\;
}

Result🔗

bottom_hatBottomHat 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, gen_circleGenCircle, gen_ellipseGenEllipse, gen_rectangle1GenRectangle1, gen_rectangle2GenRectangle2, draw_regionDrawRegion, gen_region_pointsGenRegionPoints, gen_region_polygon_filledGenRegionPolygonFilled

Possible successors

reduce_domainReduceDomain, select_shapeSelectShape, area_centerAreaCenter, connectionConnection

Alternatives

closingClosing, differenceDifference

See also

top_hatTopHat, gray_bothatGrayBothat, openingOpening

Module🔗

Foundation