bottom_hatbottom_hatBottomHatBottomHatbottom_hat (Operator)

Name

bottom_hatbottom_hatBottomHatBottomHatbottom_hat — Compute the bottom hat of regions.

Signature

bottom_hat(Region, StructElement : RegionBottomHat : : )

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

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

void BottomHat(const HObject& Region, const HObject& StructElement, HObject* RegionBottomHat)

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

static void HOperatorSet.BottomHat(HObject region, HObject structElement, out HObject regionBottomHat)

HRegion HRegion.BottomHat(HRegion structElement)

def bottom_hat(region: HObject, struct_element: HObject) -> HObject

Description

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

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

Structuring elements (StructElementStructElementStructElementstructElementstruct_element) can be generated with operators such as gen_circlegen_circleGenCircleGenCirclegen_circle, gen_rectangle1gen_rectangle1GenRectangle1GenRectangle1gen_rectangle1, gen_rectangle2gen_rectangle2GenRectangle2GenRectangle2gen_rectangle2, gen_ellipsegen_ellipseGenEllipseGenEllipsegen_ellipse, draw_regiondraw_regionDrawRegionDrawRegiondraw_region, gen_region_polygongen_region_polygonGenRegionPolygonGenRegionPolygongen_region_polygon, gen_region_pointsgen_region_pointsGenRegionPointsGenRegionPointsgen_region_points, etc.

Execution Information

Parameters

RegionRegionRegionregionregion (input_object)  region(-array) objectHRegionHObjectHObjectHobject

Regions to be processed.

StructElementStructElementStructElementstructElementstruct_element (input_object)  region objectHRegionHObjectHObjectHobject

Structuring element (position independent).

RegionBottomHatRegionBottomHatRegionBottomHatregionBottomHatregion_bottom_hat (output_object)  region(-array) objectHRegionHObjectHObjectHobject *

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)

Example (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);

Example (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);
}

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)

Result

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

Otherwise, an exception is raised.

Possible Predecessors

thresholdthresholdThresholdThresholdthreshold, regiongrowingregiongrowingRegiongrowingRegiongrowingregiongrowing, connectionconnectionConnectionConnectionconnection, union1union1Union1Union1union1, watershedswatershedsWatershedsWatershedswatersheds, class_ndim_normclass_ndim_normClassNdimNormClassNdimNormclass_ndim_norm, gen_circlegen_circleGenCircleGenCirclegen_circle, gen_ellipsegen_ellipseGenEllipseGenEllipsegen_ellipse, gen_rectangle1gen_rectangle1GenRectangle1GenRectangle1gen_rectangle1, gen_rectangle2gen_rectangle2GenRectangle2GenRectangle2gen_rectangle2, draw_regiondraw_regionDrawRegionDrawRegiondraw_region, gen_region_pointsgen_region_pointsGenRegionPointsGenRegionPointsgen_region_points, gen_region_polygon_filledgen_region_polygon_filledGenRegionPolygonFilledGenRegionPolygonFilledgen_region_polygon_filled

Possible Successors

reduce_domainreduce_domainReduceDomainReduceDomainreduce_domain, select_shapeselect_shapeSelectShapeSelectShapeselect_shape, area_centerarea_centerAreaCenterAreaCenterarea_center, connectionconnectionConnectionConnectionconnection

Alternatives

closingclosingClosingClosingclosing, differencedifferenceDifferenceDifferencedifference

See also

top_hattop_hatTopHatTopHattop_hat, gray_bothatgray_bothatGrayBothatGrayBothatgray_bothat, openingopeningOpeningOpeningopening

Module

Foundation