background_segbackground_segBackgroundSegBackgroundSegbackground_seg背景分割(算子)

名称

background_segbackground_segBackgroundSegBackgroundSegbackground_seg — 确定给定区域背景的连通分量。

签名

background_seg(Foreground : BackgroundRegions : : )

Herror background_seg(const Hobject Foreground, Hobject* BackgroundRegions)

Herror T_background_seg(const Hobject Foreground, Hobject* BackgroundRegions)

void BackgroundSeg(const HObject& Foreground, HObject* BackgroundRegions)

HRegion HRegion::BackgroundSeg() const

static void HOperatorSet.BackgroundSeg(HObject foreground, out HObject backgroundRegions)

HRegion HRegion.BackgroundSeg()

def background_seg(foreground: HObject) -> HObject

描述

background_segbackground_segBackgroundSegBackgroundSegBackgroundSegbackground_seg 用于确定 ForegroundForegroundForegroundForegroundforegroundforeground 中给定前景区域的背景连通分量。该算子通常在边缘算子之后使用,以确定被提取边缘所包围的区域。连通分量的确定采用四邻域法。

执行信息

参数

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

输入区域。

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

背景的连通分量。

示例(HDevelop)

* Simulation of background_seg:
background_seg(Foreground,BackgroundRegions)
  complement(Foreground,Background)
  get_system('neighborhood',Save)
  set_system('neighborhood',4)
  connection(Background,BackgroundRegions)
  set_system('neighborhood',Save)

* Segmentation with edge filter:
read_image(Image,'fabrik')
sobel_dir(Image,Sobel,Dir,'sum_sqrt',3)
threshold(Sobel,Edges,20,255)
skeleton(Edges,Margins)
background_seg(Margins,Regions)

示例(C)

/* Segmentation with edge filter: */
read_image(&Image,"fabrik");
sobel_dir(Image,&Sobel,&Dir,"sum_sqrt",3);
threshold(Sobel,&Edges,20,255);
skeleton(Edges,&Margins);
background_seg(Margins,&Regions);

示例(HDevelop)

* Simulation of background_seg:
background_seg(Foreground,BackgroundRegions)
  complement(Foreground,Background)
  get_system('neighborhood',Save)
  set_system('neighborhood',4)
  connection(Background,BackgroundRegions)
  set_system('neighborhood',Save)

* Segmentation with edge filter:
read_image(Image,'fabrik')
sobel_dir(Image,Sobel,Dir,'sum_sqrt',3)
threshold(Sobel,Edges,20,255)
skeleton(Edges,Margins)
background_seg(Margins,Regions)

示例(HDevelop)

* Simulation of background_seg:
background_seg(Foreground,BackgroundRegions)
  complement(Foreground,Background)
  get_system('neighborhood',Save)
  set_system('neighborhood',4)
  connection(Background,BackgroundRegions)
  set_system('neighborhood',Save)

* Segmentation with edge filter:
read_image(Image,'fabrik')
sobel_dir(Image,Sobel,Dir,'sum_sqrt',3)
threshold(Sobel,Edges,20,255)
skeleton(Edges,Margins)
background_seg(Margins,Regions)

示例(HDevelop)

* Simulation of background_seg:
background_seg(Foreground,BackgroundRegions)
  complement(Foreground,Background)
  get_system('neighborhood',Save)
  set_system('neighborhood',4)
  connection(Background,BackgroundRegions)
  set_system('neighborhood',Save)

* Segmentation with edge filter:
read_image(Image,'fabrik')
sobel_dir(Image,Sobel,Dir,'sum_sqrt',3)
threshold(Sobel,Edges,20,255)
skeleton(Edges,Margins)
background_seg(Margins,Regions)

复杂度

设 F 为背景面积,H 和 W 分别为图像高度与宽度,N 为最终分割区域数。 此时运行时间复杂度为 O(H + √F * √N)。

结果

background_segbackground_segBackgroundSegBackgroundSegBackgroundSegbackground_seg 始终返回值 2 ( H_MSG_TRUE )。当输入为空(未指定区域)时,可设置行为通过算子 set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>),以及输入区域为空时,可设置行为通过算子 set_system('empty_region_result',<Result>)set_system("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)set_system("empty_region_result",<Result>)。如有必要,则抛出异常。

可能的前趋

thresholdthresholdThresholdThresholdThresholdthreshold, connectionconnectionConnectionConnectionConnectionconnection, regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing, pouringpouringPouringPouringPouringpouring, class_ndim_normclass_ndim_normClassNdimNormClassNdimNormClassNdimNormclass_ndim_norm

可能的后继

select_shapeselect_shapeSelectShapeSelectShapeSelectShapeselect_shape

替代

complementcomplementComplementComplementComplementcomplement, connectionconnectionConnectionConnectionConnectionconnection

另见

thresholdthresholdThresholdThresholdThresholdthreshold, hysteresis_thresholdhysteresis_thresholdHysteresisThresholdHysteresisThresholdHysteresisThresholdhysteresis_threshold, skeletonskeletonSkeletonSkeletonSkeletonskeleton, expand_regionexpand_regionExpandRegionExpandRegionExpandRegionexpand_region, set_systemset_systemSetSystemSetSystemSetSystemset_system, sobel_ampsobel_ampSobelAmpSobelAmpSobelAmpsobel_amp, edges_imageedges_imageEdgesImageEdgesImageEdgesImageedges_image, robertsrobertsRobertsRobertsRobertsroberts, bandpass_imagebandpass_imageBandpassImageBandpassImageBandpassImagebandpass_image

模块

基础