Skip to content

read_sequenceReadSequenceReadSequenceread_sequenceread_sequenceπŸ”—

Short descriptionπŸ”—

read_sequenceReadSequenceReadSequenceread_sequenceread_sequence β€” Read images.

SignatureπŸ”—

read_sequence( out image Image, integer HeaderSize, extent.x SourceWidth, extent.y SourceHeight, point.y StartRow, point.x StartColumn, extent.x DestWidth, extent.y DestHeight, string PixelType, string BitOrder, string ByteOrder, string Pad, integer Index, filename.read FileName )void ReadSequence( HObject* Image, const HTuple& HeaderSize, const HTuple& SourceWidth, const HTuple& SourceHeight, const HTuple& StartRow, const HTuple& StartColumn, const HTuple& DestWidth, const HTuple& DestHeight, const HTuple& PixelType, const HTuple& BitOrder, const HTuple& ByteOrder, const HTuple& Pad, const HTuple& Index, const HTuple& FileName )static void HOperatorSet.ReadSequence( out HObject image, HTuple headerSize, HTuple sourceWidth, HTuple sourceHeight, HTuple startRow, HTuple startColumn, HTuple destWidth, HTuple destHeight, HTuple pixelType, HTuple bitOrder, HTuple byteOrder, HTuple pad, HTuple index, HTuple fileName )def read_sequence( header_size: int, source_width: int, source_height: int, start_row: int, start_column: int, dest_width: int, dest_height: int, pixel_type: str, bit_order: str, byte_order: str, pad: str, index: int, file_name: str ) -> HObject

Herror read_sequence( Hobject* Image, const Hlong HeaderSize, const Hlong SourceWidth, const Hlong SourceHeight, const Hlong StartRow, const Hlong StartColumn, const Hlong DestWidth, const Hlong DestHeight, const char* PixelType, const char* BitOrder, const char* ByteOrder, const char* Pad, const Hlong Index, const char* FileName )

Herror T_read_sequence( Hobject* Image, const Htuple HeaderSize, const Htuple SourceWidth, const Htuple SourceHeight, const Htuple StartRow, const Htuple StartColumn, const Htuple DestWidth, const Htuple DestHeight, const Htuple PixelType, const Htuple BitOrder, const Htuple ByteOrder, const Htuple Pad, const Htuple Index, const Htuple FileName )

void HImage::ReadSequence( Hlong HeaderSize, Hlong SourceWidth, Hlong SourceHeight, Hlong StartRow, Hlong StartColumn, Hlong DestWidth, Hlong DestHeight, const HString& PixelType, const HString& BitOrder, const HString& ByteOrder, const HString& Pad, Hlong Index, const HString& FileName )

void HImage::ReadSequence( Hlong HeaderSize, Hlong SourceWidth, Hlong SourceHeight, Hlong StartRow, Hlong StartColumn, Hlong DestWidth, Hlong DestHeight, const char* PixelType, const char* BitOrder, const char* ByteOrder, const char* Pad, Hlong Index, const char* FileName )

void HImage::ReadSequence( Hlong HeaderSize, Hlong SourceWidth, Hlong SourceHeight, Hlong StartRow, Hlong StartColumn, Hlong DestWidth, Hlong DestHeight, const wchar_t* PixelType, const wchar_t* BitOrder, const wchar_t* ByteOrder, const wchar_t* Pad, Hlong Index, const wchar_t* FileName ) (Windows only)

void HImage.ReadSequence( int headerSize, int sourceWidth, int sourceHeight, int startRow, int startColumn, int destWidth, int destHeight, string pixelType, string bitOrder, string byteOrder, string pad, int index, string fileName )

DescriptionπŸ”—

The operator read_sequenceReadSequence reads unformatted image data, from a file and returns a β€œsuitable” image. The image data must be filled consecutively pixel by pixel and line by line.

Any file headers (with the length HeaderSizeheaderSizeheader_size bytes) are skipped. The parameters SourceWidthsourceWidthsource_width and SourceHeightsourceHeightsource_height indicate the size of the filled image. DestWidthdestWidthdest_width and DestHeightdestHeightdest_height indicate the size of the image. In the simplest case these parameters are the same. However, areas can also be read. The upper left corner of the required image area can be determined via StartRowstartRowstart_row and StartColumnstartColumnstart_column.

The pixel types 'bit'"bit", 'byte'"byte", 'short'"short" (16 bits, unsigned), 'signed_short'"signed_short" (16 bits, signed), 'long'"long" (32 bits, signed), 'swapped_long'"swapped_long" (32 bits, with swapped segments), and 'real'"real" (32 bit floating point numbers) are supported. Furthermore, the operator read_sequenceReadSequence enables the extraction of components of a RBG image, if a triple of three bytes (in the sequence β€œred”, β€œgreen”, β€œblue”) was filed in the image file. For the red component the pixel type 'r_byte'"r_byte" must be chosen, and correspondingly for the green and blue components 'g_byte'"g_byte" or 'b_byte'"b_byte", respectively.

'MSBFirst'"MSBFirst" (most significant bit first) or the inversion thereof ('LSBFirst'"LSBFirst") can be chosen for the bit order (BitOrderbitOrderbit_order). The byte orders (ByteOrderbyteOrderbyte_order) 'MSBFirst'"MSBFirst" (most significant byte first) or 'LSBFirst'"LSBFirst", respectively, are processed analogously. Finally an alignment (Padpadpad) can be set at the end of the line: 'byte'"byte", 'short'"short" or 'long'"long". If a whole image sequence is stored in the file a single image (beginning at Index 1) can be chosen via the parameter Indexindexindex.

Image files are searched in the current directory (determined by the environment variable) and in the image directory of HALCON. The image directory of HALCON is preset at '.' and '/usr/local/halcon/images' in a Unix-like environment and can be set via the operator set_systemSetSystem. More than one image directory can be indicated. This is done by separating the individual directories by a colon.

Furthermore the search path can be set via the environment variable HALCONIMAGES (same structure as 'image_dir'"image_dir"). Example:

     setenv HALCONIMAGES "/usr/images:/usr/local/halcon/images"
*

HALCON also searches images in the subdirectory 'images' (Images for the program examples). The environment variable HALCONROOT is used for the HALCON directory.

AttentionπŸ”—

If files of pixel type 'real'"real" are read and the byte order is chosen incorrectly (i.e., differently from the byte order in which the data is stored in the file) program error and even crashes because of floating point exceptions may result.

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πŸ”—

Imageimageimage (output_object) image β†’ object (byte / int2 / uint2 / int4)HObject (byte / int2 / uint2 / int4)HImage (byte / int2 / uint2 / int4)HObject (byte / int2 / uint2 / int4)Hobject * (byte / int2 / uint2 / int4)

Image read.

HeaderSizeheaderSizeheader_size (input_control) integer β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Number of bytes for file header.

Default: 00
Value range: 0 ≀ HeaderSize

SourceWidthsourceWidthsource_width (input_control) extent.x β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Number of image columns of the filed image.

Default: 512512
Value range: 1 ≀ SourceWidth

SourceHeightsourceHeightsource_height (input_control) extent.y β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Number of image lines of the filed image.

Default: 512512
Value range: 1 ≀ SourceHeight

StartRowstartRowstart_row (input_control) point.y β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Starting point of image area (line).

Default: 00
Value range: 0 ≀ StartRow
Restriction: StartRow < SourceHeight

StartColumnstartColumnstart_column (input_control) point.x β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Starting point of image area (column).

Default: 00
Value range: 0 ≀ StartColumn
Restriction: StartColumn < SourceWidth

DestWidthdestWidthdest_width (input_control) extent.x β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Number of image columns of output image.

Default: 512512
Value range: 1 ≀ DestWidth
Restriction: DestWidth <= SourceWidth

DestHeightdestHeightdest_height (input_control) extent.y β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Number of image lines of output image.

Default: 512512
Value range: 1 ≀ DestHeight
Restriction: DestHeight <= SourceHeight

PixelTypepixelTypepixel_type (input_control) string β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Type of pixel values.

Default: 'byte'"byte"
List of values: 'b_byte', 'bit', 'byte', 'g_byte', 'long', 'r_byte', 'real', 'short', 'signed_short', 'swapped_long'"b_byte", "bit", "byte", "g_byte", "long", "r_byte", "real", "short", "signed_short", "swapped_long"

BitOrderbitOrderbit_order (input_control) string β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Sequence of bits within one byte.

Default: 'MSBFirst'"MSBFirst"
List of values: 'LSBFirst', 'MSBFirst'"LSBFirst", "MSBFirst"

ByteOrderbyteOrderbyte_order (input_control) string β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Sequence of bytes within one β€˜short’ unit.

Default: 'MSBFirst'"MSBFirst"
List of values: 'LSBFirst', 'MSBFirst'"LSBFirst", "MSBFirst"

Padpadpad (input_control) string β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Data units within one image line (alignment).

Default: 'byte'"byte"
List of values: 'byte', 'long', 'short'"byte", "long", "short"

Indexindexindex (input_control) integer β†’ (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Number of images in the file.

Default: 11
Value range: 1 ≀ Index (lin)

FileNamefileNamefile_name (input_control) filename.read β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Name of input file.

ResultπŸ”—

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

Combinations with other operatorsπŸ”—

Combinations

Possible successors

disp_imageDispImage, count_channelsCountChannels, decompose3Decompose3, write_imageWriteImage, rgb1_to_grayRgb1ToGray

Alternatives

read_imageReadImage

See also

read_imageReadImage

ModuleπŸ”—

Foundation