Skip to content

write_regionWriteRegionWriteRegionwrite_regionwrite_region🔗

Short description🔗

write_regionWriteRegionWriteRegionwrite_regionwrite_region — Write regions to a file.

Signature🔗

write_region( region Region, filename.write FileName )void WriteRegion( const HObject& Region, const HTuple& FileName )static void HOperatorSet.WriteRegion( HObject region, HTuple fileName )def write_region( region: HObject, file_name: str ) -> None

Herror write_region( const Hobject Region, const char* FileName )

Herror T_write_region( const Hobject Region, const Htuple FileName )

void HRegion::WriteRegion( const HString& FileName ) const

void HRegion::WriteRegion( const char* FileName ) const

void HRegion::WriteRegion( const wchar_t* FileName ) const (Windows only)

void HRegion.WriteRegion( string fileName )

Description🔗

The operator write_regionWriteRegion writes the regions in Regionregionregion into a binary file. The regions can be written in the HALCON Iconic Object format (HOBJ), as TIFF files or as HALCON region files. The format is selected via the file name extension of FileNamefileNamefile_name. If no extension is specified or if the file extension is '.hobj', the regions are stored in the HOBJ format. If no extension is specified in FileNamefileNamefile_name, the extension '.hobj' will be appended. See write_objectWriteObject for more information about the HOBJ format. If the extension '.tif' or '.tiff' is specified, the regions are stored as TIFF files. If the extension '.reg' is specified, the regions are stored as a HALCON region file. The HALCON region file format is now legacy and the file format HOBJ should be used instead unless the files must be readable with HALCON versions older than 12.0. Iconic object tuples with an arbitrary number of regions can be written. The output data can be read via the operator read_regionReadRegion.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

Regionregionregion (input_object) region(-array) → objectHObjectHRegionHObjectHobject

Region of the images which are returned.

FileNamefileNamefile_name (input_control) filename.write → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Name of region file.

Default: 'region.hobj'"region.hobj"
File extension: .hobj, .reg, .tif, .tiff

Example🔗

(HDevelop)

regiongrowing(Img,Segments,3,3,5,10)
write_region(Segments,'result1')
(C)
regiongrowing(Img,&Segments,3,3,5,10)\;
write_region(Segments,"result1")\;

Result🔗

If the parameter values are correct the operator write_regionWriteRegion returns the value 2 (H_MSG_TRUE). Otherwise an exception handling is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

read_imageReadImage, read_regionReadRegion, read_objectReadObject, thresholdThreshold, regiongrowingRegiongrowing

See also

read_regionReadRegion

Module🔗

Foundation