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

gen_image3gen_image3gen_image3GenImage3GenImage3 (Operator)

Name

gen_image3gen_image3gen_image3GenImage3GenImage3 — Create an image from three pointers to the pixels (red/green/blue).

Signature

gen_image3( : ImageRGB : Type, Width, Height, PixelPointerRed, PixelPointerGreen, PixelPointerBlue : )

Herror gen_image3(Hobject* ImageRGB, const char* Type, const Hlong Width, const Hlong Height, const Hlong PixelPointerRed, const Hlong PixelPointerGreen, const Hlong PixelPointerBlue)

Herror T_gen_image3(Hobject* ImageRGB, const Htuple Type, const Htuple Width, const Htuple Height, const Htuple PixelPointerRed, const Htuple PixelPointerGreen, const Htuple PixelPointerBlue)

Herror gen_image3(Hobject* ImageRGB, const HTuple& Type, const HTuple& Width, const HTuple& Height, const HTuple& PixelPointerRed, const HTuple& PixelPointerGreen, const HTuple& PixelPointerBlue)

HImage HImage::GenImage3(const HTuple& Type, const HTuple& Width, const HTuple& Height, const HTuple& PixelPointerRed, const HTuple& PixelPointerGreen, const HTuple& PixelPointerBlue)

void HOperatorSetX.GenImage3(
[out] IHUntypedObjectX*ImageRGB, [in] VARIANT Type, [in] VARIANT Width, [in] VARIANT Height, [in] VARIANT PixelPointerRed, [in] VARIANT PixelPointerGreen, [in] VARIANT PixelPointerBlue)

void HImageX.GenImage3(
[in] BSTR Type, [in] Hlong Width, [in] Hlong Height, [in] Hlong PixelPointerRed, [in] Hlong PixelPointerGreen, [in] Hlong PixelPointerBlue)

static void HOperatorSet.GenImage3(out HObject imageRGB, HTuple type, HTuple width, HTuple height, HTuple pixelPointerRed, HTuple pixelPointerGreen, HTuple pixelPointerBlue)

void HImage.GenImage3(string type, int width, int height, IntPtr pixelPointerRed, IntPtr pixelPointerGreen, IntPtr pixelPointerBlue)

Description

The operator gen_image3gen_image3gen_image3GenImage3GenImage3 creates a three-channel image of the size WidthWidthWidthWidthwidth * HeightHeightHeightHeightheight. The pixels in PixelPointerRedPixelPointerRedPixelPointerRedPixelPointerRedpixelPointerRed, PixelPointerGreenPixelPointerGreenPixelPointerGreenPixelPointerGreenpixelPointerGreen and PixelPointerBluePixelPointerBluePixelPointerBluePixelPointerBluepixelPointerBlue are stored line-sequentially. The type of the given pixels (PixelPointerRedPixelPointerRedPixelPointerRedPixelPointerRedpixelPointerRed etc.) must correspond to the name of the pixels (TypeTypeTypeTypetype). The storage for the new image is newly created by HALCON. Thus, it can be released after the call. Since the type of the parameters (PixelPointerRedPixelPointerRedPixelPointerRedPixelPointerRedpixelPointerRed etc.) is generic (long) a “cast” must be used for the call.

Parallelization

Parameters

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

Created image with new image matrix.

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

Pixel type.

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

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

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

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

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

Pointer to first red value (channel 1).

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

Pointer to first green value (channel 2).

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

Pointer to first blue value (channel 3).

Example (C)

void NewRGBImage(Hobject *new)
{
  unsigned char  red[768*525];
  unsigned char  green[768*525];
  unsigned char  blue[768*525];
  int            r,c;
  for (r=0; r<525; r++)
    for (c=0; c<768; c++)
    {
      red[r*768+c]   = c % 255;
      green[r*768+c] = (767 - c) % 255;
      blue[r*768+c]  = r % 255;
    }
    gen_image3(new,"byte",768,525,(long)red,(long)green,(long)blue);
}

main()
{
  Hobject  rgb;
  open_window(0,0,768,525,0,"","",&WindowHandle);
  NewRGBImage(&rgb);
  disp_color(rgb,WindowHandle);
  clear_obj(rgb);
}

Result

If the parameter values are correct, the operator gen_image3gen_image3gen_image3GenImage3GenImage3 returns the value 2 (H_MSG_TRUE). Otherwise an exception is raised.

Possible Predecessors

gen_image_constgen_image_constgen_image_constGenImageConstGenImageConst, get_image_pointer1get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1

Possible Successors

disp_colordisp_colordisp_colorDispColorDispColor

Alternatives

gen_image1gen_image1gen_image1GenImage1GenImage1, compose3compose3compose3Compose3Compose3, gen_image_constgen_image_constgen_image_constGenImageConstGenImageConst

See also

reduce_domainreduce_domainreduce_domainReduceDomainReduceDomain, paint_graypaint_graypaint_grayPaintGrayPaintGray, paint_regionpaint_regionpaint_regionPaintRegionPaintRegion, set_grayvalset_grayvalset_grayvalSetGrayvalSetGrayval, get_image_pointer1get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1, decompose3decompose3decompose3Decompose3Decompose3

Module

Foundation


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