01.11.2014 Views

Reference Manual HALCON/C

Reference Manual HALCON/C

Reference Manual HALCON/C

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

12 CHAPTER 2. FILE<br />

Example<br />

/* Reading an image: */<br />

read_image(&Image,"mreut") ;<br />

/* Reading 3 images into an image object: */<br />

Htuple Files ;<br />

create_tuple(&Files,3) ;<br />

set_s(Files,"house_red",0) ;<br />

set_s(Files,"house_green",1) ;<br />

set_s(Files,"house_blue",2) ;<br />

T_read_image(&Bildobjekt,Files) ;<br />

/* Setting of search path for images on ’/mnt/images’ and ’/home/images’:<br />

*/<br />

set_system("image_dir","/mnt/images:/home/images") ;<br />

Result<br />

If the parameters are correct the operator (T )read image returns the value H MSG TRUE. If the indicated<br />

files cannot be found (T )read image returns the value H MSG FAIL. Otherwise an exception handling is<br />

raised.<br />

Parallelization Information<br />

(T )read image is processed under mutual exclusion against itself and without parallelization.<br />

Possible Successor Functions<br />

disp image, threshold, regiongrowing, count channels, decompose3, class ndim norm,<br />

gauss image, fill interlace, zoom image size, zoom image factor, crop part,<br />

(T )write image, rgb1 to gray<br />

read sequence<br />

set system, (T )write image<br />

Image / region / XLD management<br />

Alternatives<br />

See Also<br />

Module<br />

read sequence ( Hobject *Image, long HeaderSize, long SourceWidth,<br />

long SourceHeight, long StartRow, long StartColumn, long DestWidth,<br />

long DestHeight, const char *PixelType, const char *BitOrder,<br />

const char *ByteOrder, const char *Pad, long Index, const char *FileName )<br />

Read images.<br />

The operator read sequence reads unformatted image data, from a file and returns a “suitable” image. The<br />

image data must be filled consecutively pixel by pixel and line by line.<br />

Any file headers (with the length HeaderSize bytes) are skipped. The parameters SourceWidth and<br />

SourceHeight indicate the size of the filled image. DestWidth and DestHeight indicate the size of the<br />

image. In the simplest case these parameters are the same. However, areas can also be read. The upper left corner<br />

of the required image area can be determined via StartRow and StartColumn.<br />

The pixel types ’bit’, ’byte’, ’short’ (16 bits, unsigned), ’signed short’ (16 bits, signed), ’long’ (32 bits, signed)<br />

and ’swapped long’ (32 bits, with swapped segments) are supported. Furthermore the operator read sequence<br />

enables the extraction of components of a RBG image, if a triple of three bytes (in the sequence “red”, “green”,<br />

“blue”) was filed in the image file. For the red component the pixel type ’r byte’ must be chosen, and correspondingly<br />

for the green and blue components ’g byte’ or ’b byte’, respectively.<br />

’MSBFirst’ (most significant bit first) or the inversion thereof (’LSBFirst’) can be chosen for the bit order<br />

(BitOrder). The byte orders (ByteOrder) ’MSBFirst’ (most significant byte first) or ’LSBFirst’, respectively,<br />

are processed analogously. Finally an alignment (Pad) can be set at the end of the line: ’byte’, ’short’ or<br />

<strong>HALCON</strong>/C <strong>Reference</strong> <strong>Manual</strong> / 2000-11-15

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!