expand_regionexpand_regionExpandRegionExpandRegionexpand_region (算子)
名称
expand_regionexpand_regionExpandRegionExpandRegionexpand_region — 填充区域之间的间隙或分割重叠区域。
签名
void ExpandRegion(const HObject& Regions, const HObject& ForbiddenArea, HObject* RegionExpanded, const HTuple& Iterations, const HTuple& Mode)
HRegion HRegion::ExpandRegion(const HRegion& ForbiddenArea, const HTuple& Iterations, const HString& Mode) const
HRegion HRegion::ExpandRegion(const HRegion& ForbiddenArea, Hlong Iterations, const HString& Mode) const
HRegion HRegion::ExpandRegion(const HRegion& ForbiddenArea, Hlong Iterations, const char* Mode) const
HRegion HRegion::ExpandRegion(const HRegion& ForbiddenArea, Hlong Iterations, const wchar_t* Mode) const
(
Windows only)
描述
expand_regionexpand_regionExpandRegionExpandRegionExpandRegionexpand_region closes gaps between the input regions, which
resulted from the suppression of small regions in a segmentation
operator, for example, (mode 'image'"image""image""image""image""image"), or to separate
overlapping regions (mode 'region'"region""region""region""region""region"). Both uses result from the
expansion of regions. The operator works by adding or removing a
one pixel wide “strip” to a region.
The expansion takes place only in regions that are designated as
not “forbidden” (parameter ForbiddenAreaForbiddenAreaForbiddenAreaForbiddenAreaforbiddenAreaforbidden_area). The number
of iterations is determined by the parameter IterationsIterationsIterationsIterationsiterationsiterations.
By passing 'maximal'"maximal""maximal""maximal""maximal""maximal", expand_regionexpand_regionExpandRegionExpandRegionExpandRegionexpand_region iterates until
convergence, i.e., until no more changes occur. By passing 0 for
this parameter, all non-overlapping regions are returned. The two
modes of operation ('image'"image""image""image""image""image" and 'region'"region""region""region""region""region") are
different in the following ways:
- 'image'
The input regions are expanded iteratively until they
touch another region or the image border.
In this case, the image border is defined to be the
rectangle ranging from (0,0) to (row_max,col_max).
Here, (row_max,col_max) corresponds to the lower right
corner of the smallest surrounding rectangle of all input regions
(i.e., of all regions that are passed in RegionsRegionsRegionsRegionsregionsregions and
ForbiddenAreaForbiddenAreaForbiddenAreaForbiddenAreaforbiddenAreaforbidden_area).
Because expand_regionexpand_regionExpandRegionExpandRegionExpandRegionexpand_region processes all regions simultaneously,
gaps between regions are distributed evenly to all
regions. Overlapping regions are split by distributing
the area of overlap evenly to both regions.
- 'region'
No expansion of the input regions is performed. Instead,
only overlapping regions are split by distributing the
area of overlap evenly to the respective regions. Because
the intersection with the original region is computed
after the shrinking operation gaps in the output regions
may result, i.e., the segmentation is not complete. This
can be prevented by calling expand_regionexpand_regionExpandRegionExpandRegionExpandRegionexpand_region a second
time with the complement of the original regions as
“forbidden area.”
执行信息
- 多线程类型:可重入(与非独占算子并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
参数
RegionsRegionsRegionsRegionsregionsregions (输入对象) region(-array) → objectHRegionHObjectHRegionHobject
Regions for which the gaps are to be closed, or which
are to be separated.
ForbiddenAreaForbiddenAreaForbiddenAreaForbiddenAreaforbiddenAreaforbidden_area (输入对象) region → objectHRegionHObjectHRegionHobject
Regions in which no expansion takes place.
RegionExpandedRegionExpandedRegionExpandedRegionExpandedregionExpandedregion_expanded (输出对象) region(-array) → objectHRegionHObjectHRegionHobject *
Expanded or separated regions.
IterationsIterationsIterationsIterationsiterationsiterations (输入控制) integer → HTupleUnion[int, str]HTupleHtuple (integer / string) (int / long / string) (Hlong / HString) (Hlong / char*)
Number of iterations.
默认值:
'maximal'
"maximal"
"maximal"
"maximal"
"maximal"
"maximal"
建议值:
'maximal'"maximal""maximal""maximal""maximal""maximal", 0, 1, 2, 3, 5, 7, 10, 15, 20, 30, 50, 70, 100, 200
值范围:
0
≤
Iterations
Iterations
Iterations
Iterations
iterations
iterations
≤
1000 (lin)
最小增量:
1
建议增量:
1
ModeModeModeModemodemode (输入控制) string → HTuplestrHTupleHtuple (string) (string) (HString) (char*)
Expansion mode.
默认值:
'image'
"image"
"image"
"image"
"image"
"image"
值列表:
'image'"image""image""image""image""image", 'region'"region""region""region""region""region"
示例(HDevelop)
read_image(Image,'clip')
threshold(Image,Dark,0,150)
connection(Dark,ConnectedRegions)
gen_circle (Circle, 400, 400, 200.5)
expand_region (ConnectedRegions, Circle, RegionExpanded, 'maximal', 'image')
dev_display (RegionExpanded)
示例(C)
read_image(&Image,"fabrik");
threshold(Image,&Light,100.0,255.0);
disp_region(Light,WindowHandle);
connection(Light,&Seg);
expand_region(Seg,EMPTY_REGION,&Exp1,"maximal","image");
set_colored(WindowHandle,12);
set_draw(WindowHandle,"margin");
disp_region(Exp1,WindowHandle);
示例(HDevelop)
read_image(Image,'clip')
threshold(Image,Dark,0,150)
connection(Dark,ConnectedRegions)
gen_circle (Circle, 400, 400, 200.5)
expand_region (ConnectedRegions, Circle, RegionExpanded, 'maximal', 'image')
dev_display (RegionExpanded)
示例(HDevelop)
read_image(Image,'clip')
threshold(Image,Dark,0,150)
connection(Dark,ConnectedRegions)
gen_circle (Circle, 400, 400, 200.5)
expand_region (ConnectedRegions, Circle, RegionExpanded, 'maximal', 'image')
dev_display (RegionExpanded)
示例(HDevelop)
read_image(Image,'clip')
threshold(Image,Dark,0,150)
connection(Dark,ConnectedRegions)
gen_circle (Circle, 400, 400, 200.5)
expand_region (ConnectedRegions, Circle, RegionExpanded, 'maximal', 'image')
dev_display (RegionExpanded)
结果
expand_regionexpand_regionExpandRegionExpandRegionExpandRegionexpand_region 始终返回值 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>),以及当结果区域为空时则设置行为通过 set_system('store_empty_region',<'true'/'false'>)set_system("store_empty_region",<"true"/"false">)SetSystem("store_empty_region",<"true"/"false">)SetSystem("store_empty_region",<"true"/"false">)SetSystem("store_empty_region",<"true"/"false">)set_system("store_empty_region",<"true"/"false">)。如有必要,则抛出异常。
可能的前趋
pouringpouringPouringPouringPouringpouring,
thresholdthresholdThresholdThresholdThresholdthreshold,
dyn_thresholddyn_thresholdDynThresholdDynThresholdDynThresholddyn_threshold,
regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing
替代
dilation1dilation1Dilation1Dilation1Dilation1dilation1
另见
expand_grayexpand_grayExpandGrayExpandGrayExpandGrayexpand_gray,
interjacentinterjacentInterjacentInterjacentInterjacentinterjacent,
skeletonskeletonSkeletonSkeletonSkeletonskeleton
模块
基础