Measuring the Area of Irregular Shaped Objects in Digital Images
Measuring the Area of Irregular Shaped Objects in Digital Images
John Pickle, Museum of Science. March 1, 2005
The ImageAnalysis software allows you to measure distances, areas, and color using a wide variety of digital images, including those taken with a digital camera, color-coded maps, aerial photographs, and satellite images.
1) Before making any measurements, you must first calibrate the size of a pixel to a size of an object of known length that is visible in the image. This procedure automatically starts after you select an image. If you can't calibrate the pixel size, you will still be able to make relative measurements of the percentage of pixels of specific colors in selected areas of the image.
There are 2 ways to calibrate the pixel size.
a) Use the "Known Pixel Size" option if you are using satellite images or special aerial photographs, called orthophotographs, in which the area represented by each pixel represents the same area on the ground. NOTE: This calibration option requires that the image you are using is equal to or smaller to the maximum size the software can use without converting the original to a smaller image. The image size used in ImageAnalysis is 672 pixels wide by 587 pixels high.
b) Use the “Scale Present in Image” while working with digital camera images that have an object of known size in the image. For this latter option:
Click and drag the cursor across the length of the scale – you may adjust the ends of the line with the small arrows that appear below the image.
TIP: Use the longest length possible since this minimizes small errors of drawing the calibration line.
In the lower right corner of the window, type the length of the line along the scale and then type the unit of the scale. Use the small arrows at the bottom of the window to fine tune the location of the line drawn along the scale.
TEST YOUR CALIBRATION: After completing the calibration, use the
“line” analysis tool to measure the length of the scale. If possible, measure a visible scale perpendicular to the direction of the first test.
For example, if you used the length of a ruler to calibrate the pixel size, use the width of the ruler as the second test, if it is visible.
The next step is to isolate the color of the object you want to measure from the surrounding objects. The
display tools provide enhancements to help quickly
visualize the color characteristics across the entire image. There are 7 automatically calculated enhancements to view the digital image, and these are very useful as an initial analysis of the image.
1) RGB 2) Red (gray) 3) Green 4) Blue 5) Red v Green 6) Red v Blue 7) Green v Blue
1) 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.
2-4) Red, Green, or Blue as shades of gray. A gray shade image of only one of the images primary colors. Gray shade images allow you to examine the intensities of values without biasing your sensitivity to red, green, or blue. If red is being displayed as gray, high intensities appear white, low intensity appear black.
5-7) Red versus Green, Red versus Blue, or Green versus Blue (normalized):
Provides a comparison of the two color intensities. The displayed color is the greater of the two intensities. If equal, the displayed color is black. The difference of the color intensities is divided by the sum of the color intensities.
This provides a way to minimize the effects of shadows and indirect lighting within the image.
For example, suppose Red vs Green (normalized) is selected. 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%).
To select a tool, click on the box directly beneath the red text "Display Tools".
The list of the eight visualizations will be available. Move the cursor to your selection and release. The visualization you have selected will appear in the text of the button and the image will appear in the window.
To see the RGB digital image while viewing a different display, click on the button 'Show Original Window' and a window with the RGB image will appear.
You may drag this image to any position on the computer screen, and you may use the point, line, and area on this image as well as the enhanced image displayed on the larger window.
analysis tools provide color analyses of selected pixels in the image.
Point Tool shows the intensities of red, green, and blue at any pixel.
Click anywhere on the image and the cross hair will show your location. You may click again on a point of interest or you may use the arrows on the right of the picture to move the cross hair. The red, green, and blue components of the color at the point are automatically output, as are colored boxes of matching intensities.
Line Tool shows the average red, green, and blue intensities of pixels
along the selected line.
Click on the image (a blue dot marks the beginning of the line) and drag to a point of interest (a red dot marks the end of the line). You may change the end points of the line may be moved with the small arrows along the right edge of the picture or you may click and drag a new line.
If the pixel size is calibrated, the length of the line is automatically output.
After any calculation, you may save all measurements (point, line, and area) by using the “Save Measurement” option in the File Menu.
Area Tool provides the average red, green, and blue intensities of all pixels
within the selected rectangular area.
Click on the image (a blue dot marks the first corner of the box) and drag to a point of interest (a red dot marks the opposite corner of the box). You may change the end points of the box may be moved with the small arrows along the right edge of the picture or you may click and drag a new box.
If the pixel size is calibrated, the area of the box is automatically output. After any calculation, you may save all measurements (point, line, and area) by using the “Save Measurement” option in the File Menu.
These color outputs from each of the analysis tools are very useful when identifying color differences of the object of interest and its background – this is essential before applying the last of the display tools.
The last option of the display tools is 'Set Range of Colors to Show', which will be called the
for short. This tool allows you to highlight pixels of specific color ranges, and it counts the highlighted pixels and calculates the area represented by these pixels.
You may use any of the display enhancements with the Mask Tool.
To change, click the pop up menu button labeled “Set Range of Colors to Show”
To save time in setting the range of colors, select an analysis tool and click and/or drag on the object of interest in the image. The colors of pixels selected by the tools are automatically input into the Mask
Tool color ranges. Notice there are two ranges you may change – the maximum value and the minimum value of each color. Use the small up and down arrows above and below each graph to change the color range. To see what parts of the image fall within the selected color range, click “Show Colors within
TIP: Consider using only one or two
color components to highlight an object of interest. Either click on the small color bar graph or click on the check boxes next to “Selected”.
Only the colors that are checked will be used to mask the image.
There are two ways to view the highlighted pixels. One is a black and white image, where the black represents the pixels that met the color thresholds.
The second is a color image where true colors represent the pixels within the color limits and inverted or distorted colors show the pixels outside the color ranges. You may also see the image used to create the color “mask”. To change the display, click the pop up menu button in the lower left of the window that is just below the text “Visualization of Matching Pixels”.
Notice the output at the bottom of the image. The percent of highlighted pixels for the entire image is output. If the pixel size is calibrated, the area of the highlighted pixels is calculated. If the line or area analysis tool is in use, additional information about the highlighted pixels in relation with the selected line or area is calculated too.
After you make a color "mask" that has isolated your object of interest, use the
Area Tool to create a box that encloses the object. The area of highlighted pixels within the rectangle you have drawn is calculated.
Voila, the area of the leaf is 9.07 square inches. Try opening the picture several times, calibrate, and see if the area of the leaf changes.
If you are working on maps of the same size and location but representing different periods of time, you will be given the option to keep the calibration of pixel size and even your color thresholds and area or line locations to save time.
You may save any of your measurements to a text file by selecting the 'Save
Measurement' option in the File menu.
Quick Reference Guide for Area Measurements with Digital Images
1) Calibrate pixel size when opening the image a) Known pixel size (image must be smaller than 672 x 587 pixels) b) Scale present in image
Test you calibration by measuring object of known length in image
2) Using the Display Tools, find the best color enhancement that helps isolate the object of interest from surrounding features
3) Using either the line or area analysis tool, select pixels within the object to be measured
4) Select the Mask Tool option from the Display Tools
5) Find the best range of colors that highlight only pixels within the object to be measured. Highlight the pixels within the selected range of colors.
6) Using the Area Tool, draw a box around the highlighted object of interest.