region_to_binregion_to_binRegionToBinRegionToBinregion_to_bin (Operator)
Name
region_to_binregion_to_binRegionToBinRegionToBinregion_to_bin — Convert a region into a binary byte-image.
Signature
Herror region_to_bin(const Hobject Region, Hobject* BinImage, const Hlong ForegroundGray, const Hlong BackgroundGray, const Hlong Width, const Hlong Height)
Herror T_region_to_bin(const Hobject Region, Hobject* BinImage, const Htuple ForegroundGray, const Htuple BackgroundGray, const Htuple Width, const Htuple Height)
Description
region_to_binregion_to_binRegionToBinRegionToBinRegionToBinregion_to_bin converts the input region given in
RegionRegionRegionRegionregionregion into a 'byte'"byte""byte""byte""byte""byte"-image and assigns a gray
value of ForegroundGrayForegroundGrayForegroundGrayForegroundGrayforegroundGrayforeground_gray to all pixels in the region. If
the input region is larger than the generated image, it is clipped
at the image borders. The background is set to
BackgroundGrayBackgroundGrayBackgroundGrayBackgroundGraybackgroundGraybackground_gray.
Execution Information
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
Parameters
RegionRegionRegionRegionregionregion (input_object) region(-array) → objectHRegionHObjectHRegionHobject
Regions to be converted.
BinImageBinImageBinImageBinImagebinImagebin_image (output_object) image → objectHImageHObjectHImageHobject * (byte)
Result image of dimension Width * Height
containing the converted regions.
ForegroundGrayForegroundGrayForegroundGrayForegroundGrayforegroundGrayforeground_gray (input_control) integer → HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Gray value in which the regions are displayed.
Default value: 255
Suggested values: 0, 1, 50, 100, 128, 150, 200, 254, 255
Typical range of values: 0
≤
ForegroundGray
ForegroundGray
ForegroundGray
ForegroundGray
foregroundGray
foreground_gray
≤
255 (lin)
Recommended increment: 1
BackgroundGrayBackgroundGrayBackgroundGrayBackgroundGraybackgroundGraybackground_gray (input_control) integer → HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Gray value in which the background is displayed.
Default value: 0
Suggested values: 0, 1, 50, 100, 128, 150, 200, 254, 255
Typical range of values: 0
≤
BackgroundGray
BackgroundGray
BackgroundGray
BackgroundGray
backgroundGray
background_gray
≤
255 (lin)
Recommended increment: 1
WidthWidthWidthWidthwidthwidth (input_control) extent.x → HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Width of the image to be generated.
Default value: 512
Suggested values: 256, 512, 1024
Typical range of values: 1
≤
Width
Width
Width
Width
width
width
≤
1024 (lin)
Minimum increment: 1
Recommended increment: 16
Restriction: Width >= 1
HeightHeightHeightHeightheightheight (input_control) extent.y → HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Height of the image to be generated.
Default value: 512
Suggested values: 256, 512, 1024
Typical range of values: 1
≤
Height
Height
Height
Height
height
height
≤
1024 (lin)
Minimum increment: 1
Recommended increment: 16
Restriction: Height >= 1
Complexity
O(2*HeightHeightHeightHeightheightheight*WidthWidthWidthWidthwidthwidth).
Result
region_to_binregion_to_binRegionToBinRegionToBinRegionToBinregion_to_bin always returns 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>).
If necessary, an exception is raised.
Possible Predecessors
thresholdthresholdThresholdThresholdThresholdthreshold,
connectionconnectionConnectionConnectionConnectionconnection,
regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing,
pouringpouringPouringPouringPouringpouring
Possible Successors
get_grayvalget_grayvalGetGrayvalGetGrayvalGetGrayvalget_grayval
Alternatives
region_to_labelregion_to_labelRegionToLabelRegionToLabelRegionToLabelregion_to_label,
paint_regionpaint_regionPaintRegionPaintRegionPaintRegionpaint_region,
set_grayvalset_grayvalSetGrayvalSetGrayvalSetGrayvalset_grayval
See also
gen_image_protogen_image_protoGenImageProtoGenImageProtoGenImageProtogen_image_proto,
paint_graypaint_grayPaintGrayPaintGrayPaintGraypaint_gray
Module
Foundation