Part 2: Scale and Crop Images3
Scaling and Cropping Images and Stacks
What if these images were too large to work with, either for you or for your students? What could you do? Two common solutions are scaling the images down and cropping them to a smaller size.
Scaling, Interpolation, and Spatial Calibration
Scaling is the process of making an image larger (scale > 1.0) or smaller (scale interpolation.
Without going into the detailed mathematics of the different interpolation methods, you do need to know that the Interpolation method (bilinear, bicubic, or none) is most important if you're scaling images up to a larger size (scale > 1), but usually won't make much difference when you're scaling down, especially at "even" scales like 25% or 50%. Bilinear interpolation is generally faster, while bicubic interpolation is more complex and takes a bit longer. This is not an issue with today's powerful computers.
To compare interpolation methods, you will crop out a small image of the crater, then scale it up by a factor of 10 using each method.
- Stack the seven Landsat band images. If necessary, set the spatial scale of the image to 30m/pixel.
- Activate the stack window, locate the crater, and zoom in until the crater fills most of the window.
- Use the rectangular selection tool to select a 60 x 60 pixel square centered on the crater. The selection size appears in the image status bar as you make the selection. Since the scale is set at 30m per pixel, 60 pixels equals 60 x 30 = 1800 meters. (Tip: To select a perfect square centered on the crater, hold down Command-Shift (Mac) or Control-Shift (PC), click at the center of the crater, and drag outward.)
- Create a new image of just the selected pixels by choosing Image > Duplicate. Since you're working on a stack, you have the option to duplicate the entire stack or just the current slice. Go ahead and duplicate the whole stack. You should now have a small window containing a 60 x 60 pixel stack.
- Activate the small stack window. Choose Image > Scale and scale the stack by a factor of 10 but without interpolation using the following settings:
- Activate the small stack again, choose Image > Scale and scale the stack by a factor of 10 using bilinear interpolation using the following settings:
- Activate the small stack again, choose Image > Scale and scale the stack by a factor of 10 using bilinear interpolation using the following settings:
- Compare the three scaled images. Which one looks like giant pixels? Which one looks smoothest?
- How did the spatial calibration (scale) handle the scaling process? Using any of the three 10x scaled images you made, measure the east-west distance across the crater. What diameter do you get, in meters? How does this compare to the original image?
- The moral of this story? When you scale images up or down in ImageJ, the spatial calibration is NOT preserved! However, as long as you know how you scaled the image, you can use that information to modify the spatial calibration. In this case, we scaled the image UP by a factor of 10. To get the new spatial calibration, divide the old spatial scale (30 meters/pixel) by the scaling factor you used (10.0). What is the new image scale?
- Activate any one of the 10x images and choose Analyze / Set Scale and change the scale to 3 meters per pixel. This would be a good time to turn off the global setting.
- Measure the diameter of the crater you just re-calibrated. It should be very close to 1080 meters. (If not, try the process again on one of the other 10x images you created.)
- Look at the memory size of the mini-stack and the file size of the 10x stacks (Tip: The memory size of each open image window is displayed at the bottom of the Window menu. Since you scaled BOTH the height and width of the image by 10x, the area (or number of pixels, or the memory size) of the image is 10 x 10 = 100 times as large as the original. In other words, the size (memory) of the image increases by the square of the scaling factor. Doubling the scale increases the size of the image by 22 or 4 times. (Conversely, scaling by 0.5 decreases the size of the image 0.52 times, or 25% (1/4) its original size.
- Close all of the open image and stack windows.
Scaling images that are too big to work with
You just scaled up a portion of a large image, but it's more common to need to scale down large images to a size that's more workable. This is especially useful when working with large time series images that you want to stack and animate. In general, the smaller the images the more you can stack. In this section, you will scale the seven Meteor Crater Landsat bands to a size that is easier for creating true and false color images. You will also learn how to fix the dull, washed-out look of the color composite images.
- Create a new folder named Meteor Crater Small at the same level as the LT50360362011173PAC01 folder. You will use this folder to save the scaled-down images.
- Open the Band 1 image (L5036_03620110622_B10.TIF) in ImageJ. Note the dimensions and memory size of the original image.
- If you scale this image to 0.50 (50%), predict its new dimensions and size. Choose Image > Scale and scale the image to 50% its original size. Name the new image L5036036_03620110622_B10_50.TIF
- What are the dimensions and size of the scaled image?
- Choose File > Save As and save the scaled image in TIFF format to the Meteor Crater Small folder you created.
- Close both image windows.
- Open the Band 2 image, scale it to 0.5, save the scaled image, and close the images. Repeat this process until you have saved scaled-down versions of all seven bands.
Creating true and false color Landsat images
- Open all seven of the scaled-down Landsat band images in ImageJ. (Please do NOT stack them!)
- Choose Image > Color > Merge Channels and assign the Band 3 image to the red channel, Band 2 to the green channel, and Band 1 to the Blue channel. Check the Create composite and Keep source images options, and click the OK button.
- Close the composite window.
Merge Options
There are two ways to combine bands to create a color image:
Create compositethe merged channels will create a special type of stack called a composite stack. A composite stack allows you to access the channels separately, and to visualize the data in a variety of ways using the Channels Tool (Image > Color > Channels Tool).
RGB ColorIf the Create composite option is not selected, ImageJ will create a single RGB color image.
There are advantages and disadvantages to each merged color format, so unless the output is specified you may choose either one.
Using raw Landsat bands produces dark, muddy-looking RGB or composite imagesnot the crisp, vivid images you see in science and geography magazines and web pages. The color images you made lack "punch" because they don't use the full range of pixel values available in each channel. To fix this, you can enhance the contrast of the images before merging them.
- Starting with the Band 1 image (choose it from the bottom of the Window menu), choose Image > Adjust > Brightness/Contrast to open the B&C window. The graph at the top is a histogram of the pixel values in the image. See how they are bunched up to the left of center? The goal is to spread them out from black to white. This is based on the assumption that every scene of Earth's surface includes something very dark and something very bright.
- In the B&C window, adjust the Minimum and Maximum sliders until the line on the graph slopes up from the left edge of the distribution to the right edge of the distribution, as shown. The line is called the transfer function, and it is a graph of the equation that's used to convert the original pixel values to new pixel values.
- Click the Apply button. This spreads the range of pixel values in the image from black (0) to white (255).
- Repeat this process to enhance the contrast of the other six Landsat bands.
- When you have enhanced all of the bands, choose Image > Color > Merge Channels and create a new true color (RGB321) composite image. How does it look now?
- Choose Image > Color > Channels Tool and experiment with the different buttons and settings in the tool, to learn how each affects the display of the band data.
- Use Merge Channels to create false color images by assigning different Landsat bands to the red, green, and blue channels of the image.
- If you wanted to spatially calibrate (set a scale) for this set of scaled-down images, what scale would you enter in the Set Scale dialog box? Remember, you scaled these images to 50% of their original size.
- What would the image scale be if you had used a scaling factor of 0.25? If the original image was 32MB, how large would the scaled image file be?
- Close all of your open image windows, saving any that you want to keep.
Reduce image size by cropping
When you are interested in just a portion of a scene, a better way to make the images smaller is to crop an area out of the larger scene. You did this already when you cut out a 60x60 pixel image of the crater, which you used to compare the different scaling interpolation methods. Now you will create a set of cropped images for all seven Landsat bands, and use them to create both true and false color images.
- Create a new folder for your cropped images.
- Open the band 1 image.
- Use the selection rectangle to select a portion of the scene.
- Choose Image > Duplicate to create a new image of the selected area.
- Save the image to the cropped images folder using names that will make the bands easy to identify.
- Open the next band image. To apply the identical selection to the image, choose Edit > Selection > Restore Selection.
- Choose Image > Duplicate.
- Close the images.
- Repeat this process for the other Landsat bands.
- Open all of the cropped images.
- Use Merge Channels to create both true and false color versions of the cropped scene.
- Post a JPEG version of your image and engage in an online discussion about using remote sensed images in your teaching.
If you wanted to make measurements on these cropped images, what spatial calibration (scale) would you use?
An alternate (and faster) way to produce a series of perfectly cropped imagestry it if you have enough memoryis:
- Open and stack the original full-size Landsat images.
- Use the rectangular selection tool to select the cropped area.
- Choose Image > Duplicate or Image > Crop.
When you are finished, close all open image windows.
Your Assignment: Locate, Create, and Calibrate a True or False Color Landsat Image.
For this assignment, choose an area of interest anywhere in the U.S. and do the following:
- Go to the GloVis web site and locate a relatively cloudless Landsat 4, 5, or 7 (SLC-on only) scene of your area of interest. If the files there a too large of a download, go to the Landsat Click and Pick site to download at least three bands for one Landsat scene.
- Order, download, and unzip the data on your computer.
- Use both cropping and scaling to reduce the images to a smaller size. (You might want to crop out the black in the background).
- Create a contrast-enhanced true or false color RGB or composite image.
- Spatially calibrate the image using an appropriate scale. (Hint: cropping doesn't change the calibration, but scaling does.)
- Measure at least one distance and one area on the image. If possible, check your measurement using Google Earth or some other outside reference source.
- When you are finished, post a screen shot of your final product to the Part 2: Share and Discuss Page. Then describe as much as you can about what you analyzed.
- Engage in an online discussion, sharing your ideas about using remote sensed images in your teaching.
Resources
The following resources are free, excellent descriptions of how remote sensing images are created, transmitted, received, processed, and distributed.
Sources
1Adapted from Earth Exploration Toolbook chapter instructions under Creative Commons license Attribution-NonCommercial-ShareAlike 1.0.2Adapted from Eyes in the Sky II online course materials, Copyright 2010, TERC. All rights reserved.
3New material developed for Earth Analysis Techniques, Copyright 2011, TERC. All rights reserved
4From Remote Sensing Math: A Brief Mathematical Guide by Dr. Sten Odenwald, NASA 2011.