region_to_labelregion_to_labelRegionToLabelRegionToLabelregion_to_label (算子)
名称
region_to_labelregion_to_labelRegionToLabelRegionToLabelregion_to_label — 将区域转换为标签图像。
签名
void RegionToLabel(const HObject& Region, HObject* ImageLabel, const HTuple& Type, const HTuple& Width, const HTuple& Height)
HImage HRegion::RegionToLabel(const HString& Type, Hlong Width, Hlong Height) const
HImage HRegion::RegionToLabel(const char* Type, Hlong Width, Hlong Height) const
HImage HRegion::RegionToLabel(const wchar_t* Type, Hlong Width, Hlong Height) const
(
Windows only)
描述
region_to_labelregion_to_labelRegionToLabelRegionToLabelRegionToLabelregion_to_label converts the input regions into a label
image according to their index (1..n), i.e., the first region is
painted with the gray value 1, the second the gray value 2, etc.
Only positive gray values are used. For 'byte'"byte""byte""byte""byte""byte"-images the
index is entered modulo 256.
Regions larger than the generated image are clipped appropriately.
If regions overlap the regions with the higher image are entered
(i.e., they are painted in the order in which they are contained in
the input regions). If so desired, the regions can be made
non-overlapping by calling expand_regionexpand_regionExpandRegionExpandRegionExpandRegionexpand_region。
The background, i.e., the area not covered by any regions, is set to
0. This can be used to test in which image range no region is present.
执行信息
- 多线程类型:可重入(与非独占算子并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
参数
RegionRegionRegionRegionregionregion (输入对象) region(-array) → objectHRegionHObjectHRegionHobject
Regions to be converted.
ImageLabelImageLabelImageLabelImageLabelimageLabelimage_label (输出对象) image → objectHImageHObjectHImageHobject * (byte / int2 / int4)
Result image of dimension Width * Height
containing the converted regions.
TypeTypeTypeTypetypetype (输入控制) string → HTuplestrHTupleHtuple (string) (string) (HString) (char*)
Pixel type of the result image.
默认值:
'int2'
"int2"
"int2"
"int2"
"int2"
"int2"
值列表:
'byte'"byte""byte""byte""byte""byte", 'int2'"int2""int2""int2""int2""int2", 'int4'"int4""int4""int4""int4""int4", 'int8'"int8""int8""int8""int8""int8"
WidthWidthWidthWidthwidthwidth (输入控制) extent.y → HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Width of the image to be generated.
默认值:
512
建议值:
64, 128, 256, 512, 1024
值范围:
1
≤
Width
Width
Width
Width
width
width
≤
1024 (lin)
最小增量:
1
建议增量:
16
限制:
Width >= 1
HeightHeightHeightHeightheightheight (输入控制) extent.x → HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Height of the image to be generated.
默认值:
512
建议值:
64, 128, 256, 512, 1024
值范围:
1
≤
Height
Height
Height
Height
height
height
≤
1024 (lin)
最小增量:
1
建议增量:
16
限制:
Height >= 1
复杂度
O(2*HeightHeightHeightHeightheightheight*WidthWidthWidthWidthwidthwidth).
结果
region_to_labelregion_to_labelRegionToLabelRegionToLabelRegionToLabelregion_to_label 始终返回 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,
regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing,
connectionconnectionConnectionConnectionConnectionconnection,
expand_regionexpand_regionExpandRegionExpandRegionExpandRegionexpand_region
可能的后继
get_grayvalget_grayvalGetGrayvalGetGrayvalGetGrayvalget_grayval,
get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1GetImagePointer1get_image_pointer1
替代
region_to_binregion_to_binRegionToBinRegionToBinRegionToBinregion_to_bin,
paint_regionpaint_regionPaintRegionPaintRegionPaintRegionpaint_region
另见
label_to_regionlabel_to_regionLabelToRegionLabelToRegionLabelToRegionlabel_to_region
模块
基础