gen_image_constgen_image_constGenImageConstGenImageConstgen_image_const (算子)
名称
gen_image_constgen_image_constGenImageConstGenImageConstgen_image_const — 创建具有恒定灰度值的图像。
签名
void GenImageConst(HObject* Image, const HTuple& Type, const HTuple& Width, const HTuple& Height)
void HImage::HImage(const HString& Type, Hlong Width, Hlong Height)
void HImage::HImage(const char* Type, Hlong Width, Hlong Height)
void HImage::HImage(const wchar_t* Type, Hlong Width, Hlong Height)
(
Windows only)
void HImage::GenImageConst(const HString& Type, Hlong Width, Hlong Height)
void HImage::GenImageConst(const char* Type, Hlong Width, Hlong Height)
void HImage::GenImageConst(const wchar_t* Type, Hlong Width, Hlong Height)
(
Windows only)
描述
算子 gen_image_constgen_image_constGenImageConstGenImageConstGenImageConstgen_image_const creates an image of the indicated
size. The width and height of the image are determined by
WidthWidthWidthWidthwidthwidth and HeightHeightHeightHeightheightheight. HALCON supports the following
image types:
- 'byte'"byte""byte""byte""byte""byte"
-
1 byte per pixel, unsigned
Value range: (0..255)
- 'int1'"int1""int1""int1""int1""int1"
-
1 byte per pixel, signed
Value range: (-128..127)
- 'uint2'"uint2""uint2""uint2""uint2""uint2"
-
2 bytes per pixel, unsigned
Value range: (0..65535)
- 'int2'"int2""int2""int2""int2""int2"
-
2 bytes per pixel, signed
Value range: (-32768..32767)
- 'int4'"int4""int4""int4""int4""int4"
-
4 bytes per pixel, signed
Value range: (-2147483648..2147483647)
- 'int8'"int8""int8""int8""int8""int8"
-
8 bytes per pixel, signed
(only available on 64 bit systems)
Value range: (-9223372036854775808..9223372036854775807)
- 'real'"real""real""real""real""real"
-
4 bytes per pixel, floating point
Value range: (-3.4e38..3.4e38)
Precision: 6 significant decimal digits
- 'complex'"complex""complex""complex""complex""complex"
Two matrices of type 'real'"real""real""real""real""real"
- 'vector_field_relative'"vector_field_relative""vector_field_relative""vector_field_relative""vector_field_relative""vector_field_relative"
-
Two matrices of type 'real'"real""real""real""real""real"
Interpretation: Vectors
- 'vector_field_absolute'"vector_field_absolute""vector_field_absolute""vector_field_absolute""vector_field_absolute""vector_field_absolute"
-
Two matrices of type 'real'"real""real""real""real""real"
Interpretation: Absolute coordinates
- 'direction'"direction""direction""direction""direction""direction"
-
1 byte per pixel, unsigned
Value range: (0..179)
Interpretation: Angle divided by two
Attention: The values 180..254 are automatically set to the value
255, which is interpreted as undefined angle.
- 'cyclic'"cyclic""cyclic""cyclic""cyclic""cyclic"
-
1 byte per pixel, unsigned, cyclic arithmetics
Value range: (0..255)
With the operator
set_system('init_new_image',<'true'/'false'>)set_system("init_new_image",<"true"/"false">)SetSystem("init_new_image",<"true"/"false">)SetSystem("init_new_image",<"true"/"false">)SetSystem("init_new_image",<"true"/"false">)set_system("init_new_image",<"true"/"false">), it can be
controlled whether the created image is initialized with 0 or not.
执行信息
- 多线程类型:可重入(与非独占算子并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
参数
ImageImageImageImageimageimage (输出对象) image → objectHImageHObjectHImageHobject * (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex / vector_field)
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", 'complex'"complex""complex""complex""complex""complex", '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", 'int8'"int8""int8""int8""int8""int8", 'real'"real""real""real""real""real", 'uint2'"uint2""uint2""uint2""uint2""uint2", 'vector_field_absolute'"vector_field_absolute""vector_field_absolute""vector_field_absolute""vector_field_absolute""vector_field_absolute", 'vector_field_relative'"vector_field_relative""vector_field_relative""vector_field_relative""vector_field_relative""vector_field_relative"
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
示例(C)
gen_image_const(&New,"byte",width,height);
get_image_pointer1(New,(Hlong*)&pointer,type,&width,&height);
for (row=0; row<height-1; row++)
{
for (col=0; col<width-1; col++)
{
pointer[row*width+col] = (row + col) % 256;
}
}
结果
如果参数值正确,算子 gen_image_constgen_image_constGenImageConstGenImageConstGenImageConstgen_image_const 返回值 2 ( H_MSG_TRUE )。否则将抛出异常。
可能的后继
paint_regionpaint_regionPaintRegionPaintRegionPaintRegionpaint_region,
reduce_domainreduce_domainReduceDomainReduceDomainReduceDomainreduce_domain,
get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1GetImagePointer1get_image_pointer1,
copy_objcopy_objCopyObjCopyObjCopyObjcopy_obj
替代
gen_image1gen_image1GenImage1GenImage1GenImage1gen_image1,
gen_image3gen_image3GenImage3GenImage3GenImage3gen_image3
另见
reduce_domainreduce_domainReduceDomainReduceDomainReduceDomainreduce_domain,
paint_graypaint_grayPaintGrayPaintGrayPaintGraypaint_gray,
paint_regionpaint_regionPaintRegionPaintRegionPaintRegionpaint_region,
set_grayvalset_grayvalSetGrayvalSetGrayvalSetGrayvalset_grayval,
get_image_pointer1get_image_pointer1GetImagePointer1GetImagePointer1GetImagePointer1get_image_pointer1
模块
基础