Herror ::gen_image_const (
    Hobject *Image,
    const HTuple &Type,
    const HTuple &Width,
    const HTuple &Height
)
HImage HImage::GenImageConst (
    const HTuple &Type,
    const HTuple &Width,
    const HTuple &Height
)

Create an image with constant gray value.

The operator ::gen_image_const creates an image of the indicated size. The height and width of the image are determined by Height and Width. HALCON supports the following image types:

                 'byte'    (1 byte per pixel, value area: 0..255)
	           'int1'    (1 byte per pixel, signed)
	           'int2'    (2 bytes per pixel, signed)
	           'int4'    (4 bytes per pixel, signed)
	           'real'    (4 bytes per pixel)
	           'complex' (two 'real' matrices)
	           'dvf'     (two 'int1' matrices)
	           'dir'     (1 byte per pixel, value area: 0..180))
	           'cyclic'  (1 byte per pixel; cyclic value area: 0..255)).
The default value 0 is set via the operator ::set_system('init_new_image',<'true'/'false'>).


Parameters

Image (output_object)
image -> Hobject * : HImage
Created image with new image matrix.

Type (input_control)
string -> HTuple.char *
Pixel type.
Default value: 'byte'
List of values: 'int1', 'int2', 'int4', 'byte', 'real', 'direction', 'cyclic', 'complex', 'dvf', 'lut'

Width (input_control)
extent.x -> HTuple.long
Width of image.
Default value: 512
Suggested values: 128, 256, 512, 1024
Typical range of values: 1 <= Width <= 512 (lin)
Minimum increment: 1
Recommended increment: 10
Restriction: Width >= 1

Height (input_control)
extent.y -> HTuple.long
Height of image.
Default value: 512
Suggested values: 128, 256, 512, 1024
Typical range of values: 1 <= Height <= 512 (lin)
Minimum increment: 1
Recommended increment: 10
Restriction: Height >= 1


Example
gen_image_const(&New,"byte",width,height);
get_image_pointer1(New,(long*)&pointer,"byte",width,height);
for (row=0; row<height-1; row++)
  for (col=0; col<width-1; col++)
    pointer[row*width+col] = (row + col) % 256;

Result

If the parameter values are correct, the operator ::gen_image_const returns the value H_MSG_TRUE. Otherwise an exception handling is raised.


Possible Successors

::paint_region, ::reduce_domain, ::get_image_pointer1, ::copy_obj


Alternatives

::gen_image1, ::gen_image3


See also

::reduce_domain, ::paint_gray, ::paint_region, ::set_grayval, ::get_image_pointer1


Module

Image / region / XLD management



Copyright © 1996-2002 MVTec Software GmbH