Next: , Previous: , Up: Guile-CV   [Contents][Index]


3.2.3 Import Export

The Guile-CV procedures and methods to load, save and query file system images.

Procedures

im-load
im-save
im-size
im-width
im-height
im-n-channel
im-gray?
im-rgb?
Procedure: im-load filename

Returns a Guile-CV image.

Loads the image pointed by filename and returns a Guile-CV image. filename can either be a GRAY or an RGB image.

At this point, Guile-CV supports the following file formats: GIF, TIFF, JPEG, BMP, EXR, HDR, PNM (PBM, PGM, PPM), PNG, SunRaster, KHOROS-VIFF.

Procedure: im-save image filename [scale #f]

Returns #t.

Saves image in filename.

The optional scale argument can take the following values:

#f

pixel values are ‘clipped’: values < 0 are saved as 0, values > 255 are saved as 255, and otherwise are saved unchanged

#t

all pixel values are scaled5 to the [0 255] range

The type in which image is saved is determined by the filename extension, as in the folowing example:

(im-load "edx.png")
...
(im-save $4 "/tmp/edx.jpg")
Method: im-size filename

Returns the list of (width height n-channel)for filename.

Method: im-width filename
Method: im-height filename
Method: im-n-channel filename

Returns, respectively the width, the height and the n-channel for filename.

Method: im-gray? filename
Method: im-rgb? filename

Returns #t if filename is respectively a GRAY scale or an RGB image.


Footnotes

(5)

Note that in this particular context, scale does not mean a change in dimension, but rather bringing pixel values from the range they occupy in memory to the [0 255] range


Next: , Previous: , Up: Guile-CV   [Contents][Index]