Skip to content

closingClosingClosingclosingclosing🔗

説明🔗

closingClosingClosingclosingclosing — 領域に対してクロージング処理を実行する。

書式🔗

closing( region Region, region StructElement, out region RegionClosing )void Closing( const HObject& Region, const HObject& StructElement, HObject* RegionClosing )static void HOperatorSet.Closing( HObject region, HObject structElement, out HObject regionClosing )def closing( region: HObject, struct_element: HObject ) -> HObject

Herror closing( const Hobject Region, const Hobject StructElement, Hobject* RegionClosing )

Herror T_closing( const Hobject Region, const Hobject StructElement, Hobject* RegionClosing )

HRegion HRegion::Closing( const HRegion& StructElement ) const

HRegion HRegion.Closing( HRegion structElement )

説明🔗

closingClosing 演算は、膨張処理後にMinkowski 差を実行します。 closingClosing を領域に適用することによって、隣接する領域間の小さ なギャップと StructElementstructElementstruct_element より小さい穴が閉じられ、より大 きい構造はそのまま残ります。また、領域の境界がなめらかになります。 すべての closingClosing 変量は、分離した領域が結合されずに別のオ ブジェクトとして残る特性をもちます。closing 演算が参照点の選択に関 して不変なので、StructElementstructElementstruct_element の位置は意味がありませ ん。

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

注意🔗

closingClosing は、入力領域個別に適用されます。もし、異なる領域の 間のギャップを閉じる必要があれば、union1Union1 または union2Union2 を最初に呼び出す必要があります。

実行情報🔗

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

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

パラメーター🔗

Regionregionregion (input_object) region(-array) → objectHObjectHRegionHObjectHobject

クロージング処理を適用する対象領域

StructElementstructElementstruct_element (input_object) region → objectHObjectHRegionHObjectHobject

構造要素(位置不変量)

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

結果として得られる領域

例🔗

(C)

my_closing(Hobject In, Hobject StructElement, Hobject *Out)
{
  Hobject  tmp\;
  dilation1(In,StructElement,&tmp,1)\;
  minkowski_sub1(tmp,StructElement,Out,1)\;
}
(C++)
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std\;
#endif
#include "HalconCpp.h"

main()
{
  cout << "Reproduction of 'closing ()' using " << endl\;
  cout << "'dilation()' and 'minkowski_sub1()'" << endl\;
 HByteImage img("monkey")\;
  HWindow    w\;
 HRegion      circ = HRegion::GenCircle (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)\;
}

複雑性🔗

入力領域の面積を \(F1\) とし、構造要素の面積を \(F2\) とします。 その場合、1 つの領域に対する実行時間は以下のようになります。

\[\begin{eqnarray*} O(2 \cdot \sqrt{F1} \cdot \sqrt{F2}) \enspace . \end{eqnarray*}\]

結果🔗

closingClosing は、すべてのパラメーターが正しい場合に 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

他の選択候補

closing_circleClosingCircle

関連項目

dilation1Dilation1, erosion1Erosion1, openingOpening, minkowski_sub1MinkowskiSub1

モジュール🔗

Foundation