Satimage Previous | Next
Importing an image into a matrix
Home Documentation Smile Computing Smile's maths Importing an image into a matrix  

Smile can open all the picture formats that QuickTime recognizes such as JPEG, PNG, BMP etc. (Smile displays those files as a movie). However, you can import the array of the gray levels of an image without opening it.

The commands for importing data from image files are imagefile bounds and convert imagefile.

The command for saving data as an image file is create grayimagefile.

imagefile boundsreturn the bounds of a bitmap image (JPEG, TIFF etc.)
alias
Result: bounding rectangle
imagefile bounds returns the sizes (in pixels) of the specified image, as a list {0, 0, xmax, ymax}.
convert imagefilereturn the array of the gray levels of a bitmap image (JPEG, TIFF etc.)
alias
[selected rectangle] bounding rectangle
Result: matrix
convert imagefile returns, as a matrix, the 2-d array of the gray levels of the pixels of the image. convert imagefile translates the image into grayscale before importing it as numerical data. The gray levels assume values between 0 (white pixels) and 255 (black pixels).
set m to convert imagefile (alias aPath)
QuickScalarMap(0, 0, m, 0) -- display the gray levels as a scalar map
create grayimagefileconvert matrix values into 256 levels then save it as a gray bitmap image (PNG, JPEG, TIFF etc.)
matrix
in file specification destination file. Its extension specifies the image format
[inverted] boolean inverse image levels. Default false
[minimum] real matrix values equal or greater than this value are set to 255. Default: maximum of the matrix values
[maximum] real matrix values equal or lower than this value are set to 0. Default: minimum of the matrix values
[resolution] integer image resolution. Default: 72dpi
Result: alias
Version française
Copyright ©2008 Paris, Satimage