read_image ( : Image : FileName : )

Read an image with different file formats.

The operator read_image reads the indicated image files from the background storage and generates an image from them. One or more files can be indicated. The maximal region of the generated image object (= all pixels of the matrix) is chosen. All images files written by the operator write_image (HORUS format) have the extension '.ima'. A description file can be available for every image in HORUS format (same file name with extension '.exp'). If it is available the image data is checked for consistency with the current image format (see init_horus. The type of the pixel data (byte, int4, real) can also be taken from the description file. If this information is not available the type byte is used as presetting.

Besides the HORUS format TIFF, GIF, PCX, SUN-Raster, PGM, PPM, PBM and XWD files can also be read. The gray values of PBM images are set at the values 0 and 255. The file formats are either recognized by the extension (if indicated) or because of the internal structure of the files. If the extension is indicated the image can be found faster. In case of PGM, PPM and PBM the corresponding extension (e.g. 'pgm') or the general value 'pnm' can be used. In case of TIFF 'tiff' and 'tif' are accepted. In case of colored images an image with three color channels (matrices) is created, the red channel being stored in the first, the blue channel in the second and the green channel in the third component (channel number).

Image files are searched in the current directory (determined by the environment variable) and in the image directory of HORUS The image directory of HORUS is preset at '/bilder' and '/usr/local/horus/images' in a UNIX environment and can be set via the operator set_system. More than one image directory can be indicated. This is done by separating the individual directories by a blank.

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

setenv HORUSIMAGES "/usr/images /usr/local/horus/images" HORUS also searches images in the subdirectory "images" (Images for the program examples). The environment variable HORUSROOT is used for the HORUS directory.


Attention

Images of the types int4 and real generally cannot be exchanged between different types of computers.


Parameters

Image (output_object)
image -> object : byte / int4 / real

FileName (input_control)
filename.named(-array) -> string
Default value: 'fabrik'
Suggested values: 'affe', 'fabrik', 'mreut'


Example
/* Reading an image: */
  read_image(:Image:'affe':).

/* Reading 3 images into an image object: */
  read_image(:Bildobjekt:['house_red','house_green','house_blue']:).

/* Setting of search path for images on '/mnt/bilder' and '/home/bilder': */
  set_system(::'image_dir','/mnt/bilder /home/bilder':).

Result

If the parameters are correct the operator read_image returns the value TRUE. If the indicated files cannot be found read_image returns the value FAIL. Otherwise an exception is raised.


Possible Predecessors

read_info


Possible Successors

disp_image, threshold__, regiongrowing__, count_channels, decompose3, class_ndim1__, gauss__, fill_interlace__, zoom_image1, zoom_image2, crop_image, write_image, rgb1_to_grey


Alternatives

read_sequence, read_picture


See also

read_info, set_system, write_picture__, write_image



Copyright © 1996-1997 MVTec Software GmbH