Exercise 7 - Image Manipulation

We are going to use either Adobe Photoshop or a shareware program called GIMP to 'play' with some imagery of your choice (feel free to use the image you used last week) to illustrate some basic principles of image analysis. The objective of your manipulation is to make some preselected feature(s) on the image distinct from all the other features; i.e. to make that feature visually more apparent, or isolated. An ultimate, but likely not totally achievable, goal of this exercise is create an image that delineates the feature(s) of interest from each other and anything else. The closer you get the closer you are to having produced a simple classification. In practice, much more sophisticated, and classification focused software packages are used (such as ERDAS Imagine). However, Photoshop or GIMP can teach you a lot conceptually about image manipulation and classification. In addition, you will learn a useful raster image manipulation software platform. Select the image you want to try and classify. You should keep it relatively simple and pick 2-3 different feature types at most that you want to classify for.

Retain a copy of the original image for comparison purposes and in case you make a mistake and need to start over. Open the image in GIMP or Photoshop. Play with the program some until you have some feeling for how it works. Notice that GIMP or Photoshop also uses a layers architecture. This can be quite useful in your exercise, as you manipulate the same image in different ways in different windows and then merge the results. However, it does not have the assortment of 'vector' objects that can be drawn then easily manipulated in Inkscape (or Illustrator).

GIMP image manipulation tools can be found in two places, under the Colors and Filters tabs at the top of program window.

Within the drop-down menu obtained by Colors tab at the top of the program window shows three fairly powerful options that will be of distinct interest: Levels, Curves and Threshold. Documentation for the Levels tool can be found at this link, for the Threshold tool at this link, and for the Curves tool at this link. Selecting any of these results in a histogram of the color values that appears. You should look carefully at the histogram. If it is distinctly polymodal then the different modes could represent different feature elements (e.g. water versus rock outcrop versus vegetation). In the Levels tool you can look at and manipulate the Green, Red and Blue portions separately. You then use handles of various types to either select part of the distribution and/or reshape the distribution into a new form and a new resulting image. The Threshold is particular useful for selecting a part of the color spectrum (perhaps a distinct mode), and if a feature has a distinctive color range you may have selected for that feature. By using different layers you can 'select' for different features in the image, and then combine them to create a finished product.


The drop down menu from the Filters tab is extensive, and includes routines such as Sharpen, Blur, Edge, Despeckle, and Map Object. A list of filters along with explanations can be found at this web site - http://gimp.open-source-solution.org/manual/filters.html . The ones mentioned here are some of the ones worth focusing on. As you experiment with different filters try to work out what the underlying algorithm that produces the image changes. Have fun playing with these!

A suite of GIMP tutorials.

Adobe Photoshop image manipulation tools can be found under Image, then Adjustments. Filters also provides a number of alteration routines similar to those described above.

Wikipedia article on Image segmentation, which is similar to classification, where you try to segment the image into different components.

End products of the exercise:

Adobe Photoshop image manipulation tools (if you want to use this software package):

The image 'enhancement' tools are in two places in Photoshop. One is under Image , and the other is under Filter. You should experiment with the various different options to see what they do. Use the Help to look at documentation for the filters and adjustments to get some idea of how they work. Below are some that I suggest you look at and play with. Remember that in different versions of Photoshop things can be in different places.

Image - Histogram: This is simply informational and shows a histogram of luminosity values. Typically in an unenhanced black and white image you get a unimodal distribution. After you adjust it (e.g. with Curves - see below) you can get a more complex polymodal distribution. A polymodal curve produces the possibility of identifying different populations of pixel values, i.e. classifying the images. You should also look at the histogram after you have completed your image modifications.

Image - Adjust - Levels: This shows a histogram of values. Using the small triangular handles below you can modify the distribution of luminosities, and adjust the image. The range of changes you can make with this tool is large.

Filter - Noise - Despeckle: This can be thought of as a smoothing algorithm (the opposite of sharpen) which removes values that deviate significantly from its nearest neighbors. In combination with some other adjustments it may be useful.

Filter - Stylize - Find Edge: This algorithm looks for variation in luminosity in a sampling area, and assigns a new luminosity value to the pixel based on the variation. The idea is that edges will be places of greater variation.

Filter -Stylize - Trace Contour: This is a variant on the Edge routine where if it detects that pixel as an edge it gives it zero luminosity (black), and otherwise it is full luminosity (i.e. white). This may be best used after other modifications have been made to an image.

Image - Adjust - Curves: In some ways this is the most powerful adjustment you can make in Adobe photoshop. The window that opens shows a graph where for whichever color you are working in it shows present luminosity vs. new luminosity value. Here you are only working with gray values. Naturally you start with a straight line as nothing has been changed and there is a default equality. By clicking on various points along the line you create handles which can be used to manipulate the line. Dragging them to new positions will force a curve through the new positions. By moving those points up you take pixels with those luminosity values and make them more luminous, or by dragging them down you make them less luminous. In this way you can highlight areas with certain luminosity characteristics.

Copyright by Harmon D. Maher Jr.. This material may be used for non-profit educational purposes if proper attribution is given. Otherwise please contact Harmon D. Maher Jr.