read_sequenceread_sequenceReadSequenceReadSequence (Operator)

Name

read_sequenceread_sequenceReadSequenceReadSequence — Einlesen von Bildern.

Signatur

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)   (Nur Windows)

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)

Beschreibung

read_sequenceread_sequenceReadSequenceReadSequenceReadSequence liest Bilddaten, die unformatiert vorliegen, aus einer Datei und liefert ein „passendes“ Bild zurück. Die Bilddaten müssen dabei Pixel für Pixel zeilenweise hintereinander abgespeichert sein.

Ein etwaiger Datei-Header (mit Länge HeaderSizeHeaderSizeHeaderSizeHeaderSizeheaderSize Bytes) wird übersprungen. Die Parameter SourceWidthSourceWidthSourceWidthSourceWidthsourceWidth und SourceHeightSourceHeightSourceHeightSourceHeightsourceHeight geben die Größe des Bildes auf Datei an. DestWidthDestWidthDestWidthDestWidthdestWidth und DestHeightDestHeightDestHeightDestHeightdestHeight geben an, wie groß das eingelesene Bild sein soll. Im einfachsten Fall stimmen diese Parameter überein. Es können aber auch Auschnitte eingelesen werden. Dazu kann mittels StartRowStartRowStartRowStartRowstartRow und StartColumnStartColumnStartColumnStartColumnstartColumn die obere linke Ecke des gewünschten Bildausschnitts festgelegt werden.

An Pixeltypen werden 'bit'"bit""bit""bit""bit", 'byte'"byte""byte""byte""byte", 'short'"short""short""short""short" (16 Bit, ohne Vorzeichen), 'signed_short'"signed_short""signed_short""signed_short""signed_short" (16 Bit, mit Vorzeichen), 'long'"long""long""long""long" (32 Bit, mit Vorzeichen), 'swapped_long'"swapped_long""swapped_long""swapped_long""swapped_long" (32 Bit, mit vertauschten Halbwörtern) und 'real'"real""real""real""real" (32 Bit Gleitkommazahlen) (unterstützt. Weiter erlaubt read_sequenceread_sequenceReadSequenceReadSequenceReadSequence die Extraktion von Komponenten eines RGB Bildes, sofern für jedes Pixel ein Tripel von drei Bytes (in der Reihenfolge „rot“, „grün“, „blau“) in der Bilddatei abgelegt wurde. Für die Rotkomponente ist dann als Pixeltyp 'r_byte'"r_byte""r_byte""r_byte""r_byte" und entsprechend für die Grün- und Blaukomponente 'g_byte'"g_byte""g_byte""g_byte""g_byte" bzw. 'b_byte'"b_byte""b_byte""b_byte""b_byte" zu wählen.

Für die Bitreihenfolge (BitOrderBitOrderBitOrderBitOrderbitOrder) kann 'MSBFirst'"MSBFirst""MSBFirst""MSBFirst""MSBFirst" (most significant bit first) bzw. die Umkehrung davon ('LSBFirst'"LSBFirst""LSBFirst""LSBFirst""LSBFirst") gewählt werden. Analog dazu werden auch die Bytereihenfolgen (ByteOrderByteOrderByteOrderByteOrderbyteOrder) 'MSBFirst'"MSBFirst""MSBFirst""MSBFirst""MSBFirst" (most significant byte first) bzw. 'LSBFirst'"LSBFirst""LSBFirst""LSBFirst""LSBFirst" verarbeitet. Schließlich lässt sich noch ein Alignement (PadPadPadPadpad) am Zeilenende einstellen: 'byte'"byte""byte""byte""byte", 'short'"short""short""short""short" oder 'long'"long""long""long""long". Falls in der Datei eine ganze Bildsequenz abgelegt ist, erlaubt der Parameter IndexIndexIndexIndexindex die Wahl eines Einzelbildes (beginnend mit Index 1).

Bilddateien werden im aktuellen Directory (vorgegeben durch die Betriebssystemumgebung) und im Bilderdirectory von HALCON gesucht. Das Bilderdirectory von HALCON ist in einer unixartigen Umgebung auf '.'".""."".""." und '/usr/local/halcon/images'"/usr/local/halcon/images""/usr/local/halcon/images""/usr/local/halcon/images""/usr/local/halcon/images" voreingestellt und kann mit dem Befehl set_systemset_systemSetSystemSetSystemSetSystem gesetzt werden. Es kann mehr als ein Bilderdirectory angegeben werden. Dies geschieht, indem man die einzelnen Directories durch einen Doppelpunkt trennt.

Weiterhin kann der Suchpfad mit der Environment-Variablen HALCONIMAGES gesetzt werden (gleicher Aufbau wie bei 'image_dir'"image_dir""image_dir""image_dir""image_dir"). Beispiel:

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

Ebenso sucht HALCON die Bilder in dem Unter-Directory '"`images"'""`images""""`images""""`images""""`images"" (Bilder für die Programmbeispiele). Für das HALCON-Directory wird die Environment-Variable HALCONROOT verwendet.

Achtung

Falls Dateien vom Pixeltyp 'real'"real""real""real""real" eingelesen werden und die Bytereihenfolge falsch (d.h. nicht wie die Daten in der Datei gespeichert sind) gewählt wird, kann es zu Programmfehlern oder sogar Abstürzen aufgrund von Gleitkomma-Ausnahmebehandlungen kommen.

Ausführungsinformationen

Parameter

ImageImageImageImageimage (output_object)  image objectHImageHImageHobject * (byte / int2 / uint2 / int4)

Eingelesenes Bild.

HeaderSizeHeaderSizeHeaderSizeHeaderSizeheaderSize (input_control)  integer HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Anzahl Bytes für Dateikopf.

Defaultwert: 0

Typischer Wertebereich: 0 ≤ HeaderSize HeaderSize HeaderSize HeaderSize headerSize

SourceWidthSourceWidthSourceWidthSourceWidthsourceWidth (input_control)  extent.x HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Anzahl Bildspalten des Bildes auf Datei.

Defaultwert: 512

Typischer Wertebereich: 1 ≤ SourceWidth SourceWidth SourceWidth SourceWidth sourceWidth

SourceHeightSourceHeightSourceHeightSourceHeightsourceHeight (input_control)  extent.y HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Anzahl Bildzeilen des Bildes auf Datei.

Defaultwert: 512

Typischer Wertebereich: 1 ≤ SourceHeight SourceHeight SourceHeight SourceHeight sourceHeight

StartRowStartRowStartRowStartRowstartRow (input_control)  point.y HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Startpunkt Bildausschnitt (Zeile).

Defaultwert: 0

Typischer Wertebereich: 0 ≤ StartRow StartRow StartRow StartRow startRow

Restriktion: StartRow < SourceHeight

StartColumnStartColumnStartColumnStartColumnstartColumn (input_control)  point.x HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Startpunkt Bildausschnitt (Spalte).

Defaultwert: 0

Typischer Wertebereich: 0 ≤ StartColumn StartColumn StartColumn StartColumn startColumn

Restriktion: StartColumn < SourceWidth

DestWidthDestWidthDestWidthDestWidthdestWidth (input_control)  extent.x HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Anzahl Bildspalten des erzeugten Bildes.

Defaultwert: 512

Typischer Wertebereich: 1 ≤ DestWidth DestWidth DestWidth DestWidth destWidth

Restriktion: DestWidth <= SourceWidth

DestHeightDestHeightDestHeightDestHeightdestHeight (input_control)  extent.y HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Anzahl Bildzeilen des erzeugten Bildes.

Defaultwert: 512

Typischer Wertebereich: 1 ≤ DestHeight DestHeight DestHeight DestHeight destHeight

Restriktion: DestHeight <= SourceHeight

PixelTypePixelTypePixelTypePixelTypepixelType (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Art der Pixelwerte.

Defaultwert: 'byte' "byte" "byte" "byte" "byte"

Werteliste: 'b_byte'"b_byte""b_byte""b_byte""b_byte", 'bit'"bit""bit""bit""bit", 'byte'"byte""byte""byte""byte", 'g_byte'"g_byte""g_byte""g_byte""g_byte", 'long'"long""long""long""long", 'r_byte'"r_byte""r_byte""r_byte""r_byte", 'real'"real""real""real""real", 'short'"short""short""short""short", 'signed_short'"signed_short""signed_short""signed_short""signed_short", 'swapped_long'"swapped_long""swapped_long""swapped_long""swapped_long"

BitOrderBitOrderBitOrderBitOrderbitOrder (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Reihenfolge der Bits innerhalb eines Bytes.

Defaultwert: 'MSBFirst' "MSBFirst" "MSBFirst" "MSBFirst" "MSBFirst"

Werteliste: 'LSBFirst'"LSBFirst""LSBFirst""LSBFirst""LSBFirst", 'MSBFirst'"MSBFirst""MSBFirst""MSBFirst""MSBFirst"

ByteOrderByteOrderByteOrderByteOrderbyteOrder (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Reihenfolge der Bytes innerhalb einer 'short'-Einheit.

Defaultwert: 'MSBFirst' "MSBFirst" "MSBFirst" "MSBFirst" "MSBFirst"

Werteliste: 'LSBFirst'"LSBFirst""LSBFirst""LSBFirst""LSBFirst", 'MSBFirst'"MSBFirst""MSBFirst""MSBFirst""MSBFirst"

PadPadPadPadpad (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Dateneinheiten innerhalb einer Bildzeile (Alignement).

Defaultwert: 'byte' "byte" "byte" "byte" "byte"

Werteliste: 'byte'"byte""byte""byte""byte", 'long'"long""long""long""long", 'short'"short""short""short""short"

IndexIndexIndexIndexindex (input_control)  integer HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Nummer des Bildes innerhalb der Datei.

Defaultwert: 1

Typischer Wertebereich: 1 ≤ Index Index Index Index index (lin)

FileNameFileNameFileNameFileNamefileName (input_control)  filename.read HTupleHTupleHtuple (string) (string) (HString) (char*)

Name der einzulesenden Datei.

Ergebnis

Sind die Parameterwerte korrekt, dann liefert read_sequenceread_sequenceReadSequenceReadSequenceReadSequence den Wert 2 (H_MSG_TRUE). Andernfalls wird eine Fehlerbehandlung durchgeführt.

Nachfolger

disp_imagedisp_imageDispImageDispImageDispImage, count_channelscount_channelsCountChannelsCountChannelsCountChannels, decompose3decompose3Decompose3Decompose3Decompose3, write_imagewrite_imageWriteImageWriteImageWriteImage, rgb1_to_grayrgb1_to_grayRgb1ToGrayRgb1ToGrayRgb1ToGray

Alternativen

read_imageread_imageReadImageReadImageReadImage

Siehe auch

read_imageread_imageReadImageReadImageReadImage

Modul

Foundation