gen_image_const ( : Image : Type, Width, 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)
                 'uint2'   (2 bytes per pixel, unsigned)
                 '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 -> object : byte / direction / cyclic / int1 / int2 / uint2 / int4 / real / complex / dvf
Created image with new image matrix.

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

Width (input_control)
extent.x -> integer
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 -> integer
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 (Syntax: C)
gen_image_const(&New,"byte",width,height);
get_image_pointer1(New,(long*)&pointer,type,&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 2 (H_MSG_TRUE). Otherwise an exception handling is raised.


Parallelization Information

gen_image_const is reentrant and processed without parallelization.


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

Foundation



Copyright © 1996-2008 MVTec Software GmbH