Skip to content

bottom_hatBottomHatBottomHatbottom_hatbottom_hat🔗

説明🔗

bottom_hatBottomHatBottomHatbottom_hatbottom_hat — 領域のボトムハットを計算する。

書式🔗

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 )

説明🔗

bottom_hatBottomHat は、StructElementstructElementstruct_element を含む Regionregionregion の closingClosing を計算します。closing 領域と元 の領域との差がボトムハットと呼ばれます。ある条件で領域を結合す る closingClosingと異なり、bottom_hatBottomHatはそのような結合に よって生成される領域を計算します。

closing 演算が参照点の選択に関して不変であるので、 StructElementstructElementstruct_element の位置は意味がありません。

構造要素(StructElementstructElementstruct_element)は、gen_circleGenCircle、 gen_rectangle1GenRectangle1、gen_rectangle2GenRectangle2、 gen_ellipseGenEllipse、draw_regionDrawRegion、 gen_region_polygonGenRegionPolygon、 gen_region_pointsGenRegionPoints などのオペ レーターを使用して生成できます。

実行情報🔗

実行情報
  • マルチスレッドタイプ: リエントラント(非排他なオペレーターと並列に動作)

  • マルチスレッドスコープ: グローバル(他のスレッドから呼び出される可能性あり)

パラメーター🔗

Regionregionregion (input_object) region(-array) → objectHObjectHRegionHObjectHobject

処理される領域

StructElementstructElementstruct_element (input_object) region → objectHObjectHRegionHObjectHobject

構造要素(位置には独立)

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

ボトムハットオペレーターの結果

例🔗

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

結果🔗

bottom_hatBottomHat は、すべてのパラメーターが正しい場合に 2 (H_MSG_TRUE) を 返します。 空または入力領域がない場合の動作は、次の設定に従います。

  • 領域がない場合: set_system('no_object_result',<RegionResult>)

  • 領域が空の場合: set_system('empty_region_result',<RegionResult>)

そうでない場合、例外処理が発生します。

他のオペレーターとの組み合わせ🔗

組み合わせ

前処理の候補

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

後処理の候補

reduce_domainReduceDomain, select_shapeSelectShape, area_centerAreaCenter, connectionConnection

他の選択候補

closingClosing, differenceDifference

関連項目

top_hatTopHat, gray_bothatGrayBothat, openingOpening

モジュール🔗

Foundation