ABCs of DEW Software chapter 4:

Measuring Area
in Digital Images

There are three ways to measure the area of objects in digital images using tools in the AnalyzingDigitalImages software: Rectangle tool, Polygon tool, and Masking.


Investigation 4-1.  Spatial Analysis: Area


• AnalyzingDigitalImages software

• Plant Leaf image


Method 1: Rectangle Tool

Click and drag to draw a rectangle around the object of interest. To adjust the size of the box, either click and drag the blue or red corner of the box or click the small arrows that appear to the left of the image.

As one would expect, this would not yield very accurate area measurement for objects that aren’t rectangles.

 screenshot of measuring area 


Method 2: Polygon Tool

1. Draw a polygon around the object using the Polygon tool. Click on the image to place each corner of the polygon. Note: you may draw up to 20 corners to define a polygon. A warning appears after the 19th corner is drawn.

2. To adjust the size or shape of the polygon, click near a corner and drag.

If this method provides a sufficient precision for your needs, save your measurements and process your next picture.

 screenshot of polygon tool 


Method 3: Masking Colors

This method provides the most precise area measurement provided the color of the feature is sufficiently uniform and different from the surrounding features.

Selecting a color range or relationship to isolate specific features is called “masking”.

1. To set a color range, go to the “Mask Colors” window and draw a rectangle inside the feature of interest. To adjust the size of the box, click and drag the blue or red corner of the box. The range of colors inside the rectangle is automatically selected.

 screenshot of masking 

TIP: To adjust the selected range of colors, click and drag the minimum (min) or maximum (max) lines for red, green, or blue intensities.

TIP: Using the histograms of colors, which represent the frequency of color intensities for the complete image, you may decide only one or two colors are best to use to mask the image.

To ignore a color during masking, toggle the check box to off by clicking on it.

2. Click “Apply Mask” to blacken all pixels with colors within the selected range of colors. Pixels with colors outside this range will turn white.


TIP: To see if the desired feature has been accurately masked, click on the radiobutton labeled “Original”. To see the mask again, click the “Show Mask” button. Compare boundaries of the feature in both images.

3. Another way to mask colors is to create a mathematical relationship between red, green, and/or blue at each pixel. Use this feature if the range of colors cannot isolate the desired feature. Note that this option takes much longer to process the image than the first masking option, so be patient when applying.

4. When satisfied that the mask isolates the feature you want to measure, return to the “Spatial Analysis” window and use either the Rectangle or Polygon tool to draw around just the highlighted feature. Notice that the blackened pixels of the ruler are not inside the rectangle drawn below – these will not be counted in the area calculation.

Note that when using the Masked Image (see highlighted below), the area of the masked pixels inside the box or polygon is calculated (the white pixels are ignored). Using the other images, Original and Enhanced, the area tools calculate the area of the total pixels inside the drawn shape.

 screen shot of mask area 

Comparing the area using the polygon (11.49 in2) and the masking tool (11.11 in2), one would use the masking tool to study daily growth of leaves during the springtime.


Augmenting the Masking Colors by Enhancing Colors First

If it is difficult to isolate the feature from the surrounding colors using the mask tools, use the tools on the “Enhance Colors” window to change the colors of the image prior to using the mask tools. There are two sets of color enhancement options: first are the pre-defined options and the second are to create your own color alterations.

 screenshot of enhancing colors 


Preset Enhancements

There are 7 preset enhancements to view the digital image, and these are very useful to survey the colors of an image: RGB, Red (gray), Green (gray), Blue (gray), Red v Green (normalized), Red v Blue (normalized), and Green v Blue (normalized)

Red-Green-Blue (RGB): Standard color composite of digital imagery in which the color intensities of red, green, and blue are displayed in the computer display’s red, green, and blue, respectively.

The image should look the same as the object you photographed.

rgb colors 
Red, Green, or Blue as shades of gray: Gray shade images allow you to examine the intensities of values without biasing your sensitivity to red, green, or blue. If blue is being displayed as gray (shown in image on right) then high intensities appear white, and low intensities appear black. shades of gray colors 
Red versus Green, Red vs. Blue, or Green vs. Blue (normalized): Provides a comparison of two color intensities. The difference of the color intensities is divided by the sum of the color intensities. The displayed color is the greater of the two intensities. Equal intensities are displayed as black. This enhancement minimizes the effects of shadows and uneven lighting across the image. red versus green colors 

For example, suppose Red vs. Green (normalized) is selected (shown above). If a pixel has red, green, and blue (RGB) values of 40%, 80%, and 60%, respectively, the difference between red and green is 40% in the green, and the sum of the red and green intensities is 120%. The normalized value will be 40% / 120% or 0.33, which is converted back to percent values of 33% for display purposes. The displayed color for that pixel will be a dark shade of green (RGB values of 0%, 33%, 0%). Compare this value to another pixel with a difference between red and green of 40%, but in this case the pixel has RGB values of 0%, 40%, 20%. The normalized difference is 40% / (0% + 40%) which equals 1. This value is converted back to a percentage of 100%. The pixel will be displayed as a very bright green (RGB value of 0%, 100%, 0%).


2. Custom Enhancements

The second option to enhance the colors of an image is to select a range of colors and either limit or stretch this range of intensities.



Limiting to only that range of selected intensities turns off that color for pixels outside this threshold.

Clicking and dragging the yellow and cyan lines selected the red intensities between 12 and 53. The reds within this range represent the leaf.

By displaying only those red colors within this range (the limit option), the leaf remains the same but the background turns a cyan color because the more intense red values of the background have been turned off.




Stretching a range of color produces a similar effect for colors outside the selected range – those colors are turned off, but the selected colors are linearly expanded from 0% for the minimum intensity to 100% for the maximum intensity.

When the same values are stretched, the selected reds in the leaf become exaggerated, changing just the color of the leaf to redder hues.

Turning “off” a color for enhancement speeds up the processing time since it will be ignored.

Regardless of which enhancement method is used, the color enhanced image may be manipulated in the masking tool by selecting the Enhanced image button.

Quick Reference Guide for Length and Area Measurements with Digital Images

1. Calibrate pixel size when opening the image.

- Scale present in image: click and drag to draw a line along scale and enter length.

- Test you calibration by measuring object of known length in image.

2. To measure lengths, go to the Spatial Analysis window, select the Line Tool, and measure lengths by clicking and dragging a line along a desired feature.

- Save measurements to a text file for later analysis with Excel or another spreadsheet program.

3. To measure areas, there are 3 options.

a) In the Spatial Analysis window, use the Rectangle tool for very rough estimates or for objects that have a rectangular shape that are oriented parallel to the edges of the photograph.

b) In the Spatial Analysis window, use the Polygon tool to draw a polygon around the object.

c) Use the Mask Colors window to isolate the colors of the desired feature from its surroundings. Use the masked image in the Spatial Analysis window with either the rectangle or polygon tool to convert the masked pixels to an area measurement.

When the colors of the desired feature are similar to the colors of the surroundings, use the tools on the Enhance Colors window to alter color relationships. The enhanced image may be used with the Mask Colors window, allowing for a greater chance the feature may be highlighted for an area measurement.

 For new material relating to this chapter, please see the GSS website “Staying Up To Date” page: