ClassesClassesClassesClasses | | | | Operators

gen_image1_externgen_image1_externGenImage1Externgen_image1_externGenImage1ExternGenImage1Extern (Operator)


gen_image1_externgen_image1_externGenImage1Externgen_image1_externGenImage1ExternGenImage1Extern — Create an image from a pointer on the pixels with storage management.


gen_image1_extern( : Image : Type, Width, Height, PixelPointer, ClearProc : )

Herror gen_image1_extern(Hobject* Image, const char* Type, const Hlong Width, const Hlong Height, const Hlong PixelPointer, const Hlong ClearProc)

Herror T_gen_image1_extern(Hobject* Image, const Htuple Type, const Htuple Width, const Htuple Height, const Htuple PixelPointer, const Htuple ClearProc)

Herror gen_image1_extern(Hobject* Image, const HTuple& Type, const HTuple& Width, const HTuple& Height, const HTuple& PixelPointer, const HTuple& ClearProc)

HImage HImage::GenImage1Extern(const HTuple& Type, const HTuple& Width, const HTuple& Height, const HTuple& PixelPointer, const HTuple& ClearProc)

void GenImage1Extern(HObject* Image, const HTuple& Type, const HTuple& Width, const HTuple& Height, const HTuple& PixelPointer, const HTuple& ClearProc)

void HImage::GenImage1Extern(const HString& Type, Hlong Width, Hlong Height, void* PixelPointer, void* ClearProc)

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

void HOperatorSetX.GenImage1Extern(
[out] IHUntypedObjectX*Image, [in] VARIANT Type, [in] VARIANT Width, [in] VARIANT Height, [in] VARIANT PixelPointer, [in] VARIANT ClearProc)

void HImageX.GenImage1Extern(
[in] BSTR Type, [in] Hlong Width, [in] Hlong Height, [in] Hlong PixelPointer, [in] Hlong ClearProc)

static void HOperatorSet.GenImage1Extern(out HObject image, HTuple type, HTuple width, HTuple height, HTuple pixelPointer, HTuple clearProc)

void HImage.GenImage1Extern(string type, int width, int height, IntPtr pixelPointer, IntPtr clearProc)


The operator gen_image1_externgen_image1_externGenImage1Externgen_image1_externGenImage1ExternGenImage1Extern creates an image of the size WidthWidthWidthWidthWidthwidth * HeightHeightHeightHeightHeightheight. The pixels in PixelPointerPixelPointerPixelPointerPixelPointerPixelPointerpixelPointer are stored line-sequentially. The type of the given pixels (PixelPointerPixelPointerPixelPointerPixelPointerPixelPointerpixelPointer) must correspond to TypeTypeTypeTypeTypetype (see gen_image_constgen_image_constGenImageConstgen_image_constGenImageConstGenImageConst for a more detailed description of the image types). Note that how to pass a pointer value depends on the used operator signature and programming environment. Make sure to pass the actual memory address where the image data is stored, not the address of a pointer variable. Care must be taken not to truncate 64-bit pointers on 64-bit architectures.

The memory for the new image is not newly allocated by HALCON, contrary to gen_image1gen_image1GenImage1gen_image1GenImage1GenImage1, and thus is not copied either. This means that the memory space that PixelPointerPixelPointerPixelPointerPixelPointerPixelPointerpixelPointer points to must be released by deleting the object ImageImageImageImageImageimage. This is done by the procedure ClearProcClearProcClearProcClearProcClearProcclearProc provided by the caller. This procedure must have the following signature

void ClearProc(void* ptr);

and will be called using __cdecl calling convention when deleting ImageImageImageImageImageimage. If the memory shall not be released (in the case of frame grabbers or static memory) a procedure “without trunk” or the NULL-Pointer can be passed. Analogous to the parameter PixelPointerPixelPointerPixelPointerPixelPointerPixelPointerpixelPointer the pointer has to be passed to the procedure depending on the used operator signature and programming environment.


gen_image1_externgen_image1_externGenImage1Externgen_image1_externGenImage1ExternGenImage1Extern does not check if enough memory for an image of WidthWidthWidthWidthWidthwidth * HeightHeightHeightHeightHeightheight is allocated in PixelPointerPixelPointerPixelPointerPixelPointerPixelPointerpixelPointer.



ImageImageImageImageImageimage (output_object)  image objectHImageHImageHImageHImageXHobject * (byte / direction / cyclic / int1 / int2 / uint2 / int4 / real)

Created HALCON image.

TypeTypeTypeTypeTypetype (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Pixel type.

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

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

WidthWidthWidthWidthWidthwidth (input_control)  extent.x HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Width of image.

Default value: 512

Suggested values: 128, 256, 512, 1024

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

Minimum increment: 1

Recommended increment: 10

Restriction: Width >= 1

HeightHeightHeightHeightHeightheight (input_control)  extent.y HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Height of image.

Default value: 512

Suggested values: 128, 256, 512, 1024

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

Minimum increment: 1

Recommended increment: 10

Restriction: Height >= 1

PixelPointerPixelPointerPixelPointerPixelPointerPixelPointerpixelPointer (input_control)  pointer HTupleHTupleHTupleVARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (Hlong)

Pointer to the first gray value.

ClearProcClearProcClearProcClearProcClearProcclearProc (input_control)  pointer HTupleHTupleHTupleVARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (Hlong)

Pointer to the procedure re-releasing the memory of the image when deleting the object.

Default value: 0

Example (C)

void NewImage(Hobject *new)
  unsigned char  *image;
  int            r,c;
  image = malloc(640*480);
  for (r=0; r<480; r++)
    for (c=0; c<640; c++)
      image[r*640+c] = c % 255;


The operator gen_image1_externgen_image1_externGenImage1Externgen_image1_externGenImage1ExternGenImage1Extern returns the value 2 (H_MSG_TRUE) if the parameter values are correct. Otherwise an exception is raised.


gen_image1gen_image1GenImage1gen_image1GenImage1GenImage1, gen_image_constgen_image_constGenImageConstgen_image_constGenImageConstGenImageConst, get_image_pointer1get_image_pointer1GetImagePointer1get_image_pointer1GetImagePointer1GetImagePointer1, gen_image3_externgen_image3_externGenImage3Externgen_image3_externGenImage3ExternGenImage3Extern

See also

reduce_domainreduce_domainReduceDomainreduce_domainReduceDomainReduceDomain, paint_graypaint_grayPaintGraypaint_grayPaintGrayPaintGray, paint_regionpaint_regionPaintRegionpaint_regionPaintRegionPaintRegion, set_grayvalset_grayvalSetGrayvalset_grayvalSetGrayvalSetGrayval



ClassesClassesClassesClasses | | | | Operators