gen_image1_rectgen_image1_rectGenImage1RectGenImage1Rectgen_image1_rect (算子)
名称
gen_image1_rectgen_image1_rectGenImage1RectGenImage1Rectgen_image1_rect — 从像素上的指针创建具有矩形域的图像(使用存储管理)。
签名
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)
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 HImage::GenImage1Rect(void* PixelPointer, Hlong Width, Hlong Height, Hlong VerticalPitch, Hlong HorizontalBitPitch, Hlong BitsPerPixel, const wchar_t* DoCopy, void* ClearProc)
(
Windows only)
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)
描述
算子 gen_image1_rectgen_image1_rectGenImage1RectGenImage1RectGenImage1Rectgen_image1_rect creates an image of size
(VerticalPitchVerticalPitchVerticalPitchVerticalPitchverticalPitchvertical_pitch / (HorizontalBitPitchHorizontalBitPitchHorizontalBitPitchHorizontalBitPitchhorizontalBitPitchhorizontal_bit_pitch/8)) * HeightHeightHeightHeightheightheight.
The pixels pointed to by
PixelPointerPixelPointerPixelPointerPixelPointerpixelPointerpixel_pointer 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.
VerticalPitchVerticalPitchVerticalPitchVerticalPitchverticalPitchvertical_pitch 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 VerticalPitchVerticalPitchVerticalPitchVerticalPitchverticalPitchvertical_pitch /
(HorizontalBitPitchHorizontalBitPitchHorizontalBitPitchHorizontalBitPitchhorizontalBitPitchhorizontal_bit_pitch / 8), its height is HeightHeightHeightHeightheightheight.
The domain of the output image ImageImageImageImageimageimage is a rectangle of the size
WidthWidthWidthWidthwidthwidth * HeightHeightHeightHeightheightheight.
The parameter HorizontalBitPitchHorizontalBitPitchHorizontalBitPitchHorizontalBitPitchhorizontalBitPitchhorizontal_bit_pitch is the horizontal distance
(in bits) between two neighboring pixels. BitsPerPixelBitsPerPixelBitsPerPixelBitsPerPixelbitsPerPixelbits_per_pixel is
the number of used bits per pixel.
If DoCopyDoCopyDoCopyDoCopydoCopydo_copy is set 'true'"true""true""true""true""true", the image data pointed to by
PixelPointerPixelPointerPixelPointerPixelPointerpixelPointerpixel_pointer 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
PixelPointerPixelPointerPixelPointerPixelPointerpixelPointerpixel_pointer
points to must be released when deleting the object ImageImageImageImageimageimage.
This is done by the procedure ClearProcClearProcClearProcClearProcclearProcclear_proc 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 PixelPointerPixelPointerPixelPointerPixelPointerpixelPointerpixel_pointer the
pointer has to be passed to the procedure depending on
the used operator signature and programming environment.
If DoCopyDoCopyDoCopyDoCopydoCopydo_copy is 'true'"true""true""true""true""true" then ClearProcClearProcClearProcClearProcclearProcclear_proc is irrelevant.
The operator gen_image1_rectgen_image1_rectGenImage1RectGenImage1RectGenImage1Rectgen_image1_rect is symmetrical to
get_image_pointer1_rectget_image_pointer1_rectGetImagePointer1RectGetImagePointer1RectGetImagePointer1Rectget_image_pointer1_rect。
注意
gen_image1_rectgen_image1_rectGenImage1RectGenImage1RectGenImage1Rectgen_image1_rect 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 (输出对象) image → objectHImageHObjectHImageHobject * (byte / uint2 / int4)
Created HALCON image.
PixelPointerPixelPointerPixelPointerPixelPointerpixelPointerpixel_pointer (输入控制) pointer → HTupleintHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)
Pointer to the first pixel.
WidthWidthWidthWidthwidthwidth (输入控制) extent.x → HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Width of the 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 the image.
默认值:
512
建议值:
128, 256, 512, 1024
值范围:
1
≤
Height
Height
Height
Height
height
height
(lin)
最小增量:
1
建议增量:
10
VerticalPitchVerticalPitchVerticalPitchVerticalPitchverticalPitchvertical_pitch (输入控制) integer → HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Distance (in bytes) between pixel m in row n
and pixel m in row n+1 of the 'input image'.
限制:
VerticalPitch >= Width * HorizontalBitPitch / 8
HorizontalBitPitchHorizontalBitPitchHorizontalBitPitchHorizontalBitPitchhorizontalBitPitchhorizontal_bit_pitch (输入控制) integer → HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Distance between two neighboring pixels in bits .
默认值:
8
值列表:
8, 16, 32
BitsPerPixelBitsPerPixelBitsPerPixelBitsPerPixelbitsPerPixelbits_per_pixel (输入控制) integer → HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Number of used bits per pixel.
默认值:
8
值列表:
8, 9, 10, 11, 12, 13, 14, 15, 16, 32
限制:
BitsPerPixel <= HorizontalBitPitch
DoCopyDoCopyDoCopyDoCopydoCopydo_copy (输入控制) string → HTuplestrHTupleHtuple (string) (string) (HString) (char*)
Copy image data.
默认值:
'false'
"false"
"false"
"false"
"false"
"false"
建议值:
'true'"true""true""true""true""true", 'false'"false""false""false""false""false"
ClearProcClearProcClearProcClearProcclearProcclear_proc (输入控制) pointer → HTupleintHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)
Pointer to the procedure releasing the memory
of the image when deleting the object.
默认值:
0
示例(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);
}
结果
算子 gen_image1_rectgen_image1_rectGenImage1RectGenImage1RectGenImage1Rectgen_image1_rect 在参数值正确时返回值 2 ( H_MSG_TRUE )。否则将抛出异常。
可能的后继
get_image_pointer1_rectget_image_pointer1_rectGetImagePointer1RectGetImagePointer1RectGetImagePointer1Rectget_image_pointer1_rect
替代
gen_image1gen_image1GenImage1GenImage1GenImage1gen_image1,
gen_image1_externgen_image1_externGenImage1ExternGenImage1ExternGenImage1Externgen_image1_extern,
gen_image_constgen_image_constGenImageConstGenImageConstGenImageConstgen_image_const
另见
get_image_pointer1_rectget_image_pointer1_rectGetImagePointer1RectGetImagePointer1RectGetImagePointer1Rectget_image_pointer1_rect
模块
基础