gen_image3gen_image3GenImage3GenImage3gen_image3 (算子)

名称

gen_image3gen_image3GenImage3GenImage3gen_image3 — 从三个指向像素(红/绿/蓝)的指针创建图像。

签名

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)

void GenImage3(HObject* ImageRGB, const HTuple& Type, const HTuple& Width, const HTuple& Height, const HTuple& PixelPointerRed, const HTuple& PixelPointerGreen, const HTuple& PixelPointerBlue)

void HImage::GenImage3(const HString& Type, Hlong Width, Hlong Height, void* PixelPointerRed, void* PixelPointerGreen, void* PixelPointerBlue)

void HImage::GenImage3(const char* Type, Hlong Width, Hlong Height, void* PixelPointerRed, void* PixelPointerGreen, void* PixelPointerBlue)

void HImage::GenImage3(const wchar_t* Type, Hlong Width, Hlong Height, void* PixelPointerRed, void* PixelPointerGreen, void* PixelPointerBlue)   ( Windows only)

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)

def gen_image3(type: str, width: int, height: int, pixel_pointer_red: int, pixel_pointer_green: int, pixel_pointer_blue: int) -> HObject

描述

算子 gen_image3gen_image3GenImage3GenImage3GenImage3gen_image3 creates a three-channel image of the size WidthWidthWidthWidthwidthwidth * HeightHeightHeightHeightheightheight. The pixels in PixelPointerRedPixelPointerRedPixelPointerRedPixelPointerRedpixelPointerRedpixel_pointer_red, PixelPointerGreenPixelPointerGreenPixelPointerGreenPixelPointerGreenpixelPointerGreenpixel_pointer_green and PixelPointerBluePixelPointerBluePixelPointerBluePixelPointerBluepixelPointerBluepixel_pointer_blue are stored line-sequentially. The type of the given pixels (PixelPointerRedPixelPointerRedPixelPointerRedPixelPointerRedpixelPointerRedpixel_pointer_red etc.) must correspond to TypeTypeTypeTypetypetype (see gen_image_constgen_image_constGenImageConstGenImageConstGenImageConstgen_image_const for a more detailed description of the pixel types). The storage for the new image is newly created by HALCON. Thus, it can be released after the call. 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.

注意

gen_image3gen_image3GenImage3GenImage3GenImage3gen_image3 does not check whether the pixels in PixelPointerRedPixelPointerRedPixelPointerRedPixelPointerRedpixelPointerRedpixel_pointer_red,PixelPointerGreenPixelPointerGreenPixelPointerGreenPixelPointerGreenpixelPointerGreenpixel_pointer_green, and PixelPointerBluePixelPointerBluePixelPointerBluePixelPointerBluepixelPointerBluepixel_pointer_blue are valid or not. Thus, it must be ensured by the user that they are valid. Otherwise, the program may crash!

执行信息

参数

ImageRGBImageRGBImageRGBImageRGBimageRGBimage_rgb (输出对象)  image objectHImageHObjectHImageHobject * (byte / direction / cyclic / int1 / int2 / uint2 / int4 / real)

Created image with new image matrix.

TypeTypeTypeTypetypetype (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Pixel type.

默认值: 'byte' "byte" "byte" "byte" "byte" "byte"

值列表: '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 (输入控制)  extent.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Width of image.

默认值: 512

建议值: 128, 256, 512, 1024

值范围: 1 ≤ Width Width Width Width width width (lin)

最小增量: 1

建议增量: 10

HeightHeightHeightHeightheightheight (输入控制)  extent.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Height of image.

默认值: 512

建议值: 128, 256, 512, 1024

值范围: 1 ≤ Height Height Height Height height height (lin)

最小增量: 1

建议增量: 10

PixelPointerRedPixelPointerRedPixelPointerRedPixelPointerRedpixelPointerRedpixel_pointer_red (输入控制)  pointer HTupleintHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)

Pointer to first red value (channel 1).

PixelPointerGreenPixelPointerGreenPixelPointerGreenPixelPointerGreenpixelPointerGreenpixel_pointer_green (输入控制)  pointer HTupleintHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)

Pointer to first green value (channel 2).

PixelPointerBluePixelPointerBluePixelPointerBluePixelPointerBluepixelPointerBluepixel_pointer_blue (输入控制)  pointer HTupleintHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)

Pointer to first blue value (channel 3).

示例(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,(Hlong)red,(long)green,(long)blue);
}

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

结果

如果参数值正确,算子 gen_image3gen_image3GenImage3GenImage3GenImage3gen_image3 返回值 2 ( H_MSG_TRUE )。否则将抛出异常。

可能的前趋

gen_image_constgen_image_constGenImageConstGenImageConstGenImageConstgen_image_const, get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1GetImagePointer1get_image_pointer1

可能的后继

disp_colordisp_colorDispColorDispColorDispColordisp_color

替代

gen_image1gen_image1GenImage1GenImage1GenImage1gen_image1, compose3compose3Compose3Compose3Compose3compose3, gen_image_constgen_image_constGenImageConstGenImageConstGenImageConstgen_image_const

另见

reduce_domainreduce_domainReduceDomainReduceDomainReduceDomainreduce_domain, paint_graypaint_grayPaintGrayPaintGrayPaintGraypaint_gray, paint_regionpaint_regionPaintRegionPaintRegionPaintRegionpaint_region, set_grayvalset_grayvalSetGrayvalSetGrayvalSetGrayvalset_grayval, get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1GetImagePointer1get_image_pointer1, decompose3decompose3Decompose3Decompose3Decompose3decompose3

模块

基础