ClassesClasses | | Operators

gen_image_constgen_image_constGenImageConstGenImageConst (Operator)


gen_image_constgen_image_constGenImageConstGenImageConst — Create an image with constant gray value.


gen_image_const( : Image : Type, Width, Height : )

Herror gen_image_const(Hobject* Image, const char* Type, const Hlong Width, const Hlong Height)

Herror T_gen_image_const(Hobject* Image, const Htuple Type, const Htuple Width, const Htuple Height)

void GenImageConst(HObject* Image, const HTuple& Type, const HTuple& Width, const HTuple& Height)

void HImage::HImage(const HString& Type, Hlong Width, Hlong Height)

void HImage::HImage(const char* Type, Hlong Width, Hlong Height)

void HImage::GenImageConst(const HString& Type, Hlong Width, Hlong Height)

void HImage::GenImageConst(const char* Type, Hlong Width, Hlong Height)

static void HOperatorSet.GenImageConst(out HObject image, HTuple type, HTuple width, HTuple height)

public HImage(string type, int width, int height)

void HImage.GenImageConst(string type, int width, int height)


The operator gen_image_constgen_image_constGenImageConstGenImageConstGenImageConst creates an image of the indicated size. The width and height of the image are determined by WidthWidthWidthWidthwidth and HeightHeightHeightHeightheight. HALCON supports the following image types:


1 byte per pixel, unsigned

Value range: (0..255)


1 byte per pixel, signed

Value range: (-128..127)


2 bytes per pixel, unsigned

Value range: (0..65535)


2 bytes per pixel, signed

Value range: (-32768..32767)


4 bytes per pixel, signed

Value range: (-2147483648..2147483647)


8 bytes per pixel, signed (only available on 64 bit systems)

Value range: (-9223372036854775808..9223372036854775807)


4 bytes per pixel, floating point

Value range: (-3.4e38..3.4e38)

Precision: 6 significant decimal digits


Two matrices of type 'real'"real""real""real""real"


Two matrices of type 'real'"real""real""real""real"

Interpretation: Vectors


Two matrices of type 'real'"real""real""real""real"

Interpretation: Absolute coordinates


1 byte per pixel, unsigned

Value range: (0..179)

Interpretation: Angle divided by two

Attention: The values 180..254 are automatically set to the value 255, which is interpreted as undefined angle.


1 byte per pixel, unsigned, cyclic arithmetics

Value range: (0..255)

With the operator set_system('init_new_image',<'true'/'false'>)set_system("init_new_image",<"true"/"false">)SetSystem("init_new_image",<"true"/"false">)SetSystem("init_new_image",<"true"/"false">)SetSystem("init_new_image",<"true"/"false">), it can be controlled whether the created image is initialized with 0 or not.

Execution Information


ImageImageImageImageimage (output_object)  image objectHImageHImageHobject * (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex / vector_field)

Created image with new image matrix.

TypeTypeTypeTypetype (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Pixel type.

Default value: 'byte' "byte" "byte" "byte" "byte"

List of values: 'byte'"byte""byte""byte""byte", 'complex'"complex""complex""complex""complex", 'cyclic'"cyclic""cyclic""cyclic""cyclic", 'direction'"direction""direction""direction""direction", 'int1'"int1""int1""int1""int1", 'int2'"int2""int2""int2""int2", 'int4'"int4""int4""int4""int4", 'int8'"int8""int8""int8""int8", 'real'"real""real""real""real", 'uint2'"uint2""uint2""uint2""uint2", 'vector_field_absolute'"vector_field_absolute""vector_field_absolute""vector_field_absolute""vector_field_absolute", 'vector_field_relative'"vector_field_relative""vector_field_relative""vector_field_relative""vector_field_relative"

WidthWidthWidthWidthwidth (input_control)  extent.x HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Width of image.

Default value: 512

Suggested values: 128, 256, 512, 1024

Typical range of values: 1 ≤ Width Width Width Width width ≤ 512 (lin)

Minimum increment: 1

Recommended increment: 10

Restriction: Width >= 1

HeightHeightHeightHeightheight (input_control)  extent.y HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Height of image.

Default value: 512

Suggested values: 128, 256, 512, 1024

Typical range of values: 1 ≤ Height Height Height Height height ≤ 512 (lin)

Minimum increment: 1

Recommended increment: 10

Restriction: Height >= 1

Example (C)

for (row=0; row<height-1; row++)
  for (col=0; col<width-1; col++)
    pointer[row*width+col] = (row + col) % 256;


If the parameter values are correct, the operator gen_image_constgen_image_constGenImageConstGenImageConstGenImageConst returns the value 2 (H_MSG_TRUE). Otherwise an exception is raised.

Possible Successors

paint_regionpaint_regionPaintRegionPaintRegionPaintRegion, reduce_domainreduce_domainReduceDomainReduceDomainReduceDomain, get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1GetImagePointer1, copy_objcopy_objCopyObjCopyObjCopyObj


gen_image1gen_image1GenImage1GenImage1GenImage1, gen_image3gen_image3GenImage3GenImage3GenImage3

See also

reduce_domainreduce_domainReduceDomainReduceDomainReduceDomain, paint_graypaint_grayPaintGrayPaintGrayPaintGray, paint_regionpaint_regionPaintRegionPaintRegionPaintRegion, set_grayvalset_grayvalSetGrayvalSetGrayvalSetGrayval, get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1GetImagePointer1



ClassesClasses | | Operators