dilation_rectangle1dilation_rectangle1DilationRectangle1DilationRectangle1dilation_rectangle1 (算子)

名称

dilation_rectangle1dilation_rectangle1DilationRectangle1DilationRectangle1dilation_rectangle1 — 用矩形结构元素膨胀一个区域。

签名

dilation_rectangle1(Region : RegionDilation : Width, Height : )

Herror dilation_rectangle1(const Hobject Region, Hobject* RegionDilation, const Hlong Width, const Hlong Height)

Herror T_dilation_rectangle1(const Hobject Region, Hobject* RegionDilation, const Htuple Width, const Htuple Height)

void DilationRectangle1(const HObject& Region, HObject* RegionDilation, const HTuple& Width, const HTuple& Height)

HRegion HRegion::DilationRectangle1(Hlong Width, Hlong Height) const

static void HOperatorSet.DilationRectangle1(HObject region, out HObject regionDilation, HTuple width, HTuple height)

HRegion HRegion.DilationRectangle1(int width, int height)

def dilation_rectangle1(region: HObject, width: int, height: int) -> HObject

描述

dilation_rectangle1dilation_rectangle1DilationRectangle1DilationRectangle1DilationRectangle1dilation_rectangle1 applies a dilation with a rectangular structuring element to the input regions RegionRegionRegionRegionregionregion. The size of the structuring rectangle is WidthWidthWidthWidthwidthwidth x HeightHeightHeightHeightheightheight. The operator results in enlarged regions, and the holes smaller than the rectangular mask in the interior of the regions are closed.

dilation_rectangle1dilation_rectangle1DilationRectangle1DilationRectangle1DilationRectangle1dilation_rectangle1 is a very fast operation because the height of the rectangle enters only logarithmically into the runtime complexity, while the width does not enter at all. This leads to excellent runtime efficiency, even in the case of very large rectangles (edge length > 100).

注意

dilation_rectangle1dilation_rectangle1DilationRectangle1DilationRectangle1DilationRectangle1dilation_rectangle1 is applied to each input region separately. If gaps between different regions are to be closed, union1union1Union1Union1Union1union1 or union2union2Union2Union2Union2union2 has to be called first.

To enlarge a region by the same amount in all directions, WidthWidthWidthWidthwidthwidth and HeightHeightHeightHeightheightheight must be odd. If this is not the case, the region is dilated by a larger amount at the right or at the bottom, respectively, than at the left or at the top.

执行信息

参数

RegionRegionRegionRegionregionregion (输入对象)  region(-array) objectHRegionHObjectHRegionHobject

Regions to be dilated.

RegionDilationRegionDilationRegionDilationRegionDilationregionDilationregion_dilation (输出对象)  region(-array) objectHRegionHObjectHRegionHobject *

Dilated regions.

WidthWidthWidthWidthwidthwidth (输入控制)  extent.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Width of the structuring rectangle.

默认值: 11

建议值: 1, 2, 3, 4, 5, 11, 15, 21, 31, 51, 71, 101, 151, 201

值范围: 1 ≤ Width Width Width Width width width ≤ 511 (lin)

最小增量: 1

建议增量: 10

HeightHeightHeightHeightheightheight (输入控制)  extent.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Height of the structuring rectangle.

默认值: 11

建议值: 1, 2, 3, 4, 5, 11, 15, 21, 31, 51, 71, 101, 151, 201

值范围: 1 ≤ Height Height Height Height height height ≤ 511 (lin)

最小增量: 1

建议增量: 10

示例 (C++ (HALCON 5.0-10.0))

#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"

main()
{
  cout << "Reproduction of 'dilation_rectangle ()'" << endl;
  cout << "First = original image " << endl;
  cout << "Blue  = after dilation " << endl;
  cout << "Red   = after segmentation " << endl;

  HByteImage img("monkey");
  HWindow    w;

  HRegionArray regs   = (img >= 220).Connection();
  HRegionArray dilreg = regs.DilationRectangle1 (2, 4);

                        img.Display (w);      w.Click ();
  w.SetColor ("blue");  dilreg.Display (w);   w.Click ();
  w.SetColor ("red");   regs.Display (w);     w.Click ();

  return(0);
}

示例(C)

threshold(Image,&Light,220.0,255.0);
dilation_rectangle1(Light,&Wide,50,50);
set_color(WindowHandle,"red");
disp_region(Wide,WindowHandle);
set_color(WindowHandle,"white");
disp_region(Light,WindowHandle);

示例 (C++ (HALCON 5.0-10.0))

#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"

main()
{
  cout << "Reproduction of 'dilation_rectangle ()'" << endl;
  cout << "First = original image " << endl;
  cout << "Blue  = after dilation " << endl;
  cout << "Red   = after segmentation " << endl;

  HByteImage img("monkey");
  HWindow    w;

  HRegionArray regs   = (img >= 220).Connection();
  HRegionArray dilreg = regs.DilationRectangle1 (2, 4);

                        img.Display (w);      w.Click ();
  w.SetColor ("blue");  dilreg.Display (w);   w.Click ();
  w.SetColor ("red");   regs.Display (w);     w.Click ();

  return(0);
}

示例 (C++ (HALCON 5.0-10.0))

#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"

main()
{
  cout << "Reproduction of 'dilation_rectangle ()'" << endl;
  cout << "First = original image " << endl;
  cout << "Blue  = after dilation " << endl;
  cout << "Red   = after segmentation " << endl;

  HByteImage img("monkey");
  HWindow    w;

  HRegionArray regs   = (img >= 220).Connection();
  HRegionArray dilreg = regs.DilationRectangle1 (2, 4);

                        img.Display (w);      w.Click ();
  w.SetColor ("blue");  dilreg.Display (w);   w.Click ();
  w.SetColor ("red");   regs.Display (w);     w.Click ();

  return(0);
}

示例 (C++ (HALCON 5.0-10.0))

#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"

main()
{
  cout << "Reproduction of 'dilation_rectangle ()'" << endl;
  cout << "First = original image " << endl;
  cout << "Blue  = after dilation " << endl;
  cout << "Red   = after segmentation " << endl;

  HByteImage img("monkey");
  HWindow    w;

  HRegionArray regs   = (img >= 220).Connection();
  HRegionArray dilreg = regs.DilationRectangle1 (2, 4);

                        img.Display (w);      w.Click ();
  w.SetColor ("blue");  dilreg.Display (w);   w.Click ();
  w.SetColor ("red");   regs.Display (w);     w.Click ();

  return(0);
}

复杂度

Let F1 be the area of an input region and H be the height of the rectangle. Then the runtime complexity for one region is:

结果

dilation_rectangle1dilation_rectangle1DilationRectangle1DilationRectangle1DilationRectangle1dilation_rectangle1 在所有参数正确时返回 2 ( H_MSG_TRUE )。当输入区域为空或不存在时,其行为可通过以下方式设置:

否则,将抛出异常。

可能的前趋

thresholdthresholdThresholdThresholdThresholdthreshold, regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing, connectionconnectionConnectionConnectionConnectionconnection, union1union1Union1Union1Union1union1, watershedswatershedsWatershedsWatershedsWatershedswatersheds, class_ndim_normclass_ndim_normClassNdimNormClassNdimNormClassNdimNormclass_ndim_norm

可能的后继

reduce_domainreduce_domainReduceDomainReduceDomainReduceDomainreduce_domain, select_shapeselect_shapeSelectShapeSelectShapeSelectShapeselect_shape, area_centerarea_centerAreaCenterAreaCenterAreaCenterarea_center, connectionconnectionConnectionConnectionConnectionconnection

替代

minkowski_add1minkowski_add1MinkowskiAdd1MinkowskiAdd1MinkowskiAdd1minkowski_add1, minkowski_add2minkowski_add2MinkowskiAdd2MinkowskiAdd2MinkowskiAdd2minkowski_add2, expand_regionexpand_regionExpandRegionExpandRegionExpandRegionexpand_region, dilation1dilation1Dilation1Dilation1Dilation1dilation1, dilation2dilation2Dilation2Dilation2Dilation2dilation2, dilation_circledilation_circleDilationCircleDilationCircleDilationCircledilation_circle

另见

gen_rectangle1gen_rectangle1GenRectangle1GenRectangle1GenRectangle1gen_rectangle1, gen_region_polygon_filledgen_region_polygon_filledGenRegionPolygonFilledGenRegionPolygonFilledGenRegionPolygonFilledgen_region_polygon_filled

模块

基础