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

gen_image3_externgen_image3_externgen_image3_externGenImage3ExternGenImage3Extern (Operator)

Name

gen_image3_externgen_image3_externgen_image3_externGenImage3ExternGenImage3Extern — Create a three-channel image from three pointers on the pixels with storage management.

Signature

gen_image3_extern( : Image : Type, Width, Height, PointerRed, PointerGreen, PointerBlue, ClearProc : )

Herror gen_image3_extern(Hobject* Image, const char* Type, const Hlong Width, const Hlong Height, const Hlong PointerRed, const Hlong PointerGreen, const Hlong PointerBlue, const Hlong ClearProc)

Herror T_gen_image3_extern(Hobject* Image, const Htuple Type, const Htuple Width, const Htuple Height, const Htuple PointerRed, const Htuple PointerGreen, const Htuple PointerBlue, const Htuple ClearProc)

Herror gen_image3_extern(Hobject* Image, const HTuple& Type, const HTuple& Width, const HTuple& Height, const HTuple& PointerRed, const HTuple& PointerGreen, const HTuple& PointerBlue, const HTuple& ClearProc)

HImage HImage::GenImage3Extern(const HTuple& Type, const HTuple& Width, const HTuple& Height, const HTuple& PointerRed, const HTuple& PointerGreen, const HTuple& PointerBlue, const HTuple& ClearProc)

void HOperatorSetX.GenImage3Extern(
[out] IHUntypedObjectX*Image, [in] VARIANT Type, [in] VARIANT Width, [in] VARIANT Height, [in] VARIANT PointerRed, [in] VARIANT PointerGreen, [in] VARIANT PointerBlue, [in] VARIANT ClearProc)

void HImageX.GenImage3Extern(
[in] BSTR Type, [in] Hlong Width, [in] Hlong Height, [in] Hlong PointerRed, [in] Hlong PointerGreen, [in] Hlong PointerBlue, [in] Hlong ClearProc)

static void HOperatorSet.GenImage3Extern(out HObject image, HTuple type, HTuple width, HTuple height, HTuple pointerRed, HTuple pointerGreen, HTuple pointerBlue, HTuple clearProc)

void HImage.GenImage3Extern(string type, int width, int height, IntPtr pointerRed, IntPtr pointerGreen, IntPtr pointerBlue, IntPtr clearProc)

Description

The operator gen_image3_externgen_image3_externgen_image3_externGenImage3ExternGenImage3Extern creates a three-channel image of the size WidthWidthWidthWidthwidth * HeightHeightHeightHeightheight. The pixels in PointerRedPointerRedPointerRedPointerRedpointerRed, PointerGreenPointerGreenPointerGreenPointerGreenpointerGreen, and PointerBluePointerBluePointerBluePointerBluepointerBlue are stored line-sequentially. The type of the given pixels must correspond to TypeTypeTypeTypetype. Since the type of the parameters PointerRedPointerRedPointerRedPointerRedpointerRed, PointerGreenPointerGreenPointerGreenPointerGreenpointerGreen, and PointerBluePointerBluePointerBluePointerBluepointerBlue is generic (long) a cast must be used for the call.

The memory for the new image is not newly allocated by HALCON, contrary to gen_image3gen_image3gen_image3GenImage3GenImage3, and thus is not copied either. This means that the memory space that PointerRedPointerRedPointerRedPointerRedpointerRed, PointerGreenPointerGreenPointerGreenPointerGreenpointerGreen, and PointerBluePointerBluePointerBluePointerBluepointerBlue point to must be released by deleting the object ImageImageImageImageimage. This is done by the procedure ClearProcClearProcClearProcClearProcclearProc 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 ImageImageImageImageimage. 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 parameters PointerRedPointerRedPointerRedPointerRedpointerRed, PointerGreenPointerGreenPointerGreenPointerGreenpointerGreen, and PointerBluePointerBluePointerBluePointerBluepointerBlue the pointer has to be passed to the procedure by casting it to long.

Attention

gen_image3_externgen_image3_externgen_image3_externGenImage3ExternGenImage3Extern does not check if enough memory for an image of WidthWidthWidthWidthwidth * HeightHeightHeightHeightheight is allocated in PointerRedPointerRedPointerRedPointerRedpointerRed, PointerGreenPointerGreenPointerGreenPointerGreenpointerGreen, and PointerBluePointerBluePointerBluePointerBluepointerBlue.

Parallelization

Parameters

ImageImageImageImageimage (output_object)  image objectHImageHImageHImageXHobject * (byte / direction / cyclic / int1 / int2 / uint2 / int4 / real)

Created HALCON image.

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

Pixel type.

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

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

WidthWidthWidthWidthwidth (input_control)  extent.x HTupleHTupleVARIANTHtuple (integer) (int / long) (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 ≤ 512 (lin)

Minimum increment: 1

Recommended increment: 10

Restriction: Width >= 1

HeightHeightHeightHeightheight (input_control)  extent.y HTupleHTupleVARIANTHtuple (integer) (int / long) (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 ≤ 512 (lin)

Minimum increment: 1

Recommended increment: 10

Restriction: Height >= 1

PointerRedPointerRedPointerRedPointerRedpointerRed (input_control)  pointer HTupleHTupleVARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong)

Pointer to the first gray value of the first channel.

PointerGreenPointerGreenPointerGreenPointerGreenpointerGreen (input_control)  pointer HTupleHTupleVARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong)

Pointer to the first gray value of the second channel.

PointerBluePointerBluePointerBluePointerBluepointerBlue (input_control)  pointer HTupleHTupleVARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong)

Pointer to the first gray value of the third channel.

ClearProcClearProcClearProcClearProcclearProc (input_control)  pointer HTupleHTupleVARIANTHtuple (integer) (IntPtr) (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_red;
  unsigned char  *image_green;
  unsigned char  *image_blue;
  int            r,c;
  image_red = malloc(640*480);
  image_green = malloc(640*480);
  image_blue = malloc(640*480);
  for (r=0; r<480; r++)
    for (c=0; c<640; c++)
    {
      image_red[r*640+c] = c % 255;
      image_green[r*640+c] = (c+64) % 255;
      image_blue[r*640+c] = (c+128) % 255;
    }
  gen_image3_extern(new,"byte",640,480,(long)image_red,(long)image_green,(long)image_blue,(long)free);
}

Result

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

Alternatives

gen_image3gen_image3gen_image3GenImage3GenImage3, gen_image_constgen_image_constgen_image_constGenImageConstGenImageConst, get_image_pointer3get_image_pointer3get_image_pointer3GetImagePointer3GetImagePointer3, gen_image1_externgen_image1_externgen_image1_externGenImage1ExternGenImage1Extern

See also

reduce_domainreduce_domainreduce_domainReduceDomainReduceDomain, paint_graypaint_graypaint_grayPaintGrayPaintGray, paint_regionpaint_regionpaint_regionPaintRegionPaintRegion, set_grayvalset_grayvalset_grayvalSetGrayvalSetGrayval

Module

Foundation


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