Earth Analysis Techniques > Image Analysis Modules > Introduction to Image Analysis > Day 3—Quantify Observations by Calibrating and Measuring Images > Part 1: Spatial Calibration and Measurement

# Part 1: Spatial Calibration and Measurement2

## Introduction to Measuring in ImageJ

On Day 1, you learned that a digital image is a string of numbers, displayed in a rectangular array, according to a lookup table. You also learned about the three dimensions of an image width, height, and bit depth. The power of image processing is its ability to make measurements in these dimensions:

Spatial measurements Measurements of distance, area, and volume. These involve the first two dimensions of the image, its width and height.

Density measurements Measurements involving the third dimension, the pixel values. Pixel values can represent temperature, elevation, salinity, population density, or virtually any phenomenon you can quantify.

Before you can make meaningful measurements, you need to calibrate the image that is, "tell" the software what a pixel represents in real-world terms of size or distance (spatial calibration), in terms of what the pixel values mean (density calibration), or both. In this section, you will learn how to spatially calibrate digital images.

• Launch ImageJ by double-clicking its icon on your desktop or by clicking its icon in the dock (Mac) or Launch Bar (Win).
• Choose File > Open..., navigate to your Day 1 folder or directory, and open the lake_mead_2004_color.jpg image that you downloaded in the Intro to ImageJ section.

This image is a Landsat view of Lake Mead, Nevada, taken in May 2004.

Spatially calibrating an image is commonly called setting the scale, and an image that has a scale set so that distances and areas are in units other than pixels is called a spatially calibrated image.

## Select What You Want to Measure

ImageJ can collect a number of measurements for you. Before you begin setting a scale and making measurements you need to decide on your measurement options.

1. Choose Analyze > Set Measurements....
2. The Set Measurements window opens. Check Area and Perimeter (length) to collect those measurements. Then click OK.

## Find the Image Scale

If you measure distances or areas on a digital image, your results will be expressed in pixels and square pixels. ("Wait," you say, "Aren't all pixels square?" Actually, no. But that's a topic for another time...) If you want to measure image features in units like meters or square miles, you need to convert pixels to their equivalent "real world" units. You could do this yourself with a calculator, or you could have ImageJ do the work for you. ("Yesssssss!") Giving ImageJ the information it needs to convert from pixels to other units is called setting the scale.

To set the scale in ImageJ, you need to know what the scale is. Here are some ways you can find the scale of an image:

• A scale bar is printed on the image.
• There is a known distance in the image, such as the distance between two landmarks.
• A written statement of scale exists, usually in the image documentation. In this case, the scale may also be called the image resolution. For example, if the image documentation says the resolution is 30 meters, then the scale is "1 pixel = 30 meters."
• Copy the scale from another image of the same scale that has a scale bar or known distance in it.

## Set a Scale Using an Existing Scale Bar

Someone was kind enough to put a scale bar on this Lake Mead image, so we'll use it to set the scale.

1. Use the straight line selection tool to drag out a line across the scale bar. Select Analyze > Set Scale... The Set Scale window opens. The distance you measured in pixels will be displayed. Enter 45 for the Known Distance and km or kilometers for the Unit of Length. To redo your line, click on the arrow tool, then re-click on the line selection tool. This effectively resets the tool.
• Using the straight line selection tool , click on one end of the scale bar, drag to the other end of the scale bar, and click again. (Tip: If you hold down the shift key while selecting with this tool, it forces your selection to be perfectly horizontal.)

• Choose Analyze > Set Scale....

• The Set Scale window opens. The distance you measured in pixels will be displayed. In this case, we got 261 pixels. Your mileage, er pixelage will vary, but it should be close to this. Enter 45 for the Known Distance and km or kilometers for the Unit of Length. For reference, the scale (in this case, 5.8 pixels per kilometer) is displayed at the bottom of the window. Then click OK.

2. To check the scale you set, use the straight line selection tool to drag out a line across the scale bar again. Choose Analyze > Measure. You should get something very close to 45 km in the Results window. If you don't, reset the scale.
• Using the straight line selection tool , click on one end of the scale bar, drag to the other end of the scale bar, and click again. (Tip: If you hold down the shift key while selecting with this tool, it forces your selection to be perfectly horizontal or vertical.)

• Choose Analyze > Measure.

• The Results window opens. You should get something very close to 45 km. If you don't, reset the scale.

3. Measure the distance between two small islands in Lake Mead.
4. These little islands.

The distance between the islands is approximately 25.46 kilometers. Your distance may be slightly different, depending on exactly how you set the scale and where you clicked on the islands. If necessary, use the zoom and pan tools to get closer to the islands.

5. Practice measuring distances and areas using the different selection tools on the ImageJ toolbar. The small red triangles on some of the tool buttons indicate that additional selection tools are available. Right-click (Win) or control-click (Mac) these buttons to access these "hidden" tools.

6. The Freehand line tool allows you to trace along the shoreline of the lake.
7. Close the lake_mead_2004_color.jpg image when you are finished.

## Set a Scale Using a Known Distance

Some images don't have scale bars. However, if you know the distance between two landmarks that are easily visible in both images, then you can use that distance to set a scale. Good landmarks are clear, relatively small, as far apart as possible, and obvious. You can use any landmarks you want, but since we already know the distance, we'll use the two small islands we measured in the previous section.

2. Choose File > Open, navigate to your Day 3 folder, and open the lake_mead_2004.tif image.
This satellite image is a larger version of the one you just worked with. It has a higher resolution which means that it contains more pixels, allowing us to see greater detail.
3. Use the Straight Line selection tool to select the distance from one small island to the other.
4. Choose Analyze > Set Scale....
5. Enter 25.4 for the Known Distance and km for the Unit of Length. Compare the scale, in pixels per kilometer, to the scale of the smaller image.
6. This image has nearly twice the number of pixels per kilometer (11.625), making it a higher (2X) resolution image.

7. Now that you have a scale set on this image, zoom in to one of the small islands and measure across it. Being able to make this measurement demonstrates the value of high resolution images.

## Set a Scale Using Image Resolution

Often you will have to learn more about an image so you can set the scale by directly entering the image resolution. You might find the resolution in a ReadMe file or in the image metadata. (Metadata is loosely defined as the data about the data). The resolution might be right there in the name of the file, or you might even get the resolution in a phone call to the person who provided the image to you. (As a last resort, of course!)

1. Click the thumbnail image to the right to open the full size version of the lake_mead_250m.jpg image in a new window. Then right right-click (Win) or control-click (Mac) the full size image and choose File > Save Image As... and save it to your Day 3 directory or folder. Close the image window after you have downloaded its file.
2. Choose File > Open, navigate to your Day 3 folder, and open the lake_mead_250m.jpg image.
3. Choose Analyze > Set Scale.... Enter the known resolution. In this case, the resolution is in the name of the image file 250m per pixel. Set the scale to 1 pixel equals 250 meters. Enter 1.0 for the Distance in pixels, 250 for the Known Distance, and meters for the Unit of Length. The reported scale is 0.004 pixels per meter, which is the same as 4 pixels per kilometer.
4. Next, measure the distance between the same two islands. Compare your result with the result from the first image, the one with a scale bar.
5. Your results should be about the same as the earlier measurements, 25400 m (25.4 km). However, since the resolution of this image is lower than the previous image, it's hard to tell exactly where the small islands are.
6. Your result should be about the same as the earlier measurements. However, since this image does not have the same resolution as the previous ones, it's hard to tell exactly where the small islands are.

With the scale set, ImageJ can now print a scale bar on the images for you.

1. Choose Analyze > Tools > Scale Bar... and enter the settings for your scale bar. The scale bar on the image updates automatically to show you the results of your changes.
2. This would be an appropriate scale bar for the image you just measured.

3. Choose File > Save As and save the file, with scale set and scale bars added, to your Day 3 folder, in TIFF format. This is important because other image formats do not store the scale information with the image. Remember the name of the file - you will need to open it later.
TIFF (Tagged Image File Format) is the only file format used by ImageJ that supports spatially calibrated images. In other words, if an image is spatially calibrated, the TIFF format saves the scale with the image so the image is already calibrated any time you open it. (JPG, GIF, PNG, and other formats you are familiar with don't save this information in the file.)

What are the tags in a Tagged Image File anyway?

The tags are information fields in the file, in addition to the image data itself, that are used to store the image dimensions, bit depth, calibration information, lookup table, copyright information, latitude and longitude, etc. This makes TIFF a very flexible format, and one of the safest for preserving the full content of scientific images.

## Your Assignment: Spatially Callibrate and Make Measurements on a Remote Sensed Image

1. Visit one or more of the Image Data sources listed below and look for an interesting imageparticularly one that might fit into your curriculum. Look for an image that has a scale bar printed on it, a feature or landmarks of known distance, or descriptive information that tells you the scale or size of the image.
2. Download the image to your Day 3 folder and use the techniques you learned here to set a scale for the image. If the image does not already have a scale bar, add one. Save your image with your scale bar added, if it did not originally have one, to your Day 3 folder.
3. Gateway to Astronaut Photography
The Landsat Image Gallery
MODIS Image Gallery
ASTER Web Gallery (read descriptions for width and height of image in km)
NASA Earth Observatory Image of the Day Collection (scale bars are on the preview images only - not full resolution)
NASA Earth Observations (NEO)
Image pairs from Earth Obervatory
Earth Observatory: World of Change
EarthKam Images for Investigation

4. Go to the Part 1: Share and Discuss page and post the image you chose, in JPEG format, with a scale bar added, if it did not already have one. Include an explanation of why you chose the image and what you would have your students do with it or how you would use it in your classroom and engage in an online discussion with colleagues.
Key Point: If an image has not been spatially calibrated, as long as you know the spatial resolution or the distance between two landmarks on the image, you can set a scale.