HALCON Reference Manual 10.0.2
Table of Contents / Image / Access ClassesClassesClasses | | | Operators

get_image_pointer1get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1 (Operator)

Name

get_image_pointer1get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1 — Access the pointer of a channel.

Signature

get_image_pointer1(Image : : : Pointer, Type, Width, Height)

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)

Herror get_image_pointer1(Hobject Image, Hlong* Pointer, char* Type, Hlong* Width, Hlong* Height)

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

void HOperatorSetX.GetImagePointer1(
[in] IHUntypedObjectX* Image, [out] VARIANT* Pointer, [out] VARIANT* Type, [out] VARIANT* Width, [out] VARIANT* Height)

Hlong HImageX.GetImagePointer1(
[out] BSTR* Type, [out] Hlong* Width, [out] Hlong* Height)

static void HOperatorSet.GetImagePointer1(HObject image, out HTuple pointer, 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_pointer1get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1 returns a pointer to the first channel of the image ImageImageImageImageimage. Additionally, the image type (TypeTypeTypeTypetype = '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_pointer1get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1 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_domainreduce_domainreduce_domainReduceDomainReduceDomain, 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_pointer1get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1 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_image1gen_image1gen_image1GenImage1GenImage1.

Parallelization

Parameters

ImageImageImageImageimage (input_object)  image objectHImageHImageHImageXHobject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex / vector_field)

Input image.

PointerPointerPointerPointerpointer (output_control)  pointer HTupleHTupleVARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong)

Pointer to the image data in the HALCON database.

TypeTypeTypeTypetype (output_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Type of image.

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

WidthWidthWidthWidthwidth (output_control)  extent.x HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Width of image.

HeightHeightHeightHeightheight (output_control)  extent.y HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Height of image.

Example (C)

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

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

Result

The operator get_image_pointer1get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1 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>)set_system("no_object_result",<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>). If necessary an exception is raised.

Possible Predecessors

read_imageread_imageread_imageReadImageReadImage

Alternatives

set_grayvalset_grayvalset_grayvalSetGrayvalSetGrayval, get_grayvalget_grayvalget_grayvalGetGrayvalGetGrayval, get_image_pointer3get_image_pointer3get_image_pointer3GetImagePointer3GetImagePointer3, get_image_sizeget_image_sizeget_image_sizeGetImageSizeGetImageSize, get_image_typeget_image_typeget_image_typeGetImageTypeGetImageType

See also

paint_regionpaint_regionpaint_regionPaintRegionPaintRegion, paint_graypaint_graypaint_grayPaintGrayPaintGray

Module

Foundation


Table of Contents / Image / Access ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH