ClassesClassesClassesClasses | | | | Operators

gen_image1_rectgen_image1_rectGenImage1Rectgen_image1_rectGenImage1RectGenImage1Rect (Operator)

Name

gen_image1_rectgen_image1_rectGenImage1Rectgen_image1_rectGenImage1RectGenImage1Rect — Create an image with a rectangular domain from a pointer on the pixels (with storage management).

Signature

gen_image1_rect( : Image : PixelPointer, Width, Height, VerticalPitch, HorizontalBitPitch, BitsPerPixel, DoCopy, ClearProc : )

Herror gen_image1_rect(Hobject* Image, const Hlong PixelPointer, const Hlong Width, const Hlong Height, const Hlong VerticalPitch, const Hlong HorizontalBitPitch, const Hlong BitsPerPixel, const char* DoCopy, const Hlong ClearProc)

Herror T_gen_image1_rect(Hobject* Image, const Htuple PixelPointer, const Htuple Width, const Htuple Height, const Htuple VerticalPitch, const Htuple HorizontalBitPitch, const Htuple BitsPerPixel, const Htuple DoCopy, const Htuple ClearProc)

Herror gen_image1_rect(Hobject* Image, const HTuple& PixelPointer, const HTuple& Width, const HTuple& Height, const HTuple& VerticalPitch, const HTuple& HorizontalBitPitch, const HTuple& BitsPerPixel, const HTuple& DoCopy, const HTuple& ClearProc)

HImage HImage::GenImage1Rect(const HTuple& PixelPointer, const HTuple& Width, const HTuple& Height, const HTuple& VerticalPitch, const HTuple& HorizontalBitPitch, const HTuple& BitsPerPixel, const HTuple& DoCopy, const HTuple& ClearProc)

void GenImage1Rect(HObject* Image, const HTuple& PixelPointer, const HTuple& Width, const HTuple& Height, const HTuple& VerticalPitch, const HTuple& HorizontalBitPitch, const HTuple& BitsPerPixel, const HTuple& DoCopy, const HTuple& ClearProc)

void HImage::GenImage1Rect(void* PixelPointer, Hlong Width, Hlong Height, Hlong VerticalPitch, Hlong HorizontalBitPitch, Hlong BitsPerPixel, const HString& DoCopy, void* ClearProc)

void HImage::GenImage1Rect(void* PixelPointer, Hlong Width, Hlong Height, Hlong VerticalPitch, Hlong HorizontalBitPitch, Hlong BitsPerPixel, const char* DoCopy, void* ClearProc)

void HOperatorSetX.GenImage1Rect(
[out] IHUntypedObjectX*Image, [in] VARIANT PixelPointer, [in] VARIANT Width, [in] VARIANT Height, [in] VARIANT VerticalPitch, [in] VARIANT HorizontalBitPitch, [in] VARIANT BitsPerPixel, [in] VARIANT DoCopy, [in] VARIANT ClearProc)

void HImageX.GenImage1Rect(
[in] Hlong PixelPointer, [in] Hlong Width, [in] Hlong Height, [in] Hlong VerticalPitch, [in] Hlong HorizontalBitPitch, [in] Hlong BitsPerPixel, [in] BSTR DoCopy, [in] Hlong ClearProc)

static void HOperatorSet.GenImage1Rect(out HObject image, HTuple pixelPointer, HTuple width, HTuple height, HTuple verticalPitch, HTuple horizontalBitPitch, HTuple bitsPerPixel, HTuple doCopy, HTuple clearProc)

void HImage.GenImage1Rect(IntPtr pixelPointer, int width, int height, int verticalPitch, int horizontalBitPitch, int bitsPerPixel, string doCopy, IntPtr clearProc)

Description

The operator gen_image1_rectgen_image1_rectGenImage1Rectgen_image1_rectGenImage1RectGenImage1Rect creates an image of size (VerticalPitchVerticalPitchVerticalPitchVerticalPitchVerticalPitchverticalPitch/(HorizontalBitPitchHorizontalBitPitchHorizontalBitPitchHorizontalBitPitchHorizontalBitPitchhorizontalBitPitch / 8)) * HeightHeightHeightHeightHeightheight. The pixels pointed to by PixelPointerPixelPointerPixelPointerPixelPointerPixelPointerpixelPointer are stored line by line. 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.

VerticalPitchVerticalPitchVerticalPitchVerticalPitchVerticalPitchverticalPitch determines the distance (in bytes) between pixel m in row n and pixel m in row n+1 inside of memory. All rows of the 'input image' have the same vertical pitch. The width of the output image is VerticalPitchVerticalPitchVerticalPitchVerticalPitchVerticalPitchverticalPitch / (HorizontalBitPitchHorizontalBitPitchHorizontalBitPitchHorizontalBitPitchHorizontalBitPitchhorizontalBitPitch / 8), its height is HeightHeightHeightHeightHeightheight. The domain of the output image ImageImageImageImageImageimage is a rectangle of the size WidthWidthWidthWidthWidthwidth * HeightHeightHeightHeightHeightheight. The parameter HorizontalBitPitchHorizontalBitPitchHorizontalBitPitchHorizontalBitPitchHorizontalBitPitchhorizontalBitPitch is the horizontal distance (in bits) between two neighboring pixels. BitsPerPixelBitsPerPixelBitsPerPixelBitsPerPixelBitsPerPixelbitsPerPixel is the number of used bits per pixel.

If DoCopyDoCopyDoCopyDoCopyDoCopydoCopy is set 'true', the image data pointed to by PixelPointerPixelPointerPixelPointerPixelPointerPixelPointerpixelPointer is copied and memory for the new image is newly allocated by HALCON. Else the image data is not duplicated and the memory space that PixelPointerPixelPointerPixelPointerPixelPointerPixelPointerpixelPointer points to must be released when 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. Analogously to the parameter PixelPointerPixelPointerPixelPointerPixelPointerPixelPointerpixelPointer the pointer has to be passed to the procedure depending on the used operator signature and programming environment. If DoCopyDoCopyDoCopyDoCopyDoCopydoCopy is 'true' then ClearProcClearProcClearProcClearProcClearProcclearProc is irrelevant. The operator gen_image1_rectgen_image1_rectGenImage1Rectgen_image1_rectGenImage1RectGenImage1Rect is symmetrical to get_image_pointer1_rectget_image_pointer1_rectGetImagePointer1Rectget_image_pointer1_rectGetImagePointer1RectGetImagePointer1Rect.

Parallelization

Parameters

ImageImageImageImageImageimage (output_object)  image objectHImageHImageHImageHImageXHobject * (byte / uint2 / int4)

Created HALCON image.

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

Pointer to the first pixel.

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

Width of the 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 the 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

VerticalPitchVerticalPitchVerticalPitchVerticalPitchVerticalPitchverticalPitch (input_control)  integer HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Distance (in bytes) between pixel m in row n and pixel m in row n+1 of the 'input image'.

Restriction: VerticalPitch >= Width * HorizontalBitPitch / 8

HorizontalBitPitchHorizontalBitPitchHorizontalBitPitchHorizontalBitPitchHorizontalBitPitchhorizontalBitPitch (input_control)  integer HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Distance between two neighboring pixels in bits .

Default value: 8

List of values: 8, 16, 32

BitsPerPixelBitsPerPixelBitsPerPixelBitsPerPixelBitsPerPixelbitsPerPixel (input_control)  integer HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Number of used bits per pixel.

Default value: 8

List of values: 8, 9, 10, 11, 12, 13, 14, 15, 16, 32

Restriction: BitsPerPixel <= HorizontalBitPitch

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

Copy image data.

Default value: 'false' "false" "false" "false" "false" "false"

Suggested values: 'true'"true""true""true""true""true", 'false'"false""false""false""false""false"

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

Pointer to the procedure 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;
  gen_image1_rect(new,(Hlong)image,400,480,640,8,8,'false',(long)free);
}

Result

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

Possible Successors

get_image_pointer1_rectget_image_pointer1_rectGetImagePointer1Rectget_image_pointer1_rectGetImagePointer1RectGetImagePointer1Rect

Alternatives

gen_image1gen_image1GenImage1gen_image1GenImage1GenImage1, gen_image1_externgen_image1_externGenImage1Externgen_image1_externGenImage1ExternGenImage1Extern, gen_image_constgen_image_constGenImageConstgen_image_constGenImageConstGenImageConst

See also

get_image_pointer1_rectget_image_pointer1_rectGetImagePointer1Rectget_image_pointer1_rectGetImagePointer1RectGetImagePointer1Rect

Module

Foundation


ClassesClassesClassesClasses | | | | Operators