Environmental Remote Sensing

Forestry 753

Lab Eight: Image management


I. Introduction

In this lab you will learn a few miscellaneous, but still important, functions in Imagine. There are no questions associated with this lab. You are free to work on it at your leisure. The topics presented in this lab are likely to be very useful in your projects, so please finish the lab before you start project work. The topics covered will be:

1. Import and export
2. Creating image mosaics
3. Reprojecting an image

II. Import and Export

Imagine allows you to import many data types into the IMG format. This is mainly used when you receive data on CD and need to prepare it for use in Imagine. You will do a simple import procedure in this lab.

Imagine will also allow you to export IMG files into formats used by other programs (Arc/GRID, Arcview Shapefiles, ASCII text, TIFF, Generic Binary, etc.) This can be useful if you want to process a classified image in GIS software, or provide an image file to someone who doesn' t have Imagine but does have some other image processing package. In this lab, we will export an image file for use in ArcView.

Import

Let's say that we got some data from someone in Generic Binary format and we want to use it in Imagine. Here's how to do it:

In the main Imagine toolbar, press the Import button. You will see the following dialog box:

Make sure the Import button is checked. For the Type, select Generic Binary. For Media, select File. In the Input File box, select the file in the course_data/tm directory (on the server) called ral94_a_sub234_bin.bsq. This filename means: Raleigh 1994 data; Albers projection; a subset image containing only bands 2,3, and 4; generic binary data; in the band sequential (bsq) format. For more information on the different generic binary formats (bsq, bil, bip, rle), see Jensen, pp 60-61. Provide an output filename and location and then click OK.

Imagine will now give you a new dialog box so you can provide some information about the file to be imported. Most of the time, when you import data into Imagine, you will have to tell it how to "handle" the data. You'll need to tell it how many bands the image has, how many rows and columns, the data format (bsq, bil, bip, etc.), and whether the actual image file has header information in it. The image header provides all of the previously mentioned information, as well as any projection and coordinate system data for the image. Usually the header is in a separate file, so you'll leave the "header" boxes in this dialog blank. The header for our image is called ral94_sub234_bin.hdr. If you were to open this file in a text editor, such as Wordpad, this is what you'd see:

BANDS: 3
ROWS: 1197
COLS: 1182
INTERLEAVING: BSQ
DATATYPE: U8
BYTE_ORDER: NA
UL_X_COORDINATE: 1525108.000000
UL_Y_COORDINATE: 1572965.000000
LR_X_COORDINATE: 1558766.500000
LR_Y_COORDINATE: 1538879.000000
PIXEL_WIDTH: 28.500000
PIXEL_HEIGHT: 28.500000
MAP_UNITS: meters
PROJECTION_NAME: Albers Conical Equal Area
PROJECTION_ZONE: 0
PROJECTION_PARAMETERS:
0.000000
0.000000
0.514872
0.794125
-1.675516
0.401426
0.000000
0.000000
0.000000
380985058719645070000000000000000000000000000000
000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000.000000
1.000000
0.000000
125013747960395050000000000000000000000000000000
000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000
0000.000000
748956394878364030000000000000000000000000000000
000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000
00000000.000000
394356132863310080000000000000000000000000000000
000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000.000000
SPHEROID_NAME: GRS 1980
SEMI_MAJOR_AXIS: 6378137.000000
SEMI_MINOR_AXIS: 6356752.314140
E_SQUARED: 0.006694
RADIUS: 6371007.180883

Looks messy, but there is some important information here. First, you'll see the number of bands (3). Next, the number of rows and columns of the image, the data type (bsq), data format (U8 = unsigned 8-bit), the upper left and lower right X and Y coordinates, the pixel size (28.5), and the Projection information. This information is needed to georeference the image. If we did not have this information, we would have to do it the hard way: using a reference image and selecting GCPs (like Lab 4).

So, enter all of the required information into the import dialog box so that it looks like this (double check it):

Click OK, and Imagine will import the data to IMG format. When it's done, open the new file in a viewer. This image should look familiar.

Now, select Utility / Layer Info. Notice that the projection information is blank. Also, take note of the upper left and lower right coordinates. These are expressed in "file" coordinates, starting from the upper left pixel (0,0), instead of "map" coordinates, based on a projection and coordinate system. We have to enter the projection info now. Select Edit / Change Map Model. Fill in the blanks will the information from the header file so that the dialog box looks like this:

Click OK, and when Imagine asks you if you want to save the changes, click Yes. So we have now told Imagine about the projection and upper left and lower right coordinates, but we aren't finished yet. All images need to have a spheroid and datum, and many projections require extra information like a Zone number for UTM or Stateplane. Select Edit / Add/Change Projection. We will enter the required numbers here. Make the dialog box look like this (from the header information -- double check that you make it 96 W, not 96 E):

Note that the header does not give the correct values for the parallels, central meridian, and projector's origin. Just enter the values we know to be correct (like the above picture). Click OK and then click Yes to save the information.

That's it! We have now imported and georeferenced an image. Open the "real" raleigh94_alb in the same viewer to make sure it lines up.

 

Export

Let's say we want to use the classification from Lab 6 in the ArcView or Arc/INFO GIS software to do some extended spatial analysis. We can export the image as a GRID file. Here's how:

From the main Imagine toolbar, press the Import button. When the dialog box comes up, check the Export button. For Type, select GRID, and for Media, select File. Select ral94_a_sub234.img as the the Input File, and provide your own output filename and location. Do not put an IMG extension on the filename. (Why not?) Also, make the output filename less than 11 characters. Your dialog box should look like this:

Click OK, and then just click OK in the next dialog box and Imagine will export the image. It will create three GRID files, one for each band. Now you're ready to do some GIS analysis. Those of you who are familiar with ArcView can verify that the export worked.


III. Creating a Mosaic

A mosaic is an image created by joining two or more images. We will create a very simple mosaic in this lab. For more detail on these procedures, see the Field Guide.

Open the following images in two viewers: ral94_sub_l.img, ral94_sub_r.img. You can see that these are the left and right sides of the Raleigh TM image. We're going to stitch these images together.

First, open the mosaic tool by selecting from the Imagine toolbar: DataPrep / Mosaic Images. This will bring up the mosaic window:

To tell Imagine what images you want to mosaic, click on the Add Images button to bring up the add images window.

In this dialog box, select the ral94_sub_l.img file and click the Add button. Then, select the ral94_sub_r.img and click Add. Now click Close.

You'll see that the main mosaic window now shows both images side by side. We're ready to run the mosaic. Note that there are MANY options available to you that we're not going over. These invove setting cutlines, choosing how overlapping areas of the images are handled, and others. It is critical that you consult the Field Guide for help in choosing the correct options for your particular images. For the purposes of this lab though, let's just run it and see what happens. Select Process / Run Mosaic. Give Imagine an output file location and name, set the "Stats Ignore" value to zero, and click OK.

When it's done, open the mosaicked file in a viewer. How does it look?

 

IV. Reprojecting an image

Reprojecting is changing the Projection of an image. You may have to reproject an image so that it matches data you already have. Reprojecting in Imagine is fairly straightforward. There are, however, two things to remember:

1. Changing the information in the Layer Info tool DOES NOT reproject the image. Layer Info exists to tell Imagine (and you) what the CURRENT projection of an image is. Changing those numbers does not reproject the image. You must use one of the two reprojection utilities to actually reproject an image.

2. There are two ways to reproject. The first is a quick method for very common projections. You can get to this by selecting Interpreter / Utilities / Reproject Images. Here you simply specify the input image, output image, and the output projection. The problem is, there are very few useful output projections listed. If you need to reproject an image to a projection that is not listed (like Albers or UTM with the NAD83 datum), you'll have to use the more complex method.

The Complex Method

Select from the main Imagine toolbar DataPrep / Image Geometric Correction. In the next dialog box, either select a viewer that contains the image you want to reproject, or give Imagine the filename and click OK.

In the next dialog box, select Reproject and click OK. The next dialog box, the Reproject Model Properties window, should look familiar. Refer to Lab 4 for help using these menus. Set the Polynomial Order to an appropriate value. Click on the Projection tab. Set the output projection, spheroid, datum, units, and any other required parameters (Zone, parallels, central meridian, etc.) Go back to the Parameters tab and make sure the RMS error is within your tolerance. Now, just like in Lab 4, in the Geo Correction Tools box, click on the Resample button, provide an output filename, cell size, resample method (nearest neighbor), click Ignore Zero in Output Stats, and click OK.

That's it. Your new image should have the projection you want.


End of Lab 8.


Go back to the FOR753 Home Page