gen_image1gen_image1GenImage1GenImage1gen_image1 (算子名称)
名称
gen_image1gen_image1GenImage1GenImage1gen_image1 — Create an image from a pointer to the pixels.
参数签名
void GenImage1(HObject* Image, const HTuple& Type, const HTuple& Width, const HTuple& Height, const HTuple& PixelPointer)
void HImage::HImage(const HString& Type, Hlong Width, Hlong Height, void* PixelPointer)
void HImage::HImage(const char* Type, Hlong Width, Hlong Height, void* PixelPointer)
void HImage::HImage(const wchar_t* Type, Hlong Width, Hlong Height, void* PixelPointer)
(
Windows only)
void HImage::GenImage1(const HString& Type, Hlong Width, Hlong Height, void* PixelPointer)
void HImage::GenImage1(const char* Type, Hlong Width, Hlong Height, void* PixelPointer)
void HImage::GenImage1(const wchar_t* Type, Hlong Width, Hlong Height, void* PixelPointer)
(
Windows only)
static void HOperatorSet.GenImage1(out HObject image, HTuple type, HTuple width, HTuple height, HTuple pixelPointer)
public HImage(string type, int width, int height, IntPtr pixelPointer)
void HImage.GenImage1(string type, int width, int height, IntPtr pixelPointer)
描述
该算子 gen_image1gen_image1GenImage1GenImage1GenImage1gen_image1 creates an image of the size
WidthWidthWidthWidthwidthwidth * HeightHeightHeightHeightheightheight.
The pixels in PixelPointerPixelPointerPixelPointerPixelPointerpixelPointerpixel_pointer are stored line-sequentially.
The type of the given pixels (PixelPointerPixelPointerPixelPointerPixelPointerpixelPointerpixel_pointer) 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, the storage on the PixelPointerPixelPointerPixelPointerPixelPointerpixelPointerpixel_pointer 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_image1gen_image1GenImage1GenImage1GenImage1gen_image1 does not check whether the PixelPointerPixelPointerPixelPointerPixelPointerpixelPointerpixel_pointer is
valid or not. Thus, it must be ensured by the user that it is valid.
Otherwise, the program may crash!
运行信息
- 多线程类型:可重入(与非独占操作符并行运行)。
- 多线程作用域:全局(可以从任何线程调用)。
- 未经并行化处理。
参数表
ImageImageImageImageimageimage (output_object) image → objectHImageHObjectHImageHobject * (byte / direction / cyclic / int1 / int2 / uint2 / int4 / real)
Created image with new image matrix.
TypeTypeTypeTypetypetype (input_control) string → HTuplestrHTupleHtuple (string) (string) (HString) (char*)
Pixel type.
Default:
'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 → HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Width of image.
Default:
512
Suggested values:
128, 256, 512, 1024
Value range:
1
≤
Width
Width
Width
Width
width
width
(lin)
Minimum increment:
1
Recommended increment:
10
HeightHeightHeightHeightheightheight (input_control) extent.y → HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Height of image.
Default:
512
Suggested values:
128, 256, 512, 1024
Value range:
1
≤
Height
Height
Height
Height
height
height
(lin)
Minimum increment:
1
Recommended increment:
10
PixelPointerPixelPointerPixelPointerPixelPointerpixelPointerpixel_pointer (input_control) pointer → HTupleintHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)
Pointer to first gray value.
例程 (C)
void NewImage(Hobject *new)
{
unsigned char image[768*525];
int r,c;
for (r=0; r<525; r++)
for (c=0; c<768; c++)
image[r*768+c] = c % 255;
gen_image1(new,"byte",768,525,(Hlong)image);
}
结果
If the parameter values are correct, 该算子 gen_image1gen_image1GenImage1GenImage1GenImage1gen_image1
返回值 2 (
H_MSG_TRUE)
.
Otherwise an exception is raised.
可能的前置算子
gen_image_constgen_image_constGenImageConstGenImageConstGenImageConstgen_image_const,
get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1GetImagePointer1get_image_pointer1
可替代算子
gen_image3gen_image3GenImage3GenImage3GenImage3gen_image3,
gen_image1_externgen_image1_externGenImage1ExternGenImage1ExternGenImage1Externgen_image1_extern,
gen_image_constgen_image_constGenImageConstGenImageConstGenImageConstgen_image_const,
get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1GetImagePointer1get_image_pointer1
参考其它
reduce_domainreduce_domainReduceDomainReduceDomainReduceDomainreduce_domain,
paint_graypaint_grayPaintGrayPaintGrayPaintGraypaint_gray,
paint_regionpaint_regionPaintRegionPaintRegionPaintRegionpaint_region,
set_grayvalset_grayvalSetGrayvalSetGrayvalSetGrayvalset_grayval
模块
Foundation