Description
The operator read_region reads regions from a binary file.
The following formats are currently supported:
HALCON Iconic Object (HOBJ) (HALCON 12.0 or higher):
File format for iconic HALCON objects. The HOBJ file must contain only regions to be readable by read_region. If other objects (e.g. images or XLDs) are stored in the file, an exception is raised. In this case read_object can be used to read the corresponding HOBJ file. The HOBJ format is the default file format for regions. Therefore, the extension '.hobj' does not have to be specified when reading or writing the file. See write_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'. This format is now legacy and the HOBJ format should be used instead.
Tiff:
Binary Tiff images with extension 'tiff' or 'tif'. A tiff image can contain any number of regions. The color white is used as foreground.
PNG:
Binary PNG images with extension 'png'. The result is always one region. The color white is used as foreground.
BMP:
Binary Windows bitmap images with extension 'bmp'. The result is always one region. The color white is used as foreground.
A search path ('image_dir') can be defined analogous to the operator read_image.
read_region(RoiRegion,'car_roi.hobj')
reduce_domain(GrayImage, RoiRegion, ImageReduced)
binary_threshold(ImageReduced, BinRegion1, 'max_separability', 'light', UsedThreshold)
opening_circle(BinRegion1, RegionOpening, 1.5)
connection(RegionOpening, ConnectedRegions)
select_shape(ConnectedRegions, SelectedRegions, 'area', 'and', 100, 200)
opening_circle(SelectedRegions, RegionOpening1, 1)
sort_region(RegionOpening1, SortedRegions1, 'first_point', 'true', 'column')
paint_region(ImageReduced, ImageReduced, tempImage, 205, 'fill')
paint_region(SelectedRegions, tempImage, pureImage, 0, 'fill')
area_center(SortedRegions1, Area, Row, Column)
read_ocr_class_mlp('Industrial_0-9A-Z_NoRej.omc', OCRHandle)
do_ocr_multi_class_mlp(SortedRegions1, pureImage, OCRHandle, Class, Confidence)
dev_close_window()
dev_open_window(0, 0, Width, Height, 'black', WindowHandle)
dev_display(Cars)
count_obj(SortedRegions1, Number1)
for Index := 0 to Number1 - 1 by 1
disp_message(WindowHandle, Class[Index], 'window', Row[Index]+20, Column[Index]-10, 'green', 'false')
endfor