Raster Image Processing, Tips and Triks - Extracting Feature from an Image
Raster Image Processing, Tips and Triks - Extracting Feature from an Image

This is the third in a series of blog posts that will cover some tips and tricks for performing the following operations on a series of aerial images using ArcGIS 10.0:

These images are from a project I recently completed looking at the structure of a seabird colony off the coast of Nova Scotia, Canada, and are representative of the less-than-ideal imagery many of us have to work with regularly. The final goal of the project was to produce a detailed classification of the island's vegetation from a series of digital aerial photographs. The first two steps in this process, georeferencing the images and mosaicking them together, were covered in the first and second posts. The ability to create an accurate classification of the entire image is complicated by the effect of sunlight reflecting off the waves in the ocean. By removing the area covered by water from the image, I was able to focus the classification on just the vegetation itself. Here I will create a polygon which will eventually serve as a mask to isolate the island.

Extracting a single feature from the surrounding image while preserving the edge detail can be a daunting task. If the feature is small and simple, digitizing it by hand may be an option, but I prefer to let ArcGIS do the heavy work whenever possible.

Classify the Image

Image classification, in its most general form, is the process of sorting or arranging pixels in an image into classes or clusters. When the classes are user-defined, usually by using a series of training areas, the classification is considered "Supervised". When the classes are defined by an automatic process without the user's input, the classification is considered "Unsupervised". The training areas used in a supervised classification can be time consuming to create, but they offer significantly more control over the classification process. Unsupervised classifications don't require the designation of training areas and are therefore quicker and easier to perform, but there is much less control over how the pixel values are grouped. A more detailed explanation of image classification and the differences between supervised and unsupervised classification can be found in the help topic What is image classification.

In this case, where the objective is to classify the entire image as either 'island' or 'ocean', either supervised or unsupervised classification could be used to distinguish between the island and the ocean. I have chosen to use Iso Cluster Unsupervised classification (new at 10.0) because the value of the extra control offered by a supervised classification is outweighed by the time required to designate the training areas.

Figure 1: The results of a 5-class Iso Cluster Unsupervised classification

This image required five classes to adequately capture the major land/ocean difference. Some images may require more, others fewer. It is usually best to use the lowest number possible, which will save you some extra work later on.

The image is quite pixelated , even though only five classes were used, but running the Majority Filter tool a few times eliminated many of the smaller clusters of pixels. I found that by the fourth run there were no longer any significant improvements being made to the image, so I then ran the Boundary Clean tool to tidy up the few remaining stray pixels.

By this point some of the classes are exclusively either water or land. Those classes which are all land can be reclassified together, as can those which are all water. The remaining classes should be left separate until later. The reclassification isolates more stray pixels which can now be eliminated by re-running the majority filter and boundary clean tools.


Figure 2: The classified imagery after use of generalization tools and reclassification.

Separate the Feature from the Surrounding Area


While some classes are now clearly either land or water, many are still found in both regions. This is largely due to the pixel values of the reflections in the water resembling those of the highly reflective rocks on land. The Region Group tool reclassifies the image by grouping adjacent pixels with a common value together. After each area of reflection and each rocky area have unique values, they can be treated separately.



Figure 3: Results of the Region Group tool.

Many of these new groups are too small to be integral to defining the shape of the island. Using the Identify tool , I selected the smallest area I thought would be important and used Extract by Attributes to create a new raster containing only the cells with count values equal to or larger than the area I identified. The holes created by removing the smaller pieces were then filled using Nibble. You may want to try Extract by Attributes with different thresholds, run Nibble on the outputs, and compare the results to find which gives enough detail to define an outline that is accurate enough for your purposes.



Figure 4: Nibbled raster.

Isolate the Feature

The results of a well-Nibbled raster should be large, clearly defined groups. To create a single polygon outlining the island I converted the raster to a polygon feature class using Raster to Polygon. I assessed each polygon and deleted those which were not part of the island. Which polygons are deleted depends entirely on the goal of the project. I needed to create a polygon defining the perimeter of dry land, so any polygons which fell on the ocean, intertidal zone or ponds were deleted.



Once I was satisfied the remaining polygons were all part of the island, I merged them using the Dissolve tool to create a single polygon representing the boundary of the island, shown in Figure 5 overlaying the original imagery.



Figure 5: The final polygon feature class.

Source: http://blogs.esri.com