Reading and Displaying Images
The purpose of this exercise is to read and display image files in IDL and to explore the character of image arrays. 

BACKGROUND INFORMATION
Some background on using IDL
Reading and displaying images
Basic operations on images


DISPLAYING IMAGES
IDL can display arrays as images through the IDL graphics window. Two procedures are available for image display, TV and TVSCL.

Let A be a 2D array of numbers. Each number can represent a gray level or a color at that location in an image. When used this way, the array values are called pixels.

The commands TV,A or TVSCL,A will display the array as a image.

READING IMAGES
Images are read from a file. The way that they are stored in a file depends upon their format. Some common formats are png, bmp, jpeg, tiff. Each format corresponds to a different way of organizing the data in the file. Hence, one must have different procedure to read each of the file formats. You can look up the descriptions of the image reading procedures in IDL Online Help.

GETTING STARTED WITH IMAGES
Let us now do a brief exercise that will first acquire an image and store it in a file. It will then be read into IDL and displayed. Later we will do some analysis on it.

Create a directory in your account and name it images. We will use this directory as a place to store images as we go along in the course.
 

Shown above is an image of some sailboats. We will use it as an example in this exercise. You can save this image to a file in your account by choosing View Image in your browser. That will display the image in a separate window. If you cannot find the View Image command, then clicking on the image will display the image for you.

It can be saved by using the Save As command. Save the image as sailboat.png in the image directory in your account.

After you have saved the image, check the directory to be sure that it has been stored where you expect it to be. Remember the path to the image file so you can refer to it when retrieving the image. Do exercise 1 below to read and display the image.

EXERCISE 1: Reading and Displaying an Image from an image file. Go to this exercise by clicking on the link.

An image is stored in an array. This array is just like other IDL arrays, which makes it possible to do all sorts of image processing by using standard array calculations. Do exercise 2 to become familiar with the image array.

EXERCISE 2: Properties of Image Arrays Go to this exercise by clicking on the link.

EXERCISE 3: Reading and displaying Lena  (Program to submit)

This exercise loads and displays the image lena.jpg and determines some information about the image array.