|
- Image Processing Toolbox: The Image Processing Toolbox contains many functions for working with image data. Type 'help images' to see a brief description of the available functions, then type 'help fnc' (where 'fnc' is the function name of interest) to get the details.
- Loading a GIF-format image file: Use GIFREAD(string), where 'string' is a string variable (delimeted by apostrophes) containing the file name. GIFREAD returns the image data and a colormap. For example, the command
[x,map]=gifread('image.gif');
loads 2-D image data into the variable 'x', and an n-by-3 matrix into the variable 'map' which lists an RGB (red/green/blue) tuple for each index value in the image data. For example, all pixels with value 5 in the variable 'x' are associated with the RGB tuple stored in 'map(5,:)'. If the image is a graylevel image, then 'x' is the image data you want, and the 'map' variable is superfluous. If the image contains color information, then you need to convert the image to a grayscale image before continuing (see next item). - Converting from an indexed color image to grayscale image: Assuming you have just done a GIFREAD() to load an indexed image 'x' and a colormap 'map', do this:
y=ind2gray(x,map); - Displaying an image: IMSHOW(x,map) will do the job nicely.
- Displaying images on a 1-to-1 pixel mapping: Use TRUESIZE. IMSHOW scales the image size to fit nicely on the screen. Sometimes this leads to odd effects in the display, at which times you would like to be able to exactly map the image onto the pixel array of your display device.
|
|