read_sequenceread_sequenceReadSequenceReadSequenceread_sequence (算子)

名称

read_sequenceread_sequenceReadSequenceReadSequenceread_sequence — 读取图像。

签名

read_sequence( : Image : HeaderSize, SourceWidth, SourceHeight, StartRow, StartColumn, DestWidth, DestHeight, PixelType, BitOrder, ByteOrder, Pad, Index, FileName : )

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 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)

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)

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)

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)

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

描述

算子 read_sequenceread_sequenceReadSequenceReadSequenceReadSequenceread_sequence 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 HeaderSizeHeaderSizeHeaderSizeHeaderSizeheaderSizeheader_size bytes) are skipped. The parameters SourceWidthSourceWidthSourceWidthSourceWidthsourceWidthsource_width and SourceHeightSourceHeightSourceHeightSourceHeightsourceHeightsource_height indicate the size of the filled image. DestWidthDestWidthDestWidthDestWidthdestWidthdest_width and DestHeightDestHeightDestHeightDestHeightdestHeightdest_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 StartRowStartRowStartRowStartRowstartRowstart_row and StartColumnStartColumnStartColumnStartColumnstartColumnstart_column

The pixel types 'bit'"bit""bit""bit""bit""bit", 'byte'"byte""byte""byte""byte""byte", 'short'"short""short""short""short""short" (16 bits, unsigned), 'signed_short'"signed_short""signed_short""signed_short""signed_short""signed_short" (16 bits, signed), 'long'"long""long""long""long""long" (32 bits, signed), 'swapped_long'"swapped_long""swapped_long""swapped_long""swapped_long""swapped_long" (32 bits, with swapped segments), and 'real'"real""real""real""real""real" (32 bit floating point numbers) are supported. Furthermore, the operator read_sequenceread_sequenceReadSequenceReadSequenceReadSequenceread_sequence 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""r_byte""r_byte""r_byte""r_byte" must be chosen, and correspondingly for the green and blue components 'g_byte'"g_byte""g_byte""g_byte""g_byte""g_byte" or 'b_byte'"b_byte""b_byte""b_byte""b_byte""b_byte", respectively.

'MSBFirst'"MSBFirst""MSBFirst""MSBFirst""MSBFirst""MSBFirst" (most significant bit first) or the inversion thereof ('LSBFirst'"LSBFirst""LSBFirst""LSBFirst""LSBFirst""LSBFirst") can be chosen for the bit order (BitOrderBitOrderBitOrderBitOrderbitOrderbit_order). The byte orders (ByteOrderByteOrderByteOrderByteOrderbyteOrderbyte_order) 'MSBFirst'"MSBFirst""MSBFirst""MSBFirst""MSBFirst""MSBFirst" (most significant byte first) or 'LSBFirst'"LSBFirst""LSBFirst""LSBFirst""LSBFirst""LSBFirst", respectively, are processed analogously. Finally an alignment (PadPadPadPadpadpad) can be set at the end of the line: 'byte'"byte""byte""byte""byte""byte", 'short'"short""short""short""short""short" or 'long'"long""long""long""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 IndexIndexIndexIndexindexindex

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_systemset_systemSetSystemSetSystemSetSystemset_system。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""image_dir""image_dir""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.

注意

If files of pixel type 'real'"real""real""real""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.

执行信息

参数

ImageImageImageImageimageimage (输出对象)  image objectHImageHObjectHImageHobject * (byte / int2 / uint2 / int4)

Image read.

HeaderSizeHeaderSizeHeaderSizeHeaderSizeheaderSizeheader_size (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of bytes for file header.

默认值: 0

值范围: 0 ≤ HeaderSize HeaderSize HeaderSize HeaderSize headerSize header_size

SourceWidthSourceWidthSourceWidthSourceWidthsourceWidthsource_width (输入控制)  extent.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of image columns of the filed image.

默认值: 512

值范围: 1 ≤ SourceWidth SourceWidth SourceWidth SourceWidth sourceWidth source_width

SourceHeightSourceHeightSourceHeightSourceHeightsourceHeightsource_height (输入控制)  extent.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of image lines of the filed image.

默认值: 512

值范围: 1 ≤ SourceHeight SourceHeight SourceHeight SourceHeight sourceHeight source_height

StartRowStartRowStartRowStartRowstartRowstart_row (输入控制)  point.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Starting point of image area (line).

默认值: 0

值范围: 0 ≤ StartRow StartRow StartRow StartRow startRow start_row

限制: StartRow < SourceHeight

StartColumnStartColumnStartColumnStartColumnstartColumnstart_column (输入控制)  point.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Starting point of image area (column).

默认值: 0

值范围: 0 ≤ StartColumn StartColumn StartColumn StartColumn startColumn start_column

限制: StartColumn < SourceWidth

DestWidthDestWidthDestWidthDestWidthdestWidthdest_width (输入控制)  extent.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of image columns of output image.

默认值: 512

值范围: 1 ≤ DestWidth DestWidth DestWidth DestWidth destWidth dest_width

限制: DestWidth <= SourceWidth

DestHeightDestHeightDestHeightDestHeightdestHeightdest_height (输入控制)  extent.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of image lines of output image.

默认值: 512

值范围: 1 ≤ DestHeight DestHeight DestHeight DestHeight destHeight dest_height

限制: DestHeight <= SourceHeight

PixelTypePixelTypePixelTypePixelTypepixelTypepixel_type (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Type of pixel values.

默认值: 'byte' "byte" "byte" "byte" "byte" "byte"

值列表: 'b_byte'"b_byte""b_byte""b_byte""b_byte""b_byte", 'bit'"bit""bit""bit""bit""bit", 'byte'"byte""byte""byte""byte""byte", 'g_byte'"g_byte""g_byte""g_byte""g_byte""g_byte", 'long'"long""long""long""long""long", 'r_byte'"r_byte""r_byte""r_byte""r_byte""r_byte", 'real'"real""real""real""real""real", 'short'"short""short""short""short""short", 'signed_short'"signed_short""signed_short""signed_short""signed_short""signed_short", 'swapped_long'"swapped_long""swapped_long""swapped_long""swapped_long""swapped_long"

BitOrderBitOrderBitOrderBitOrderbitOrderbit_order (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Sequence of bits within one byte.

默认值: 'MSBFirst' "MSBFirst" "MSBFirst" "MSBFirst" "MSBFirst" "MSBFirst"

值列表: 'LSBFirst'"LSBFirst""LSBFirst""LSBFirst""LSBFirst""LSBFirst", 'MSBFirst'"MSBFirst""MSBFirst""MSBFirst""MSBFirst""MSBFirst"

ByteOrderByteOrderByteOrderByteOrderbyteOrderbyte_order (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Sequence of bytes within one 'short' unit.

默认值: 'MSBFirst' "MSBFirst" "MSBFirst" "MSBFirst" "MSBFirst" "MSBFirst"

值列表: 'LSBFirst'"LSBFirst""LSBFirst""LSBFirst""LSBFirst""LSBFirst", 'MSBFirst'"MSBFirst""MSBFirst""MSBFirst""MSBFirst""MSBFirst"

PadPadPadPadpadpad (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Data units within one image line (alignment).

默认值: 'byte' "byte" "byte" "byte" "byte" "byte"

值列表: 'byte'"byte""byte""byte""byte""byte", 'long'"long""long""long""long""long", 'short'"short""short""short""short""short"

IndexIndexIndexIndexindexindex (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of images in the file.

默认值: 1

值范围: 1 ≤ Index Index Index Index index index (lin)

FileNameFileNameFileNameFileNamefileNamefile_name (输入控制)  filename.read HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Name of input file.

结果

如果参数值正确,算子 read_sequenceread_sequenceReadSequenceReadSequenceReadSequenceread_sequence 返回值 2 ( H_MSG_TRUE )。否则将抛出异常。

可能的后继

disp_imagedisp_imageDispImageDispImageDispImagedisp_image, count_channelscount_channelsCountChannelsCountChannelsCountChannelscount_channels, decompose3decompose3Decompose3Decompose3Decompose3decompose3, write_imagewrite_imageWriteImageWriteImageWriteImagewrite_image, rgb1_to_grayrgb1_to_grayRgb1ToGrayRgb1ToGrayRgb1ToGrayrgb1_to_gray

替代

read_imageread_imageReadImageReadImageReadImageread_image

另见

read_imageread_imageReadImageReadImageReadImageread_image

模块

基础