Skip to content

get_image_pointer1GetImagePointer1GetImagePointer1get_image_pointer1get_image_pointer1๐Ÿ”—

Short description๐Ÿ”—

get_image_pointer1GetImagePointer1GetImagePointer1get_image_pointer1get_image_pointer1 โ€” Access the pointer of a channel.

Signature๐Ÿ”—

get_image_pointer1( image Image, out pointer Pointer, out string Type, out extent.x Width, out extent.y Height )void GetImagePointer1( const HObject& Image, HTuple* Pointer, HTuple* Type, HTuple* Width, HTuple* Height )static void HOperatorSet.GetImagePointer1( HObject image, out HTuple pointer, out HTuple type, out HTuple width, out HTuple height )def get_image_pointer1( image: HObject ) -> Tuple[Sequence[int], Sequence[str], Sequence[int], Sequence[int]]

def get_image_pointer1_s( image: HObject ) -> Tuple[int, str, int, int]Herror get_image_pointer1( const Hobject Image, Hlong* Pointer, char* Type, Hlong* Width, Hlong* Height )

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

HTuple HImage::GetImagePointer1( HTuple* Type, HTuple* Width, HTuple* Height ) const

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

HTuple HImage.GetImagePointer1( out HTuple type, out HTuple width, out HTuple height )

IntPtr HImage.GetImagePointer1( out string type, out int width, out int height )

Description๐Ÿ”—

The operator get_image_pointer1GetImagePointer1 returns a pointer to the first channel of the image Imageimageimage. Additionally, the image type (Typetypetype = โ€˜byteโ€™, โ€˜int2โ€™, โ€˜uint2โ€™, etc.) and the image size (width and height) are returned. Consequently, a direct access to the image data in the HALCON database via the pointer is possible from the programming language in which HALCON is used. An image is stored in HALCON linearized in row major order, i.e., line by line. Note that the image types โ€˜complexโ€™ and โ€˜vector_typeโ€™ are handled in a specific way. In particular, โ€˜complexโ€™ images are interleaved, i.e., the real and the imaginary parts are alternating. In contrast, โ€˜vector_fieldโ€™ images consist of two matrices, one for the rows and one for the columns, which are stored in the HALCON database one after the other.

Attention๐Ÿ”—

The pointer returned by get_image_pointer1GetImagePointer1 may only be used as long as the corresponding image object exists in the HALCON database. This is the case as long as the corresponding variable in the programming language in which HALCON is used is valid. If this is not observed, unexpected behavior or program crashes may result.

If data is written to an existing image via the pointer, all image objects that reference the image are modified. If, for example, the domain of an image is restricted via reduce_domainReduceDomain, the original image object with the full domain and the image object with the reduced domain share the same image matrix (i.e., get_image_pointer1GetImagePointer1 returns the same pointer for both images). Consequently, if one of the two images in this example is modified, both image objects are affected. Therefore, if the pointer is used to write image data in the programming language in which HALCON is used, the image data should be written into an image object that has been created solely for this purpose, e.g., using gen_image1GenImage1. For multi-channel input images the type and the pointer of the first channel is returned.

Execution information๐Ÿ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters๐Ÿ”—

Imageimageimage (input_object) singlechannelimage(-array) โ†’ object (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex / vector_field)HObject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex / vector_field)HImage (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex / vector_field)HObject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex / vector_field)Hobject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex / vector_field)

Input image.

Pointerpointerpointer (output_control) pointer(-array) โ†’ (integer)HTuple (Hlong)HTuple (IntPtr)Sequence[int]Htuple (Hlong)

Pointer to the image data in the HALCON database.

Typetypetype (output_control) string(-array) โ†’ (string)HTuple (HString)HTuple (string)Sequence[str]Htuple (char*)

Type of image.

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

Widthwidthwidth (output_control) extent.x(-array) โ†’ (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

Width of image.

Heightheightheight (output_control) extent.y(-array) โ†’ (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

Height of image.

Example๐Ÿ”—

(C)

Hobject  Image\;
char     typ[128]\;
Hlong     width,height\;
unsigned char *ptr\;

read_image(&Image,"fabrik")\;
get_image_pointer1(Image,(Hlong*)&ptr,typ,&width,&height)\;

Result๐Ÿ”—

The operator get_image_pointer1GetImagePointer1 returns the value 2 (H_MSG_TRUE) if exactly one image was passed. The behavior in case of empty input (no input images available) is set via the operator set_system('no_object_result',<Result>). If necessary an exception is raised.

Combinations with other operators๐Ÿ”—

Combinations

Possible predecessors

read_imageReadImage

Alternatives

set_grayvalSetGrayval, get_grayvalGetGrayval, get_image_pointer3GetImagePointer3, get_image_sizeGetImageSize, get_image_typeGetImageType

See also

paint_regionPaintRegion, paint_grayPaintGray

Module๐Ÿ”—

Foundation