region_to_label ( Region : ImageLabel : Kind, Width, Height : )

Convert regions to a label image.

region_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-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.

The background, i.e., the area not covered by any regions, is set to 0. This can be used to test whether no region is present in an image.


Parameters

Region (input_object)
region(-array) -> object
Regions to be converted.

ImageLabel (output_object)
image -> object : byte / int2 / int4
Result image of dimension Width * Height containing the converted regions.

Kind (input_control)
string -> string
Pixel type of the result image.
Default value: 'int2'
List of values: 'byte', 'int2', 'int4'

Width (input_control)
extent.y -> integer
Width of the image to be generated.
Default value: 512
Suggested values: 64, 128, 256, 512, 1024
Range of values: 1 <= Width <= 1024 (lin)
Minimum increment: 1
Recommended increment: 16
Restriction: Width >= 1

Height (input_control)
extent.x -> integer
Height of the image to be generated.
Default value: 512
Suggested values: 64, 128, 256, 512, 1024
Range of values: 1 <= Height <= 1024 (lin)
Minimum increment: 1
Recommended increment: 16
Restriction: Height >= 1


Complexity

O(2*Height*Width).


Result

region_to_label always returns TRUE. The behavior in case of empty input (no regions given) can be set via set_system(::'no_object_result',<Result>:) and the behavior in case of an empty input region via set_system(::'empty_region_result',<Result>:). If necessary, an exception is raised.


Possible Predecessors

threshold__, regiongrowing__, connection, expand


Possible Successors

get_greyval__, get_image_pointer__


Alternatives

region_to_bin, paint_region__


See also

label_to_region



Copyright © 1996-1997 MVTec Software GmbH