background_segbackground_segBackgroundSegBackgroundSegbackground_seg (算子名称)
名称
background_segbackground_segBackgroundSegBackgroundSegbackground_seg — 确定给定区域的背景的连通分量。
参数签名
def background_seg(foreground: HObject) -> HObject
描述
background_segbackground_segBackgroundSegBackgroundSegBackgroundSegbackground_seg determines connected components of the
background of the foreground regions given in ForegroundForegroundForegroundForegroundforegroundforeground.
This operator is normally used after an edge operator in order to
determine the regions enclosed by the extracted edges. The
connected components are determined using 4-neighborhood.
运行信息
- 多线程类型:可重入(与非独占操作符并行运行)。
- 多线程作用域:全局(可以从任何线程调用)。
- 未经并行化处理。
参数表
ForegroundForegroundForegroundForegroundforegroundforeground (input_object) region(-array) → objectHRegionHObjectHRegionHobject
Input regions.
BackgroundRegionsBackgroundRegionsBackgroundRegionsBackgroundRegionsbackgroundRegionsbackground_regions (output_object) region-array → objectHRegionHObjectHRegionHobject *
Connected components of the background.
例程 (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)
Complexity
Let F be the area of the background, H and W be the height and
width of the image, and N be the number of resulting regions.
Then the runtime complexity is O(H + sqrt(F) * sqrt(N)).
结果
background_segbackground_segBackgroundSegBackgroundSegBackgroundSegbackground_seg always 返回值 2 (
H_MSG_TRUE)
. The
behavior in case of empty input (no regions given) can be set via
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>)
and the behavior in case of an empty input region via
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
模块
Foundation