Herror ::paint_region (
    Hobject Region,
    Hobject Image,
    Hobject *ImageResult,
    const HTuple &Grayval,
    const HTuple &Type
)
HImage HRegion::PaintRegion (
    const HImage &Image,
    const HTuple &Grayval,
    const HTuple &Type
) const
HImage HRegionArray::PaintRegion (
    const HImage &Image,
    const HTuple &Grayval,
    const HTuple &Type
) const

Paint a region in an image with a constant gray value.

::paint_region paints the regions given in Region with a constant gray value into the image given in Image. The parameter Type determines whether the region should be painted filled ('fill') or whether only its boundary should be painted ('margin'). The resulting image is returned in ImageResult.


Attention

::paint_region should only be used to paint into newly created images (::gen_image_const), because otherwise the gray values of other existing images may be overwritten.


Parameters

Region (input_object)
region(-array) -> Hobject: HRegion(Array)
Regions to be painted into the input image.

Image (input_object)
image -> Hobject: HImage
Image in which the regions are to be painted.

ImageResult (output_object)
image -> Hobject * : HImage
Image containing the result.

Grayval (input_control)
number -> HTuple.double / long
Desired gray value of the region.
Default value: 255.0
Suggested values: 0.0, 1.0, 2.0, 5.0, 10.0, 16.0, 32.0, 64.0, 128.0, 253.0, 254.0, 255.0
Typical range of values: 0.0 <= Grayval <= 255.0

Type (input_control)
string -> HTuple.char *
Paint regions filled or as boundaries.
Default value: 'fill'
List of values: 'fill', 'margin'


Example
/* Copy of a rectangle in a new image (New) */

read_image(&Image,"affe");
gen_rectangle1(&Rectangle,100.0,100.0,300.0,300.0);
reduce_domain(Image,Rectangle,&Mask);
/* generate a black image */
gen_image_proto(Image,&New1,0.0);
/* copy a white rectangle */
paint_region(Mask,New1,&New,255.0,"fill");

Result

::paint_region returns H_MSG_TRUE if all parameters are correct. If the input is empty the behavior can be set via ::set_system('no_object_result',<Result>). If necessary, an exception is raised.


Possible Predecessors

::read_image, ::gen_image_const, ::gen_image_proto, ::reduce_domain


Alternatives

::set_grayval, ::paint_gray


See also

::reduce_domain, ::set_draw, ::gen_image_const


Module

Basic operators



Copyright © 1996-2002 MVTec Software GmbH