ClassesClassesClassesClasses | | | | Operators

expand_regionexpand_regionExpandRegionexpand_regionExpandRegionExpandRegion (Operator)

Name

expand_regionexpand_regionExpandRegionexpand_regionExpandRegionExpandRegion — Fill gaps between regions or split overlapping regions.

Signature

expand_region(Regions, ForbiddenArea : RegionExpanded : Iterations, Mode : )

Herror expand_region(const Hobject Regions, const Hobject ForbiddenArea, Hobject* RegionExpanded, const Hlong Iterations, const char* Mode)

Herror T_expand_region(const Hobject Regions, const Hobject ForbiddenArea, Hobject* RegionExpanded, const Htuple Iterations, const Htuple Mode)

Herror expand_region(Hobject Regions, Hobject ForbiddenArea, Hobject* RegionExpanded, const HTuple& Iterations, const HTuple& Mode)

HRegion HRegion::ExpandRegion(const HRegion& ForbiddenArea, const HTuple& Iterations, const HTuple& Mode) const

HRegionArray HRegionArray::ExpandRegion(const HRegion& ForbiddenArea, const HTuple& Iterations, const HTuple& Mode) const

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

void HOperatorSetX.ExpandRegion(
[in] IHUntypedObjectX* Regions, [in] IHUntypedObjectX* ForbiddenArea, [out] IHUntypedObjectX*RegionExpanded, [in] VARIANT Iterations, [in] VARIANT Mode)

IHRegionX* HRegionX.ExpandRegion(
[in] IHRegionX* ForbiddenArea, [in] VARIANT Iterations, [in] BSTR Mode)

static void HOperatorSet.ExpandRegion(HObject regions, HObject forbiddenArea, out HObject regionExpanded, HTuple iterations, HTuple mode)

HRegion HRegion.ExpandRegion(HRegion forbiddenArea, HTuple iterations, string mode)

HRegion HRegion.ExpandRegion(HRegion forbiddenArea, int iterations, string mode)

Description

expand_regionexpand_regionExpandRegionexpand_regionExpandRegionExpandRegion 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 ForbiddenAreaForbiddenAreaForbiddenAreaForbiddenAreaForbiddenAreaforbiddenArea). The number of iterations is determined by the parameter IterationsIterationsIterationsIterationsIterationsiterations. By passing 'maximal'"maximal""maximal""maximal""maximal""maximal", expand_regionexpand_regionExpandRegionexpand_regionExpandRegionExpandRegion 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 ForbiddenAreaForbiddenAreaForbiddenAreaForbiddenAreaForbiddenAreaforbiddenArea). Because expand_regionexpand_regionExpandRegionexpand_regionExpandRegionExpandRegion 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_regionExpandRegionexpand_regionExpandRegionExpandRegion a second time with the complement of the original regions as “forbidden area.”

Parallelization

Parameters

RegionsRegionsRegionsRegionsRegionsregions (input_object)  region(-array) objectHRegionHRegionHRegionHRegionXHobject

Regions for which the gaps are to be closed, or which are to be separated.

ForbiddenAreaForbiddenAreaForbiddenAreaForbiddenAreaForbiddenAreaforbiddenArea (input_object)  region objectHRegionHRegionHRegionHRegionXHobject

Regions in which no expansion takes place.

RegionExpandedRegionExpandedRegionExpandedRegionExpandedRegionExpandedregionExpanded (output_object)  region(-array) objectHRegionHRegionHRegionHRegionXHobject *

Expanded or separated regions.

IterationsIterationsIterationsIterationsIterationsiterations (input_control)  integer HTupleHTupleHTupleVARIANTHtuple (integer / string) (int / long / string) (Hlong / HString) (Hlong / char*) (Hlong / BSTR) (Hlong / char*)

Number of iterations.

Default value: 'maximal' "maximal" "maximal" "maximal" "maximal" "maximal"

Suggested values: 'maximal'"maximal""maximal""maximal""maximal""maximal", 0, 1, 2, 3, 5, 7, 10, 15, 20, 30, 50, 70, 100, 200

Typical range of values: 0 ≤ Iterations Iterations Iterations Iterations Iterations iterations ≤ 1000 (lin)

Minimum increment: 1

Recommended increment: 1

ModeModeModeModeModemode (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Expansion mode.

Default value: 'image' "image" "image" "image" "image" "image"

List of values: 'image'"image""image""image""image""image", 'region'"region""region""region""region""region"

Example (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)

Example (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);

Example (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)

Example (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)

Example (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)

Example (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)

Result

expand_regionexpand_regionExpandRegionexpand_regionExpandRegionExpandRegion always returns the value 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>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>), 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>)set_system("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>), and the behavior in case of an empty result region via set_system('store_empty_region',<'true'/'false'>)set_system("store_empty_region",<"true"/"false">)SetSystem("store_empty_region",<"true"/"false">)set_system("store_empty_region",<"true"/"false">)SetSystem("store_empty_region",<"true"/"false">)SetSystem("store_empty_region",<"true"/"false">). If necessary, an exception is raised.

Possible Predecessors

pouringpouringPouringpouringPouringPouring, thresholdthresholdThresholdthresholdThresholdThreshold, dyn_thresholddyn_thresholdDynThresholddyn_thresholdDynThresholdDynThreshold, regiongrowingregiongrowingRegiongrowingregiongrowingRegiongrowingRegiongrowing

Alternatives

dilation1dilation1Dilation1dilation1Dilation1Dilation1

See also

expand_grayexpand_grayExpandGrayexpand_grayExpandGrayExpandGray, interjacentinterjacentInterjacentinterjacentInterjacentInterjacent, skeletonskeletonSkeletonskeletonSkeletonSkeleton

Module

Foundation


ClassesClassesClassesClasses | | | | Operators