image_to_memory_block — 以各种图形格式将图像写入存储块。
image_to_memory_block(Image : : Format, FillColor : MemoryBlockHandle)
算子 image_to_memory_block saves the input image
Image to the memory block MemoryBlockHandle in the format
Format. If the domain (region) cannot be saved in the specified
Format (this is the case for 'jpeg'), all pixels outside the region
receive the color defined by FillColor. For gray value images a value
between 0 (black) and 255 (white) must be passed. For RGB
color images the RGB values can be passed directly as a hexadecimal value:
e.g., 0xffff00 for a yellow background (red=255, green=255, blue=0).
The following formats can be set in Format:
This format can only store images with one channel (gray value image) or three channels (RGB image).
Only images with the pixel type byte are supported for this file format.
Together with the format string the quality value determining the compression rate can be provided. Large values (maximum 100) create a large memory block with high image quality. Small values significantly decrease the image quality and the size of the memory block.
Possible values: 'jpeg', 'jpeg 30', 'jpeg 60'.
Attention: Images stored for being processed later should not be stored in this format due to the loss of information during compression.
This format can only store images with one channel (gray value image) or three channels (RGB image). The maximal supported image size (width x height) for PNG is , also in HALCON XL.
Images of type byte and uint2 can be stored in PNG format.
Together with the format string, a compression level between 0 and 9 can be specified, where 0 corresponds to no compression and 9 to the best possible compression. Alternatively, the compression can be selected by using string constants.
Possible values: 'png', 'png 7', 'png none', 'png best', 'png fastest'.
If an image with a reduced domain is written, the region is stored as the alpha channel, where the points within the domain are stored as the maximum gray value of the image type and the points outside the domain are stored as the gray value 0. If an image with a full domain is written, no alpha channel is stored.
此算子返回一个句柄。请注意,即使该句柄被用作特定算子的输入参数,这些算子仍可能改变此句柄类型的实例状态。
Image (输入对象) (multichannel-)image → object (byte / direction / cyclic / int1 / complex / int2 / uint2 / vector_field / int4 / int8 / real)
输入图像。
Format (输入控制) string → (string)
Graphic format.
默认值: 'jpeg'
建议值: 'jpeg', 'png'
FillColor (输入控制) number → (integer / real)
Gray value for pixels not belonging to the image domain (region).
默认值: 0
建议值: -1, 0, 255, 65280, 16711680
MemoryBlockHandle (输出控制) memory_block → (handle)
Memory block handle.
如果参数值正确,算子 image_to_memory_block 返回值 2 ( H_MSG_TRUE )。否则将抛出异常。
write_memory_block,
serialize_tuple
基础