read_regionread_regionReadRegionReadRegionread_region (算子)
名称
read_regionread_regionReadRegionReadRegionread_region — 读取二进制图像或 HALCON 区域。
签名
描述
算子 read_regionread_regionReadRegionReadRegionReadRegionread_region reads regions from a binary file.
The following formats are currently supported:
- HALCON Iconic Object (HOBJ):
-
File format for iconic HALCON objects. The HOBJ file must contain
only regions to be readable by read_regionread_regionReadRegionReadRegionReadRegionread_region. If other
objects (e.g., images or XLDs) are stored in the file,
an exception is raised. In this case read_objectread_objectReadObjectReadObjectReadObjectread_object can
be used to read the corresponding HOBJ file.
The HOBJ format is the default file format for regions.
Therefore, the extension '.hobj'".hobj"".hobj"".hobj"".hobj"".hobj" does not have to
be specified when reading or writing the file. See
write_objectwrite_objectWriteObjectWriteObjectWriteObjectwrite_object for more information about the HOBJ format.
- HALCON regions:
-
File format for HALCON regions.
This file format supports multiple regions in a single file.
The file extension is '.reg'".reg"".reg"".reg"".reg"".reg". This format is now legacy and the
HOBJ format should be used instead.
- Tiff:
-
Binary Tiff images with extension 'tiff'"tiff""tiff""tiff""tiff""tiff" or
'tif'"tif""tif""tif""tif""tif". A tiff image can contain any number of regions.
The color white is used as foreground.
- PNG:
-
Binary PNG images with extension 'png'"png""png""png""png""png". The result is
always one region. The color white is used as foreground.
- BMP:
-
Binary Windows bitmap images with extension 'bmp'"bmp""bmp""bmp""bmp""bmp".
The result is always one region. The color white is used as
foreground.
A search path ('image_dir'"image_dir""image_dir""image_dir""image_dir""image_dir") can be defined analogous
to the operator read_imageread_imageReadImageReadImageReadImageread_image。
注意
The clipping based on the current image format is set via the
operator set_system('clip_region',<'true'/'false'>)set_system("clip_region",<"true"/"false">)SetSystem("clip_region",<"true"/"false">)SetSystem("clip_region",<"true"/"false">)SetSystem("clip_region",<"true"/"false">)set_system("clip_region",<"true"/"false">)。Consequently, if no image of sufficient size has been created before
the call to read_regionread_regionReadRegionReadRegionReadRegionread_region,
set_system('clip_region','false')set_system("clip_region","false")SetSystem("clip_region","false")SetSystem("clip_region","false")SetSystem("clip_region","false")set_system("clip_region","false") should be called before
calling read_regionread_regionReadRegionReadRegionReadRegionread_region to ensure that the region is not being
clipped.
执行信息
- 多线程类型:可重入(与非独占算子并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
参数
RegionRegionRegionRegionregionregion (输出对象) region(-array) → objectHRegionHObjectHRegionHobject *
Read region.
FileNameFileNameFileNameFileNamefileNamefile_name (输入控制) filename.read → HTuplestrHTupleHtuple (string) (string) (HString) (char*)
Name of the region to be read.
File extension:
.hobj, .reg, .tif, .tiff, .png, .bmp
示例(HDevelop)
* Reading of regions and giving them gray values.
read_image(Img,'ima_test')
read_region(Regs,'reg_test')
reduce_domain(Img,Regs,Res)
示例(C)
/* Reading of regions and giving them gray values. */
read_image(&Img,"ima_test");
read_region(&Regs,"reg_test");
reduce_domain(Img,Regs,&Res);
示例(HDevelop)
* Reading of regions and giving them gray values.
read_image(Img,'ima_test')
read_region(Regs,'reg_test')
reduce_domain(Img,Regs,Res)
示例(HDevelop)
* Reading of regions and giving them gray values.
read_image(Img,'ima_test')
read_region(Regs,'reg_test')
reduce_domain(Img,Regs,Res)
示例(HDevelop)
* Reading of regions and giving them gray values.
read_image(Img,'ima_test')
read_region(Regs,'reg_test')
reduce_domain(Img,Regs,Res)
结果
如果参数值正确,算子 read_regionread_regionReadRegionReadRegionReadRegionread_region 返回值 2 ( H_MSG_TRUE )。否则将抛出异常。
可能的前趋
read_imageread_imageReadImageReadImageReadImageread_image
可能的后继
reduce_domainreduce_domainReduceDomainReduceDomainReduceDomainreduce_domain,
disp_regiondisp_regionDispRegionDispRegionDispRegiondisp_region
另见
write_regionwrite_regionWriteRegionWriteRegionWriteRegionwrite_region,
read_imageread_imageReadImageReadImageReadImageread_image,
write_objectwrite_objectWriteObjectWriteObjectWriteObjectwrite_object
模块
基础