|
Your Skills: Enhancing Digital Images So far, all you have done is change the colors associated with particular image values. The resulting image may look weird or exotic, but it is still a lousy image. Now you will look at a couple of image processing tricks that will seem like magic! However, these tricks involve actually changing pixel values - altering the original image. You can easily destroy an image using these tricks, so make sure you have the original saved on your hard drive. You wouldn't want to give SAL an excuse to laugh at you, would you? Filtering This is a process of changing pixel values to emphasize or de-emphasize certain pixels or groups of pixels. "Essentially, filtering is simply multiplying a large matrix, the image, by a small matrix called a filter," intones SAL. The "built-in" filters in NIH Image, like Smooth, Sharpen, Find Edges, etc., are found under Process in the menu bar. Try a couple, just to see what they do. Simply select, say, Process/Smooth, release the mouse button, and watch the action. You can recover the original image after a single filtering process by selecting Edit/Undo Filtering. If you perform more than one filtering process without "undoing," however, you must select File/Revert to Saved to get the original back. For your Mars images, a useful filter is the one that removes the black and white spots--the "noise." "The 'noise' in the Viking images was frequently caused by interference such as a rain storm at the receiving stations on Earth--one in the U.S., one in Australia, and one in Spain. Literally, 'The rain in Spain during image reception leaves a stain,'" chortles SAL. Select Process/Rank Filters... and release. In the dialog box that appears, click the button by Median (Reduce Noise), make sure that the number in the Iterations box is 1, then click OK, sit back and watch the noise simply disappear! SAL's bored voice drones on: "The Reduce Noise filter effectively removes single pixel spikes,' pixels with values greatly different from their immediate neighbors. The disparate value is replaced with an average value of the 8 adjacent pixels. Think of a Tic-Tac-Toe box with an O in the center space, and Xs in all 8 of the outside spaces. The O is different from all its neighbors. It is noise. Removing the noise is like replacing the O with an X so that it is just like its neighbors. The large, regularly spaced black dots that remain in this Viking image after filtering are reference marks placed in the original image by the spacecraft camera. They are several pixels across, so they are not removed by noise filtering." After checking out what the other filters do, remember to restore the original when you are ready to Reduce Noise and go on to the next step. After reducing the noise, try the Profile Tool again and see how the profiles look without the black and white spikes. You might also try combinations of filters just to see what happens. Stretching Now that the noise is gone, Cydonia.1 looks a bit better, but it is still really bland. What can you do? Select Analyze/Show Histogram to see the pixel values in this new image. Looks pretty much the same as it did before, doesn't it? That's because the filtering only affected a few pixels, mostly below level 120 and above level 190. As in the original, most of the pixel values fall between about 150 and 180, a span of only 30 levels. If we could "stretch" out the central double-hump of pixel values over a larger range of levels, the image should appear in sharper contrast. As it turns out, "stretching" is easy in NIH Image. Select Window/Map. A small rectangle titled "Map" will appear just below the center on the left edge of the monitor screen. It has a large square with a diagonal line, two long rectangles labeled "B" and "C," and two small rectangles at the bottom. Click on the black button in the "C" rectangle (by the way, C stands for "Contrast") and drag it towards the right end of the rectangle. Several things happen: the image gets darker, the diagonal line in the square becomes more vertical, and the pattern of black and white in the LUT changes to mostly black or white with only a narrow band of gray in between. Remember, the LUT shows what shade of gray is assigned to each pixel value, so by moving the Contrast button, you change the assigned shades, not the pixel values. When you are finished playing, move the contrast button to the right about 90% of the length of the rectangle. Now click on the "B" button (B stands for brightness) and move it back and forth. Again, several things happen: the image gets brighter or darker, the line in the square shifts left or right, and the band of grays in the LUT moves up or down. Slowly slide the button to a position about 2/3 of the length of the rectangle from the left end and watch the image "pop out" at you. Play with both the B and C settings to get the best-defined image. Try clicking on both of the small rectangles at the bottom of the map window. The left one returns you to the original (poor) brightness/contrast settings, and the one on the right makes the image "binary:" all pixels are either black or white. When you have found a Brightness/Contrast setting that you like, you can reset the pixel values in the image to permanently keep the image you have made. Ready? Before you can do anything, SAL says sharply, "Careful, Human! This process will permanently change the image. You will NOT be able to recover the original from the changed image. You may have noticed that when you stretch the image to bring out details in one part of the image, other parts of the image may be 'burned out.' Since humans almost never get it right the first time, you will almost certainly want to restretch the image later to bring out details in those other parts.' So, twit brain, you had better make sure you have saved a copy of the original." Pretty arrogant for a bunch of computer chips, isn't it? However, SAL is right, so you would be smart to follow its advice. But enough of that! Let's get on with it! If you have been filtering and stretching your image using the gray scale LUT, simply select Process/Apply LUT and release. If you are working with your image using a color LUT, select Process/convert to Grayscale, and release. The image will flicker, then return as you had it. The LUT will reset to continuous grays, and the line on the Map square will return to its original diagonal position. If you wish, reselect your color LUT to get the color back. To really see what you have done to the image, select Analyze/Show Histogram. It looks really different. You have chopped off the upper and lower range of pixel values and stretched the original 30 level-wide double-hump to cover the entire gray-scale range. Awesome, right? Retry some of your tools like the Color options or the Profile tool on this image and see what you get. If you wish to save your stretched image, select File/Save As, and type in a name different from the original, like "Cydonia.str" or "Stretch." SAL cuts in again, "Make SURE you give your stretched image a name different from the original. Otherwise when you save you will overwrite the original and destroy it!"
[
Your Situation ] [ Your Mission
] [ Your Skills: / Viewing Digital Images / Seeing Pixels / Enhancing Digital Images
] [ Your
Challenge ] [ Home ] [ Teacher Pages ] [ Modules & Activities ] |
HTML code by Chris Kreger
Maintained by ETE Team
Last updated November 10, 2004
Some images © 2004 www.clipart.com
Privacy Statement and Copyright © 1997-2004 by Wheeling Jesuit University/NASA-supported Classroom of the Future. All rights reserved.
Center for Educational Technologies, Circuit Board/Apple graphic logo, and COTF Classroom of the Future logo are registered trademarks of Wheeling Jesuit University.