Assess2 Manual
Assess2 Manual
By Lakhdar Lamari
Assess 2.0
Image Analysis Software for Disease Quantification
BY
Lakhdar Lamari
Professor of Plant Pathology
Department of Plant Science
University of Manitoba
Winnipeg, MB, R3T 2N2
Canada
License.
This Program is a Personal User Version unless you purchased the Multi User Version License.
The specific version you purchased is designated on your invoice or packing slip. If you no
longer have your invoice or packing slip and need to identify which license version you
purchased, please contact The American Phytopathological Society. Telephone
+1.651.454.7250; [email protected]; www.apsnet.org. If you wish to read the complete
licensing information, open the file on the program CD-ROM entitled License.txt
ii
To Professor C.C. Bernier, to whom I owe so much
Acknowledgments
The watershed operation in Assess is adapted, by permission, from the implementation of the
watershed algorithm by Wayne Rusband in NIH-Image for the Macintosh computer
(http://rsb.info.nih.gov/nih-image/ ). I am greatly thankful for this permission.
Many thanks to all who tested the current software or sent comments about the original version of
Assess. I wish to thank all those who forwarded pictures of diseases when asking for help with
specific problems. These pictures helped in the design of the Assess 2.0. The development of
software, especially of this nature, relies heavily on input from the users.
The development of Assess 2.0 came at a very critical time. I had hoped to do more on this project
in the past few years. Fate had it otherwise! However, I am quite pleased that the project reached
an important milestone: the era of user-independence in disease measurement! It will be
presumptuous and naïve to think that our problems are over. Assess 2.0, while quite revolutionary
compared to the original version and other commercial packages, does not cover all diseases. It
represents a ‘proof’ of concept and shows that it is possible to dream of an objective solution to
disease quantification. Software packages of the future will have to go beyond Assess before they
are used by pathologists. I hope that the release of this version of Assess will make it unattractive
for software developers in this field to keep beating on old concepts. Automation and objectivity
in disease measurement must become the norm, if we hope to progress!
I am indebted to Ardelle Grieger (University of Manitoba) for proofreading the manual and testing
the software. Also, many thanks to Lorne Adam (U of M) for his thorough testing of both versions
of Assess.
The smooth and pleasant relationship I had (and still have) with APS Press is gratefully
acknowledged. Special thanks to Steve Kronmiller for patiently handling so well my lengthy
technical support e-mails.
This software is dedicated to my wife, Janet Alsip, and my children, Adam and Louise.
iii
Table of Contents
Installation.........................................................................................................................................2
Removal ............................................................................................................................................2
Features .............................................................................................................................................3
I Introduction...........................................................................................................................4
v
XVII. Tutorials ..............................................................................................................................75
Appendix .......................................................................................................................................124
Technical Support
http://www.apsnet.org/press/assess/
vi
System requirements
Operating system
Assess is a 32-bit program and will only run on 32-bit Windows operating systems. It has
been tested on Windows 95, 98, Me, NT, 2000, XP and Vista.
CPU
Pentium 200 or higher is recommended for good performance. However, program speed is
not determined by the CPU alone. Other components play a major role (amount of RAM,
size and speed of hard disk and quality of display card).
RAM
Assess will run on systems with relatively low memory. For computers produced recently
(after 2005), the “standard” memory (512 MB-1 GB), hard disk space (100-200GB) and
display cards (128 MB RAM) are more than adequate to run Assess at a reasonable speed.
Memory becomes critical as you open and process bitmap images. In low-RAM systems,
it is highly recommended that you close all other programs when running Assess. Failure
to do so will force Windows to use the hard disk, making the system unacceptably slow.
Pointing device
A mouse or a Windows-supported pointing device is required. Assess was not designed to
run with the keyboard alone.
Image acquisition
Images must be provided by the user on file (typically on hard disk, CD ROM or memory
sticks). Assess also supports Twain-compliant imaging devices. Virtually all scanners
come with Twain drivers. Some frame grabber manufacturers also supply Twain drivers
for their boards. Pictures from digital cameras can also be used for analysis. When using
digital cameras (or other devices), avoid archiving files using high-compression JPG
formats.
1
Installation
Insert the CD in the CD ROM drive. The installation program should start automatically
and you will be guided through the process. If your CD autorun was disabled or the
installation does not start automatically, go to ‘Start’ at the lower left corner of your
Windows desktop and select ‘Run’. Press on ‘Browse’ and locate the CD ROM drive
where you inserted the CD. Double-click on file ‘Setup.exe’ to select this file and return
to ‘Run’. Click on ‘OK’.
Follow the on-screen instructions. The software must be installed using the installation
program provided on the CD. Do not attempt to install it otherwise.
Removal
Go to ‘Start’, locate and click on Control Panel.
Run the program ‘Add/Remove Programs’.
Select Assess from the list and click on ‘Remove’.
Follow the on-screen instructions (if any). Note that ‘Add/Remove Programs’ will not
remove files created by the user.
2
Features
Simple and rapid measurement of area, percent disease, percent ground cover, lesion count
and root length.
Real-time user interactive tool for area, length and angle measurement.
Image filtering, mirroring, resizing, 90o, 180o and arbitrary angle rotation.
Standard and many nonstandard file formats for reading and writing. Assess can handle
over 60 file formats, including several RAW formats for digital cameras.
Simple macro utility and language to automate tasks and perform batch processing.
Batch conversion to all the file formats supported for writing by Assess (through macro
programming).
Image acquisition from any Twain-compliant device, including scanners, digital cameras
and frame grabbers.
3
I. Introduction
Welcome to Assess, the software for routine disease measurement. Assess was designed
and implemented to help plant pathologists and agronomists quantify plant diseases, while
providing a simple and easy-to-learn user interface. The software is optimized for
measuring leaf area, percent area infected, lesion/pustule count, root length and ground
cover.
What is Assess?
Assess is an application of existing image analysis algorithms to disease measurement. It
is not a general-purpose image analysis software package. There are several commercial
and non commercial packages available for image enhancement and analysis, which are far
more comprehensive, but also far more complex and costly.
The process by which we visually assess diseases may appear to be very simple to the
human brain, but presents several problems when implemented on a machine. The
approach taken in Assess is to reduce the process into basic and meaningful components.
4
interest and ignore it. We would then measure the area of the entire leaf using a
mechanical device, or derive an estimate of the area from simple measurements (length,
width, etc.) by mathematical techniques. We would then process the lesions in a similar
fashion (to get the total area occupied by the lesions). Finally, we would compute the ratio
of lesions to the total leaf area.
2. Implementing a solution: From its inception, Assess was designed and optimized to
handle the difficult issue of quantifying plant diseases, with no a priori knowledge of the
type of disease. Regardless of the disease to be measured, the same basic components need
to be isolated and measured:
The separation of the leaf from the background or the lesions from the leaf requires
that the two components differ in some property, e.g., color or brightness. Assess relies
heavily on the Hue-Saturation-Intensity color model (explained in the Appendix) to enable
the user to effectively extract the leaf from the background and then the lesions from the
leaf. Since we do not know in advance about the specifics of any disease, the user is given
a major role in determining what needs to be measured.
3. The user interface: To reduce the learning curve, the user interface of Assess was
designed specifically to deal with disease quantification and other types of measurements
needed by plant pathologists, agronomists and other agricultural scientists. Many tasks
were combined and presented to the user as action buttons on a specialized control panel
(the Threshold Panel). These action buttons would have required the use of macros, scripts
or programming in other image analysis software packages. With the simplification of the
user interface and customization to make the various tasks almost transparent to the user,
Assess is highly suited for individuals with little or no knowledge of computer science and
image analysis
5
II. Starting Assess
Running Assess
The installation program should have installed the APS Assess icon on your desktop.
Click on the icon to start the program.
If you get the message below when you launch the program, you must set your
display settings at 24 bits (16.7 million colors) with a screen resolution of at least
1024 x 768.
If you are using Windows Vista, select “Personalize” at step 3, and “Display
settings” in step 5 above.
6
The application screen
Tool Bar
Menu Bar
Threshold Panel
Image Window
Application area
Status Bar
When Assess is launched, most of the buttons are initially ‘grayed’. They are inactive until
you open an image.
When you open an image, it will automatically be placed in an ‘image window’. You
can resize, move, minimize or maximize the image window.
You can open multiple images in Assess. However, this practice is not recommended,
particularly in systems with low amounts of memory.
The image window stores all the settings. Do not close it after completing your
measurements/analysis of an image. Just load/acquire your next image into the same
image window. Your settings will be kept.
7
The Menu Bar
File Commands to input, acquire, save and print images. See Chapter IV,
“Working with Images” for details.
Edit Commands to edit images, such as the familiar Cut, Copy, Paste and Crop.
View Commands to zoom in and out (shrink or expand the current image).
Filter Filter commands that can be applied to a color image, prior to measurement.
See Chapter XII, “Filtering” for details.
Macro Commands create, edit, play and record macros. See Chapter XIII, “Macro
utility” for details.
The items in the Menu Bar will be referred to in other chapters. The following standard
referencing convention will be used:
The Menu Bar group heading (e.g., ‘File’) will be used first, followed by a sub-menu item
(e.g. ‘Open’) and in some cases by a sub-sub-menu item. These items are separated by a
vertical bar ‘|’.
8
The Toolbar
The main toolbar consists of the buttons described in the table below. Some of the buttons are
enabled only if an image is open.
9
Button Name Function
Pixel Values Displays pixel values at the location of the
mouse cursor
10
III. The threshold panels
A) The Classic Threshold Panel
Overview:
The Classic Threshold Panel is the most important tool in Assess. It is used to set the
threshold levels, process the segmented image and perform all the measurements. In most
cases, the Threshold Panel is all that is needed to count objects and measure area, percent
area and root length. The Classic Threshold Panel is so called because it was the only
threshold panel available in Assess 1.0. Its functions remain unchanged in recent versions.
However, other threshold panels are now available (see below). The Classic Threshold
Panel is described in the figure below.
1. Slider: Interactive tool to set the low and high threshold values.
2. Setup section: A set of buttons allowing the user to select the ‘Leaf’ or ‘Lesion’overlay,
the color space and the color plane.
3. Processing section: A set of buttons to perform various morphological operations on
the segmented image.
4. Analysis section: A set of buttons to perform measurements on the segmented image.
5. Display section: Edit boxes to report the results of measurements.
Important: Even though the Threshold Panel is critical to Assess, it does not store any
data at all. All the settings, including threshold levels, are kept in the image window.
Do not close the image window after you have completed your analysis. Just load your
next image and reuse your previous settings!
11
1. Slider:
Operation
The default version of the slider is the one with the edit boxes (left figure above).
To change to the version with the spin buttons (right figure above):
The spin buttons allow you to move the slider thumbs by one pixel value for
each mouse click. Use the spin buttons only to fine-tune the positions of the
thumbs.
To set threshold levels for an image, position the mouse cursor on the desired
thumb and drag to the left or to the right. When the mouse button is released, the
program will process the image using the newly set high and low threshold values
and highlight all the pixels selected.
b) Thumb color:
In the default configuration, the thumb color will change with its position
along the middle track. Each thumb will pick up the color of the track at the
position to which it has been dragged. In other words, the colors of the
12
thumbs represent the threshold values (i.e., [red to yellow], [green to
purple], [dark to light] etc.).
The slider is programmed to prevent the user from setting the position
of the lower thumb higher than that of the upper thumb. However,
there is one exception: when the HSI color space and the ‘Hue’ color plane
are selected, the lower thumb is allowed to be dragged past the upper
thumb. This way, one can select hues of 0 and 255 (simultaneously),
without selecting any value in-between. This ‘wrap-around’ is due to the
mathematical definition of hue as an angle (angles of 0 and 360Ε have
similar trigonometric properties) (see appendix p. 125). The slider will
automatically configure itself to allow the user to select any range of hue
with the following rules:
a) Lower thumb position smaller than the upper thumb position: The
range of hues selected is the normal one: [low... high].
Example:
Lower thumb value = 10
Upper thumb value = 240
Range selected = [10, 11, 12,..., 240]
Range excluded = [0, 1, 2,...,9] + [241, 242, 243,... 255]
13
2. Setup section:
Leaf/Lesion button:
This button will select either the ‘Leaf’ or the ‘Lesion’. Each time it is
pressed, the caption changes indicating whether it is set on ‘Leaf’ or
‘Lesion’. This button is used in disease quantification only. If you get
percent area (percent disease) values greater than 100% (!), it is likely that
you have set threshold values for lesions when the button was set on ‘leaf’
or vice versa.
This button toggles between two color models: HSI and RGB. Unless you have
a special reason for using the RGB model, this button should be kept on ‘HSI’.
The value displayed on the color space button automatically sets the names for the color
planes. R, G and B (red, green and blue) are used with the RGB color space. H, S and I
(hue, saturation and intensity) are used with the HSI color space. Click on one radio button
to select the color plane you want to use. In analysis of foliar diseases, the most useful color
plane is Hue, which is the default color plane in Assess. However, there are instances when
other color planes are more effective for analysis. See Tutorials 6, 10 and 13 for more.
3. Processing section:
14
Filtering drop-down list box:
This feature allows the user to select a filtering action to be performed following a
thresholding operation. There are four options:
1. No filtering: Thresholding is not followed by any filtering operation.
2. Open (Erode/Dilate): Binary erosion followed by a binary dilation. This operation will
eliminate isolated pixels in the segmented image.
3. Close (Dilate/Erode): Binary dilation followed by binary erosion (the opposite of
‘Open’). This operation is used to close small holes in the selected objects.
4. Smooth (Median): Median filter (default option).
Assess will automatically process the image with whatever option is selected. The median
filter smoothes the contours of the selected objects, removes any isolated pixels and closes
small holes. A smoothing operation is recommended and sometimes required (automatic
separation of touching objects).
Toggle: Pressing on this button will hide and show the overlay. Toggling
the overlay a few times will allow the user to check if the objects have
been correctly detected. Make sure that the overlay is not turned off after
you have finished toggling. You can check the state of the overlay on the
main toolbar (it should indicate Ovl ON or Ovl OFF).
Outline: Outlines all the selected objects on the overlay. This has essentially the same
function as the Toggle button. The user will use this feature to check if the lesions (or
objects of interest) have been correctly detected.
Smooth: Applies a median filter. This operation consists in visiting each pixel, getting
all the neighboring pixels, sorting them based on their value and assigning the median
value to the pixel being visited. Understandably, this is a computer-intensive operation.
The result of a median filter is a ‘smoothing’, as isolated pixels are converted to
background (i.e., disappear) and small holes filled. Jagged lines tend to appear less jagged.
A pseudo-median filter is actually used in Assess to process the overlay in conjunction
15
with the Threshold Panel, as we are dealing with a binary image. The pseudo-median
achieves the same results and is much faster than the true median filter.
Erode: Performs one erosion on the selected objects on the overlay. Erosion converts
object pixels touching the background into background pixels. The result is that the
objects will shrink by a one-pixel-thick layer. Pixels that are isolated disappear.
Dilate: Does the opposite of ‘Erode’. A dilation consists in converting background pixels
adjacent to object pixels into object pixels. The objects will, therefore, grow by a one-
pixel-thick layer. Small holes are filled.
Open: Performs one erosion followed by one dilation. The erosion will eliminate
isolated pixels but also shrink objects. The objects are ‘grown’ back to their original size
by the dilation.
Close blob: Performs one dilation followed by one erosion. The effect is opposite that
of the ‘Open’ operation.
4. Measurement section:
Before using any of the buttons shown on the left (green box), you must
ensure that the threshold levels have been set.
Area: Used to measure the area of the objects detected in the area of interest
(AOI) by a previous thresholding operation. Note that the measurement
performed corresponds to what is displayed on the overlay; this may be
‘Leaf’or ‘Lesion’. The result is reported in the corresponding edit box at the
bottom of the Threshold Panel (see the description of the Display section).
Note: Before using the “Area” button, make sure there is something
to measure on the overlay. This command will not threshold the
image automatically.
% Area: Used to estimate disease severity. The user would have set the threshold values
for ‘Leaf’ and for ‘Lesion’. When you click on this button, Assess will measure the leaf
area and the lesion area and compute the percent area infected [% area = (lesion area / leaf
area)*100]. The result is expressed as a percentage and reported in the edit box labeled
‘Percent=. Leaf and lesion areas are also reported in the corresponding edit boxes.
Note: You don’t need to threshold the image before using this command. However,
you must set the threshold levels for both leaf and lesion before using the ‘% Area’
button.
Count: All blobs on the overlay (from a previous threshold operation) will be counted,
labeled and redrawn with arbitrary colors for visibility. To extract features, such as area,
perimeter, major axes, average colors etc., you must select them prior to counting, by
16
using the ‘Options’ button. These features are written to the spreadsheet, if it is activated.
Root L: Assess can be used to measure plant root length. When this button is pressed,
the program will perform a ‘skeletonization’ operation, followed by root length
measurement. The process of skeletonization consists in reducing the roots to a single
pixel in width. If the spreadsheet is activated when the button is pressed, the result is
written to the spreadsheet.
5. Display section:
This section consists of four edit boxes. Results of measurement operations are displayed
in these boxes.
Apply: This button allows the user to apply the values displayed on the Threshold Panel
to segment the image. This is useful when a new image is opened in the current window
or if the overlay was cleared by the user.
(Clear) Ovl: This button clears the overlay, without destroying it. Since the
overlay is transparent, it becomes invisible until the next threshold operation.
Spreadsheet: Check this box if you want the data generated by the four measurement
operations (Area, %Area, Count and Root L) to be written to the spreadsheet.
Options: This button opens a dialog box to allow you to select several features to be
extracted. These features are descriptors of each of the objects detected by the count
operation. The features available are described in Chapter X and used in Tutorial 11.
‘Options’ is used mostly in conjunction with the ‘Count’ procedure.
17
B. The Automatic Threshold Panel
The Automatic Panel, as the name suggests, enables the user to compute the percentage
infection with one mouse click. The buttons with the same names as in the Classic
Threshold Panel have the same functions. They will not be re-described here.
1. Enhance image
1. Enhance Image: Calls the Enhance Image windows. The user can change the
brightness, contrast and saturation of the image. It is the same call as the one in the
Main Menu Bar (‘Image|Enhance Image’).
18
3. Detail (automatic): This feature requires the adherence to the same restrictions as the
ones described above, as far as the type of disease, background and quality of the
pictures are concerned. The ‘Detail’ button enables the user to measure disease for
each leaf on the screen and report the results for each individual leaf. This feature is
extremely useful, as it save considerable time. As long as the leaves are not touching,
one click will 1) set the threshold levels for the image, 2) detect each leaf and 3)
measure and record the % infection for each leaf. The leaves (seen in the figure below)
are labeled and colorized differently for visibility. The results are shown the bottom
part of the threshold panel as a scrollable list.
4. Manual: After the use of the automatic feature, the threshold levels will be set by
Assess. These can be seen on the slider. The user may decide to change them a bit by
adjusting the slider as in the Classic Threshold Panel. To measure the percent infection
after the adjustment, use this button (i.e., not the % Area button).
19
6. Show Manual (Threshold) Panel: Calls the Manual Panel and hides the Automatic
Panel.
1. Detail button: This feature allows the user to measure percent infection for individual
leaves. It assumes that the threshold levels were set for leaf and lesions. This feature
is identical to the one described for the Automatic Panel, except that it requires that the
user hand set the leaf and lesion threshold levels (i.e., user-dependent).
2. Show Automatic (Threshold) Panel: Calls the Automatic Panel and hides the Manual
Panel.
20
D) The Agronomist Threshold Panel
The Agronomist is almost a clone of the Classic Panel, described above. Labels were
changed to make the panel more specific to the task.
1. GC-user: The user will set the threshold levels first, then click on GC-user to compute
the ground cover (function similar to %Area in the Classic Panel).
2. GC-Auto: Computes the ground cover without user intervention on the threshold panel
or the slider. It assumes that the ground is brown-red-yellow and the plants are green.
The user must be aware that wet soils with green coloration (algae, moss etc.) are not
suitable for user-independent measurements. As always, check your results!
21
IV. Working with images: Some basics
A. Loading images
Assess provides three ways of loading an image: 1) an enhanced standard ‘Open’ dialog
box, such as those found in many Windows programs, 2) drag-and-drop operations from
Windows Explorer and 3) drag-and-drop operations from other applications.
• Select the directory containing the desired image files using Windows
Explorer.
22
• Select the file (or files) you want to open.
• Locate the mouse cursor on the selection.
• Hold down the left mouse button.
• Drag the mouse cursor to the Application Area of Assess.
• Release the mouse button.
You may drag only one file into an already opened image window. The
image window will keep all the previous settings (threshold levels, color
space, color plane etc.). This is useful if you are working with images that
have similar color characteristics.
Assess can import bitmap images using the drag-and-drop method available in
some commercial, off-the-shelf software applications. The exporting application
must support drag-and-drop operations.
From the exporting application, locate your mouse cursor on the image (or
a selection in the image), press and hold down the left button and drag the
mouse cursor into an already open image window in Assess. The dragged
image will replace the current one. If you want to place the image into a
new window, drop it anywhere on the Main Toolbar.
Assess will capture images from video cameras or digital movies (on file) if Video for
Windows is installed. To open a movie, go to ‘File’ in the Menu Bar and select ‘Open
Movie/Multimedia’. The Video Capture dialog box, shown below, will open.
To output images from a video camera, live in Assess, the camera must first be selected.
To view the video, click on the ‘Video’ tab and then on ‘Video Camera On’. You can
also configure the output of the camera in terms of resolution of the incoming images.
Once the video images start showing on your screen (in Assess), you can click on
‘Capture’ to freeze one frame, just as you would do with a playing video file (described
below).
23
How to load a movie from the Video Capture dialog box
Click on the ‘Open’ button, select a file and double-click on it. When the file is
loaded, the VCR-like play button will turn green.
Capturing a frame:
1. Set the speed using the track bar labeled ‘Frame speed’.
2. While the movie is playing, click on the ‘Capture’ button to freeze a frame.
3. The captured image is transferred to the image frame on the right.
4. Click ‘OK’ to go back to the main program.
24
C. Acquiring images from imaging hardware
Important: Before you attempt to acquire an image, make sure that you have
installed and successfully tested your hardware and software.
1a. You have more than one Twain device in your system:
Go to ‘File|Select source’. Assess will list all the devices registered in your
computer. Select (double-click on) the device you wish to use and return to the
main program.
2. Acquire image
Press F4 to acquire an image. This step can also be executed from ‘File|Acquire
image’ or by clicking on the ‘Acquire image’ button on the Toolbar (shown
above).
When the acquire command is issued, Assess will call the manufacturer’s Twain
interface for the device. Different manufacturers supply different interfaces.
However, there are some features which are common to most:
o Set scanning resolution: Depending on the type of information you need, the
resolution may vary.
Counting small objects: If the objects to be counted are too small, higher
resolutions may be needed (300-600 dpi); the area scanned should be reduced,
as the files generated with high resolution can be excessively large.
25
Even though Assess will handle large bitmaps, image files should not be
larger than 13-15 MB (2200x2200), as images are kept in memory for rapid
analysis. Assess requires an amount of memory approximately three times
the size of the opened image to operate smoothly. For this reason, the user
should also refrain from opening multiple large images or run other programs
concurrently with Assess.
Preview the image: Ideally, you should preview a scanned image and select
the area to capture. Since bitmap files tend to be large, there is no need to
acquire parts of a scene that are not going to be used in your measurements.
o Acquire the image: The command names are different depending on the
manufacturer. These may be ‘Final’, ‘Scan’, ’Capture’, ‘Finish’ etc. Check the
documentation supplied with your imaging device.
o Assess comes with its own user interface (figure below). It is recommended to
use it (if it works for you), as Assess will use the information to automatically
calibrate the system, saving you time. Should Assess’s Twain interface fail to
operate correctly, check the ‘Use manufacturer’s interface’ box under the
‘Options’ of the Twain dialog box; this will call the manufacturer’s interface. If
you want to use the manufacturer’s interface all the time, enable it from ‘File|Use
Manufacturer’s Interface’. Assess will remember the setting until you change
it again.
26
If you do not see the above Assess’s interface when you call the scanner, then the
manufacturer’s interface is enabled in the ‘File’ menu (‘File|Use
Manufacturer’s Interface’). Disable this feature (uncheck it) and call the scanner
again.
Note: Always set the color resolution to 24 bits (True Color, Millions of Colors
etc.). Turn off any sharpening filters; they are good for image display, but
introduce unwanted noise.
Video cameras and frame grabbers: These are generally very fast (real-time)
devices. However, their resolution is much lower than that of scanners. They are
excellent for small objects (seeds, small leaves). The most common resolution (at
24 bits) is 640 x 480 pixels for frame grabbers. The small image size makes the
analysis almost real-time (even on old Pentium machines).
Digital cameras: They can be used with Assess via their Twain interfaces, as ‘cut-
and-paste’ or by other means. There is a heavy use of JPEG formats (.JPG
or .JPEG) in digital cameras for obvious storage space considerations. JPEG uses
lossy compression to achieve its significant file size reduction. This format is
acceptable for viewing and e-mailing images, but should be avoided for analysis,
as it produces artifacts, most noticeable in the hue component of HSI, the color
space most used by Assess.
27
V. Working with the Area of Interest (AOI)
What is the Area of Interest?
When only a portion of the picture is needed for analysis, the user may select a specific
area of the image for analysis. This region is called the ‘Area of Interest’, or AOI. All
filtering and measurement operations are restricted to the AOI.
1 2 3
1: Rectangular AOI
2: Freehand AOI
3: Leaf AOI
Assess supports three types of AOI, which can be selected from the Toolbar: 1)
Rectangular AOI, 2) Freehand AOI (a user-drawn curve of arbitrary shape) and 3) Leaf
AOI (the surface of the leaf is the AOI).
1. Rectangular AOI:
Rectangular AOI is commonly used in image analysis and graphics programs. Assess
defaults to this type of AOI. To select this feature press the button on the Toolbar labeled
with a rectangle and 8 small aqua-colored boxes as shown above. A rectangular shape,
28
similar to the one on the button face, should become visible on the image, if it is not already
active. A second click on the button will hide the rectangular selection tool. Even though
the selection tool may be hidden, this feature will still be set (until another type of AOI is
selected). All the processing and measurements are confined to the area contained within
the selection rectangle.
Setting the Rectangular AOI: Move the mouse cursor to the desired location on the
image, hold down the left mouse button and drag the mouse to draw a rectangle as you
would with any Windows program. Once the Rectangular AOI tool is visible on the image
(see the figure below), simply resize it or drag it to any region of the image. The AOI will
automatically be set to the size and position of the selection rectangle.
Note: You cannot draw inside the AOI when the Rectangular AOI tool is active.
You can draw on the image when the mouse cursor appears as a cross. If the cursor
is located inside an active selection tool, it appears as a pointing hand, as shown on
icon on the left. If the cursor appears as an arrow, the overlay is off. Enable the
overlay from the Threshold Panel, using the ‘Toggle’ button, or, the Toolbar (Ovl
ON/Ovl OFF button).
Resizing the rectangular selection tool: Place the mouse cursor on one of the
eight control points (little aqua-colored squares on the corners and sides of the
selection rectangle). The cursor changes into a double arrow. Hold the left mouse
button down and drag the mouse to resize the selection.
Repositioning the rectangular selection tool: Place the mouse cursor inside the
rectangle. The cursor changes into a pointing hand. Hold the left mouse button
down and drag. The selection rectangle moves as you move the mouse.
29
Resetting the AOI: To select the entire bitmap as an AOI, simply click on the
reset button on the Toolbar. This button is labeled with a red rectangle (shown
above).
30
‘Show size of Area of Interest (AOI)’: Displays the size of the AOI, as it is
being resized. If calibration was previously performed, the size of the AOI
will be displayed in physical units. The default unit is the pixel.
‘Cut’: Cuts the area inside the AOI to the Windows clipboard. Other
Windows programs can paste it.
‘Copy’: Copies the area inside the AOI to the Windows clipboard.
‘Paste’: Copies the contents of the Windows clipboard into the current
image, starting at the top left corner of the AOI.
‘Crop’: The image will be cropped to the size of the AOI. All the threshold
values are kept. The original image is deleted from memory and replaced
with the new image. The window holding the original image is resized to
reflect the size of the new image. You can ‘undo’ the cropping operation, if it
was the last operation you performed on the image.
‘Make new bitmap from AOI’: Clones the AOI and creates a new image.
Threshold values are not transferred. The original image window remains on
the desktop.
There are instances when it is practical to change the background color into
a color that does not occur in the leaf or lesions, thereby simplifying any
subsequent threshold operations of the leaf and lesions.
‘Substitute Object Color’: Replaces all the pixels in the selected object by
a user-selected color (the default color is blue). This is exactly as described
above under “Substitute Background”, except that only the areas that are
highlighted (selected) are converted.
31
2. Freehand AOI: (Freehand AOI button on the Toolbar)
To select an area of interest of arbitrary shape, click on the ‘Freehand AOI’ button on the
Toolbar, go to the image and draw a curve of any shape. When you finish drawing (by
releasing the left mouse button), you will see that the shape you have drawn is filled in.
As long as the Freehand AOI option is selected, the area inside the user drawn shape will
serve as the AOI. You can draw a new Freehand AOI at any time during a session. To
view/hide the contours of the freehand area of interest, click on the ‘Freehand AOI’
button on the Toolbar.
32
Each time you threshold the leaf, a mask is created automatically, stored in memory and
used to restrict all subsequent processing of the lesions to this surface. Used properly, this
feature ensures that no noise is picked up from the background (assuming that the detected
leaf surface does not extend to the background) and that percent disease is never greater
than 100%. This is true even if the threshold levels for the lesions are set to the maximum.
See Tutorial 5 for an example.
To open the dialog box above, click on ‘Calibrate’ on any threshold panel. You can also
open the dialog box from the Main Menu Bar (“Tools|Calibrate”). Assess will
automatically take you to the dialog box shown above. Enter the resolution and click on
the button labeled ‘Calibrate with dpi info’. The number you enter (300 in the example
above) indicates that the scanning resolution is (was) 300 dots-per-inch. If the value you
33
entered is in any other unit, you must first convert it to dpi. Assess 2.0 allows you to
select a unit of measurement. Unlike the original version, Assess 2.0 will convert
between units. The conversion between units is independent of the calibration process.
You may open the dialog box to just change the unit of measurement, without
re-calibrating the system (assuming it was calibrated earlier).
Purpose: To compute conversion factors from pixels to actual physical units in the
X and Y dimensions.
What is needed:
A surface of known size is needed to serve as a reference. A sheet of graph
paper scanned at the same resolution as the objects you intend to measure
can be used with flatbed scanners. For microscopy (video camera attached
to frame grabbers, digital cameras), the image of a haemocytometer may
provide a good reference for calibration.
Accessing the ‘Calibration’ tab sheet of the ‘Measurement defaults’ dialog box:
The dialog box (shown above) can be opened from the Threshold Panel by
clicking on the ‘Calibrate’ button or by selecting ‘Calibrate’ found under
‘Tools’ in the Menu Bar.
2. Draw a rectangular AOI of known size. Use a large area and be as accurate
as possible.
4. Input the actual size of the width and the height of the rectangular AOI into
the edit boxes labelled ‘Horizontal’ and ‘Vertical’, respectively. To input
the horizontal and vertical values, click on the ‘Horizontal’ and ‘Vertical’
labels. You will be directed to the corresponding edit box, where you will
enter the physical measurement.
34
Very important: For proper calibration, you must provide both horizontal and vertical
values for the rectangle used in the calibration process. However, Assess will allow you to
calibrate a single side (X or Y), but makes the assumption that the side for which the
physical value is missing is similar to the one for which the value is provided (i.e., assigns
the same calibration value to both sides). This is highly discouraged, as only the side for
which a physical value was provided will be calibrated properly.
1. Press the ‘Calibrate’ button found on the ‘Measurement defaults’ dialog box.
2. Press OK to accept the new setting and exit the form.
1. Click on the ‘Load Calibration File’ button (top left), select a previously saved
calibration file (*.cal) and double click on it.
2. Press OK to exit the dialog box.
Click on the ‘Save Calibration File’ button (next to the ‘Load Calibration
File’ button). Select a directory, enter the new calibration file name
(without extension) and click on ‘Save’.
Note 1: The calibration values are used throughout the system to convert
measurements from pixels into physical values. If the images you are
analyzing have different scanning resolutions, you must calibrate the
system each time the resolution changes. In general, any time you suspect
the resolution has changed, you should perform a new calibration. This is
particularly true for video and digital cameras, as their vertical position on
a copy stand could be easily changed. Flatbed scanners are much more
reliable.
Note 2: The calibration values are saved in the same file as the feature extraction
options and will load together. Always check that you have the proper
values in both the ‘Scanner Calibration’ and the ‘Feature extraction
options’ pages.
35
D) Unit of measurement
The default measurement unit is the pixel (system not calibrated). Before or after
calibration (preferably before), the user must select a physical unit. Unlike the original
version, however, the calibration values are converted automatically when the user
changes physical units. For example, if you calibrated your system in inches and later
decided to view your measurements in centimeters, all you have to do is click on
‘Calibrate’ on any threshold panel; select the new unit (under ‘Unit of measurement’),
press ‘OK’ and exit. You no longer have to recalibrate a previously calibrated system.
36
VII. The spreadsheet
Introduction
The spreadsheet in Assess has many functions and behaviors similar to those of Excel, but
these are not described in this document, and no technical support will be available on
spreadsheet use and/or programming.
There are three submenus (‘File’, ‘Edit’ and ‘Window’), which are duplicated in the
‘Spreadsheet Toolbar’ described below, except for ‘File|Page Setup’, which enables the
user to configure the spreadsheet for printing and a few self-explanatory items
(‘Edit|Insert row’, ‘Edit|Insert column’ etc.).
37
The Spreadsheet Toolbar:
Stay on top: When this option is checked, the spreadsheet remains on top (i.e.
does not disappear behind other dialog boxes or image windows).
Enable writing: When this option is checked, data from Assess will be automatically
recorded on the spreadsheet.
38
Locating a specific object in the image using its record in the spreadsheet:
• Make sure you have enabled writing to the spreadsheet and counted some
objects.
• Bring the spreadsheet to the front; locate the mouse cursor in the row
containing the record of the desired object, and click on any cell in that row.
• Go to the image (move the spreadsheet or other forms out the way), and you
should see crosshairs at the origin of the object (top left corner of the object).
The spreadsheet in Assess supports the formats listed below and shown in the figure under this
heading. Click on the drop-down window labeled ‘Save as type’ to select a file format.
39
VIII. Measurement
Overview
Once an image has been loaded or acquired from an imaging device, the Threshold Panel
is used to identify objects for measurement. It is desirable that the noise in the image be
kept to a minimum and that the objects to be identified and measured be clearly visible and
large enough not to be treated as noise.
1. Background: The background must be white or blue and very uniform. For this
reason, a scanner will always be superior to a digital camera. The white cover of a
scanner is quite acceptable, as long as it is clean. For blue backgrounds, use a blue
sheet of paper (or a piece of blue poster board with no patterns).
2. Leaf: The leaf must be green for the algorithm to work properly. Fortunately, most
plants have green leaves! The algorithm will not work with plants such as red/purple
cabbage (wrong leaf color)!
3. Lesions: The lesions must be red-brown-purple-yellow of any shade. Lesions must not
be blue, green or white. Again, this color range covers the majority of diseases. These
include most leaf-spotting diseases, rusts (caused by basidiomycetes) and anything
similar. Diseases not covered by the algorithm include powdery mildews, white rust
(caused by oomycetes) and the like (wrong lesion/pustule/colony color). The diseases
not covered by the automatic feature can still be measured using the manual features of
Assess (e.g., the Classic or the Manual Panel)
40
The mechanics of measurement in Assess (manual threshold)
The process of going from an image to measurement results is very simple using
Assess. There are essentially two actions: thresholding the image to select the
objects to be measured and measuring the objects. Following are the steps
involved in the process. Please note that the automatic measurement of disease is
identical to the process described below, except that decisions to set the threshold
levels (segment the image) are mathematically based (user-independent):
1. Select ‘Leaf’ or ‘Lesion’ in the Threshold Panel, depending on what you are
about to threshold.
2. Select the color space to be used (RGB or HSI). In most cases HSI will be
the option of choice.
3. Select the color plane to be used to identify the objects of interest. For
disease measurement, ‘Hue’ is often the best. However, depending on the
image, other color planes may give better results.
4. Using the slider on the Threshold Panel, set the ‘low’ and the ‘high’
threshold levels by dragging the upper and lower thumbs, until the objects
you want to measure are accurately highlighted. The best analogy to this
operation is a coloring book, where the outline of objects is provided and
the user ‘fills in’. As the slider thumbs are moved, Assess will fill in areas
that have pixel values within the range specified between the two thumbs.
The ‘Outline’ and/or ‘Toggle’ buttons can be used to help fine-tune the
threshold levels.
5. Measurement: Once the threshold levels are set, the process is complete.
Just click on one of the four measurements provided by Assess (area,
percent area, and count or root length).
6. Note that steps 1 and 2 are generally performed only once during a session.
In disease measurement, most activity is on the slider to set the threshold
levels. It is very important that these are set properly for each image.
41
of the R, G, B of the RGB color space or the Intensity color plane of the HSI color
space. The use of R, G, and B will yield identical results, as they are equal by
definition.
In most cases the Hue-Saturation-Intensity (HSI) color space is the one to use. The
advantage of this color space in analysis of color images resides in the fact that the
three components (H, S, I) are independent, as opposed to RGB, where the R, G and
B components are not independent. Furthermore, the HSI model is more intuitive
and corresponds to our understanding of color.
True color pixels (24 bits) consist of three components, each with 256 possible
values (8 bits). These components are R, G, B in the RGB color space and H, S, I
in the HSI color space. Think of a color plane as a two-dimensional matrix that
holds one component only (i.e., all the red values of an image are together, all the
blue values are together etc.). In fact Assess uses six of these planes (R, G, B and
H, S, I). When you select a color plane in the Threshold Panel, you are in fact
setting a pointer to one of these matrices (they are actually not organized separately,
but they are accessed as if they were). In order to speed up the analysis, we look at
one plane at a time. Since a single component can have at most 256 values,
computing is much faster and the meaning easier to grasp than if we were dealing
with 16.7 million values at once. For example, an intensity of 128 represents the
middle gray and is situated halfway between pure white and pure black. Try to
imagine or understand what a value of 15,893,437 means!
The Hue component represents ‘pure colors’ and is very effective in separating
different-colored objects (green vs. red, for example). In disease measurement,
we are interested in 1) separating the entire leaf from the background and then 2)
separating the lesions from the leaf. If precautions were taken to use a background
color different from those of the leaf and lesions, using Hue will make it very easy
and rapid to threshold images and perform measurements.
42
When to use ‘Intensity’:
Intensity is the only color plane in the HSI color space to use for analysis of
black-and-white images!
43
How to optimize images for measurement:
There are no special requirements for sample preparation prior to
measurement with Assess. However, you can significantly improve the time
you spend setting up threshold levels, if you take some simple actions prior
to acquiring your images.
1. Background color:
Before taking pictures (scanning or otherwise), select a background color
that does not occur in your sample. Since the whole process consists of
separating the background from the objects of interest, it makes sense to put
the odds in your favour by selecting a background color different from the
objects.
• Scanner: Cover the leaf samples with a blue cardboard prior to
scanning (assuming you are working with leaves).
2. Hardware setup:
Color analysis: If you intend to characterize objects for color, turn off the
automatic features of the camera if possible. Adjust the lighting manually,
and avoid using the automatic gain control of the camera. This feature may
introduce noise into the image, when the camera tries to compensate for low
light. Incandescent bulbs are preferable to fluorescent tubes (with video
cameras). These suggestions are meant to provide greater control over the
acquisition process and to reduce ‘random’ conditions created by the
camera’s electronics.
3. Hardware quality:
The quality of the hardware used to acquire images is very critical. For
color analysis (such as used in disease measurement), the colors should be
balanced as much as possible. The green of the leaf should look green and
not bluish green, for example. Sometimes, a proper setup of the hardware
and appropriate lighting (video and digital cameras) is all that is needed.
44
IX. The image histogram
The image histogram is an additional tool to help you decide which color
space/color plane to use in separating the leaf from the background and the lesions
from the leaf. In fact the thresholding and measurements operations in Assess are
based on the image histogram.
45
displayed. Typically, you will move the track bar thumb slowly (or use the
keyboard) until you see the peaks you are interested in. These multiple
peaks may or may not be present. Also, their presence may or may not
correspond to an object of interest. In the figure shown below, the three
peaks correspond to three objects of interest (lesions, healthy tissue and
background).
The spin buttons on the left and right of the histogram box:
You can use these buttons to fine-tune the threshold levels. The buttons on
the left control the low threshold level and the ones on the right the high
threshold level.
46
represents and controls the threshold levels. The left and right sides of the
rectangle correspond, respectively, to the low and high threshold levels.
Their positions on the X axis are exactly the same as those of the thumbs on
the slider in the Threshold Panel, when the ‘Link to Threshold Panel’ check
box is checked.
‘Apply’ button:
Click on the ‘Apply’ button after using the spin buttons. The positions of
the left and right sides of the rectangular tool are communicated to the
Threshold Panel, and the image is thresholded with the new values.
Popup menu:
To zoom in or out the histogram, right-click anywhere on the Histogram
dialog box and select a magnification factor.
47
X. Feature extraction
The features shown below and described in detail in the next table are available in the
‘Count’ operation only. It is assumed that threshold levels have been set and objects
identified on the overlay.
In addition to feature selection, you can also set up how counting is performed:
• ‘Accept edge-touching objects’ check box: When checked, objects touching the
edge of the rectangular AOI will be accepted (measured). Generally, you would
reject objects that are touching the edge, as they may represent only portions of
the real objects you are interested in.
• ‘Label objects’ check box: At the end of the ‘Count’ operation, Assess will label
each object if this check box is set. If you have many objects on the screen (100s
or 1000s) you may want to turn-off labeling, as the screen may become very
crowded. Generally, this option is kept on.
48
• ‘Show axis’ check box: When this option is on, Assess will draw the long axis
of each object (even if this option is not selected for extraction).
• ‘Separate objects’ check box: Check this box if you want Assess to separate
the objects automatically, before the counting process starts. You can do the
same thing manually from the Threshold Panel. However, you will have to
remember to do it. Use this option if the objects you are measuring are
touching each other (not overlapping).
• Exclude objects
o ‘Less than’: Enter the smallest size of an object (in pixels) to be
accepted. Any object of a smaller size will be rejected.
o ‘Greater than’: Enter the size of the largest object (in pixels) to be
accepted. Anything larger will be rejected.
Feature Description
Origin x,y coordinates of the topmost left pixel of the object (in pixels).
x,y coordinates of ‘center of gravity’ of the object, computed from
Centroid the object boundary as X= Σxi/n and Y = Σyi/n, where n = number
of edge pixels.
Area of the object highlighted on screen. Area of holes inside the
Area without holes
boundary is not counted.
Total area of object computed from boundary pixels coordinates by
Area with holes integration. Holes inside the boundary are included and measured
as part of the object. Total Area = ½Σ(xiyi+1-xi+1yi ), where x,y are
(total area)
the coordinates of boundary pixels. Total area is then corrected for
pixels located under the object’s contour.
Number of edge pixels The number pixels on the boundary of the object.
The average ‘darkness’ of an object. The higher the value, the
darker the object. Computed as I.D. = (Σ (255-i)*ni)/N, where i is
Integrated density the intensity class (from 0 to 255), ni the number of pixels in class
i, and N the total number of pixels in the object, defined as N =Σni.
Note that this feature is not an OD (optical density).
49
Perimeter The length of the boundary of the object, adjusted for aspect ratio.
Length The longest axis of the object (length of bounding rectangle).
Width The greatest width of the object (width of bounding rectangle).
Width at centroid The width of the object passing through the centroid
Elongation The ratio of Length to Width, always greater than or equal to 1.
Describes how circular the object is. Computed as
Roundness = Sqr(Perimeter)/(4*Area), where ‘Area’ is the total
Roundness
area of the object. A value close to 1 indicates that the object is
nearly circular.
Difference between x coordinates of the centroid and the center of
X symmetry bounding box. A value of or close to 0 indicates symmetry relative
to the x axis.
Difference between y coordinates of the centroid and the center of
Y symmetry bounding box. A value of or close to 0 indicates symmetry relative
to the y axis.
Arithmetic mean of the Red, Green and Blue values of the object.
Average R is computed by adding all the R values of an object and
Average R,G,B
dividing by the total number of pixels. Averages of G and B values
are computed in a similar manner.
The mode of the Red, Green and Blue distributions of the object.
Mode R,G,B Represents the most prominent value. The mode is the class with
the largest number of pixels.
Arithmetic mean of Hue, Saturation and Intensity of the object.
Average H,S,I Computed as in ‘Average R, G, B’. Note: This will return an
integer value.
Like R, G, B mode, but computed from H,S,I histograms. The
Mode H,S,I mode statistic may be a better descriptor than the arithmetic mean
in some cases (hue, for example).
Same as AVG H,S,I but for HSV color space. Note: This will
Average H,S,V
return an integer value.
Mode H,S,V Same as H,S,I mode but computed for HSV color space.
50
The average value of each of the CIE L, a and b components. Note:
Average CIE L,a,b
This will return an integer value.
The mode for each of the L, a and b components. Note: This will
Mode CIE L,a,b return an integer value.
51
XI. The Digital Ruler
Click on the ‘Digital Ruler’ button on the Toolbar. A dialog box will be displayed as
shown below:
1. Click on the buttons at the top left of the dialog box to select an option (line, rectangle,
horizontal line, vertical line, freehand drawing).
Save to spreadsheet
2. Position the mouse cursor on the boundary of the object you want to measure, hold down
the left mouse button, and move the mouse. As the mouse moves, Assess will compute, in
real time, the length and angle (from the horizontal) of the line or the area of the rectangle.
These data are not sent to the spreadsheet. The user must copy them manually. The unit
area is given in both pixels and physical units, if the system was previously calibrated.
3. When done, you must close the dialog box by clicking on the ‘Digital Ruler’ button
on the Toolbar or on the [x] in the upper right corner of the dialog box. You cannot use the
AOI when this feature is enabled. See Tutorial 8.
52
The features of the digital ruler are described below.
Button Description
Freehand drawing. The curve is closed when the user releases the mouse.
Returns the length of the curve (perimeter) and area enclosed by the curve.
53
XII. Filtering
The filtering operations listed below work on the original RGB image only. Only the AOI
is processed. The effects of these filters can be undone from ‘Edit|Undo’.
The filters are included for convenience only. In most cases they are not needed for image
measurement. Some of them (High Pass, Emboss, Laplacian, Sobel, Sharpen, Negative)
should never be used on images that are meant for measurement. They have unwanted
effects which interfere with image segmentation (thresholding).
Filters:
Note: Except for the Median Filter, all the filtering operations listed
below are convolutions and use specific kernels (two-dimensional
matrices) to achieve their respective effects.
5. High Pass: Enhances ‘high energy’ pixels in an image (similar to but not identical
to sharpening) .
6. Low Pass: Removes ‘high energy’ pixels from an image (similar to but not
identical to blurring).
8. Emboss (NW, NE, West): ‘Cosmetic’ filters. These non standard filters produce
a pseudo-3D effect.
9. General Convolution
54
10. Median Filter: Performs a median filter on the original RGB image. This filter
removes some noise and has a smoothing effect. See the description of the median
filter in Chapter III, ‘The Threshold Panels’.
11. User 3x3: This is the kernel designed under ‘General Convolution|3x3', or
loaded through ‘General Convolution|File’. You can now use it with any
subsequent images.
12. User 5x5: Same as ‘User 3x3’ above, except that the kernel is 5 x 5.
55
XIII. Macro utility
Overview
Assess provides a simple macro language to enable the user to automate some commonly
used operations. Batch file processing is also supported. However, the user is cautioned
against using unattended batch processing in performing thresholding and measurements,
as each image tends to be different.
A user macro program can be developed from within Assess as explained below. This is
the preferred method, as it eliminates the potential for syntax errors. However, macro
programs can be written in any word processor and saved as a text file, with no formatting.
Several sample macros are provided with Assess. Feel free to use and modify them (at
your own risk!). Just remember, the computer will execute any command that you issue,
correct or incorrect! While the utility provided in Assess eliminates syntax errors, the user
should carefully check for the order in which the commands are issued (i.e., program logic).
Assess does not check for any logic errors.
The commands in the list boxes on the left are grouped by function and color coded for
visibility. The list box on the right (white) is where the user program will be placed.
56
How to add a command
There are two ways you can add commands to the user list:
• Double-click on a command from the list of available commands to append it
to the end of the program.
• Select a command from the list, drag it to your program and drop it. This
method allows you to place the command anywhere within a program.
How to delete and move commands and clear the macro list
• You can delete one or more commands from your program by selecting them
and pressing the ‘Delete’ key or clicking on the ‘Delete’ button provided on
the form.
• You can use the ‘Up’ and ‘Down’ buttons (red arrow icons) on the form to
move a selected command up and down
• The program may be cleared (erased) by the ‘Clear’ button on the form.
If a ‘Pause’ command was issued from within your macro program, the button
below the ‘Test Macro’ button will display ‘Resume’. Simply click on ‘Resume’
to continue execution.
Posting a macro
Click on ‘Post Macro’ when your program is ready. Your macro program is then
stored in memory and can be ‘played’ by the Macro Player described below. You
should always post your macro after editing.
Click on ‘Save Macro’ to display the Windows Save dialog box, locate the desired
directory, name the file and save it. Macros should be given a ‘.mac’ extension.
Click on the ‘Load Macro’ button to display the Windows Open dialog box, select
a macro file (.mac) and open it (double-click or press on ‘Open’).
2. Recording a macro
57
You can record user activity by selecting ‘Macro|Record Mode’ from the Menu
Bar. The macro utility box will open, and user activity on the Threshold Panel is
automatically logged in the ‘User Macro List’. Note that not all activity is recorded.
This feature may be disabled in Assess 2.0.
Click on the button labeled ‘Settings’ (see the figure on the left of this paragraph)
to download the current settings of the Threshold Panel. Typically, you would
suspend recording (as described below), set the color space, the color plane and the
threshold levels for ‘Leaf’ and ‘Lesion’ of an image to be used as your default in
future processing. The color space, color plane and threshold levels of each of the
‘Leaf’ and ‘Lesion’ will be recorded in your macro program. Now you can click on
the ‘Resume Rec’ button to resume recording.
Click on the ‘Suspend’ button to temporarily suspend recording. The icon on the
button will turn red and the button label should read ‘Resume Rec’.
Resume recording
Select ‘Macro|Record Mode’ from the Menu Bar. You should always turn off
recording when you are done.
Select ‘Macro|Edit Macro’ from the Menu Bar. If the player is on and loaded
with a macro or if you have previously ‘posted’ one, it will automatically be
loaded in the ‘User Macro List’ of the macro utility form shown above. If the
player is not open, the macro utility form will be opened, and you can load a new
macro.
Once a macro is loaded onto the form, you may edit it by adding, removing or
recording new commands. You must post it or save it. If you post it while the
Macro Player is on, the edited macro program will replace the old one in the player.
58
4. Macro Player
Generally, the Macro Player is loaded when it is opened. However, if the list box on the
left is empty, you must load a new macro.
Loading a macro:
Click on the ‘Load macro’ button, which is visible on the expanded form only,
and load a macro.
Playing a macro:
Click on the ‘Play’ button.
Batch processing:
This option is part of your macro. If there is one occurrence of ‘Batch_Process’
command in you macro, you are expected to provide at least one file name. File
names of images to be processed are placed in the corresponding list box (the
yellow box on the right of the form).
59
intent is to reuse it later. To load the file list, click on ‘File’ on the macro player
menu and select ‘Open File List’ or ‘Reopen File List’. To save the file list go
to ‘File|Save File List’ on the Macro Player.
Editing a macro:
You cannot edit a macro from the Macro Player. Go to the Menu Bar and select
‘Macro|Edit Macro’. The macro utility form described previously will be
opened and will contain your macro. You must use the ‘Post Macro’ button at the
end of the editing to apply the changes to the macro program in the Macro Player.
• You can click on the ‘Suspend’ button if you are running a batch. This button
has no effect on the execution of the ‘loop’, i.e., all the commands after
‘Start_batch_here’. The program will pause after finishing the current file, not
the current operation.
• Always finish the job by clicking on the ‘Resume’ or the ‘Abort’ button, or
the pause loop will continue executing until you close the entire application.
This obviously may result in wasted time resources on the CPU and may also
cause unexpected behavior of the program.
Progress bar:
The progress bar on the Macro Player displays the percentage of files processed.
It will be inactive if you are not running a batch.
60
5. Macro language reference
The following macro commands (routines) are available in Assess. The macro commands
are case-insensitive.
Macro_End End of macro. For future use only. Ignored in this version.
Macro_Start Start of macro. For future use only. Ignored in this version.
Open_File() Will prompt for a file name at design time. Use this option
if you know exactly the name and the path of the file.
61
Selects the ‘Close’ filter on the Threshold Panel. Each
Set_TPFilter_CloseBlob thresholding operation is followed by this filter on the
overlay.
62
Setup routines
63
Selects the Red color plane. A call to
Select_RedPlane ‘SetRGBColorSpace’is required before issuing this
command.
Sets the low threshold level for whatever options are current
SetLowThreshold (value: byte) (color plane, color space and leaf/lesion). A parameter is
needed. The routine takes a value from 0 to 255.
64
Performs a binary erosion on the overlay. The number of
Ovl_Erode(n: byte) erosions to be executed as a parameter must be supplied. If
no number is supplied, the routine will execute once.
65
RGB_Sobel_Filter Performs an edge-detection filter on the original RGB image.
66
Counts and measures the objects on the overlay. A call to
‘Ovl_Threshold_Image’ is necessary before calling
‘Get_Lesion_Count’. If you want the results saved in the
Get_Lesion_Count spreadsheet you must issue a call to ‘Set_Spreadsheet_On’
prior to calling this routine. Also, you must set the features
to be extracted (using the ‘Options’ button on the Threshold
Panel) before making this call.
67
XIV. Image menu
The Image menu consists of items related to work with images, once they are opened.
Enhance Image: Use this option to adjust the brightness, contrast and colors of an opened
image. Some elementary filtering options are also available with this option.
Gamma (brightness): This menu item will display a dialog box. You can adjust the
gamma value of the image. This will make the image darker (low gamma) or brighter (high
gamma).
Suggest threshold for % disease: This command assumes that you are working with a
color image of diseased leaves taken on a blue background. It is also assumed that
the leaves are green and the lesions/pustules yellow-red-brown (common colors for
most foliar diseases).
This command will set the Threshold Panel to Hue for both leaves and lesions and
determine the threshold levels. You may need to make small adjustments depending on
your particular circumstances. This feature is now replaced with the automatic disease
measurement found on the Automatic Panel.
68
Suggest threshold for % ground cover: This command is similar to the one above. It is
used with seedlings only. Because we only have to threshold for the seedlings, this
procedure has a higher success rate than for diseases. It is assumed that the seedlings are
green with no flowers. This feature is now replaced with the automatic feature of
user-independent ground cover measurement found on the The Agronomist and the
Automatic Panel.
Note: Both commands provide you with tentative threshold levels in the HSI/HSV color
spaces. You must check that the objects of interest have been accurately identified and
take appropriate action if they are not. As an exercise, you can open ‘TestLeaf.png’ and
use it with ‘Suggest threshold for % disease’ (use the ‘%Auto’ feature of the
Automatic Panel to compare). You can try ‘canola2.tif’, ‘fababeans.png’ and
‘fababean_weeds.png’ with ‘Suggest threshold for % ground cover’. Try the ‘%GC’
from the Automatic Panel or the ‘%GC-Auto’ from the Agronomist Panel to
automatically measure ground cover.
Show Histogram: Will call the histogram dialog box described in Chapter VIII (The
Image Histogram).
Clear Image: Erases the color image. You can undo this operation from ‘Edit|undo’
Clear Overlay: Erases the overlay. You must perform a threshold operation again, if you
wanted to measure objects.
Add Overlay to Image: Adds the content of the overlay to the original image. This
feature is for documentation only. The image can then be saved and used in publication
and/or presentation. You must not use the image for measurement.
Make new bitmap from AOI: This feature is the same as the one in the rectangular AOI
tool described in Chapter V (Working with the Area of Interest). This command creates a
new image window containing the portion of the image corresponding to the current
rectangular AOI.
Color Space: In addition to the RGB color space (available on the Threshold Panel), you
can select one of three alternative models (HSV, HIS and CIE L*a*b). Assess defaults
‘arbitrarily’ to HSV. The automatic measurements (on the Automatic Panel) are
performed using the L*a*b color space. This space is not easy to use manually. If you
need to threshold an image manually, use HIS or HSV instead.
View HSV Bitmap: Produces H, S, and V (or I) components to view on screen. Do not use
these images for processing.
69
View L*a*b: Produces L, a and b components to view on screen. Do not use these images
for processing.
Alternate palette: Changes the palette from white to red and vice versa. The palette is
only for viewing the overlay. If you are using images with a white background, you can
select the red palette for visibility. The palette has no effect on processing or measurement
and is merely a tool for mapping the 255 values of the overlay to the 16.7 million colors of
the display card (i.e., we could have picked up any 255 colors out of the 16.7 millions).
Flip Vertical: Mirrors the image along the horizontal axis (top-bottom or bottom-top).
Flip Horizontal: Mirrors the image along the vertical axis (left-right or right-left).
Rotate by any angle: Calls the Rotation dialog box. You can rotate the image by any
angle. The utility allows you to draw a line in your image, and rotate the image so that the
line is vertical or horizontal. This is useful for adjusting calibration grids, in case they were
not scanned in the proper position. You may have to crop the image after rotation, as it
may become too big or have ‘leftover’ pieces of the original image.
Resize Image: Allows increases or decreases in the size of the original image. This is not
a zoom operation. The image is stretched (shrunk) in the x and y directions to the sizes
selected. Two options for resizing are available:
Note: You can stretch/shrink an image while keeping the aspect ratio, in which case you
only change one parameter (height or width) and Assess computes the other.
70
XV. Tools Menu
Save Threshold Values: Writes the current threshold
values of the active image window (the topmost image
window) to the file ‘Assess.ini’.
Calibrate: Calls the ‘Calibration’ tabsheet of the ‘Measurement defaults’ dialog box
(same as pressing ‘Calibrate’ on the Threshold Panel).
Measurement Options: Calls the feature extraction form (same as pressing the ‘Options’
button on the Threshold Panel).
Note: Assess does not write to the Windows registry, to avoid cluttering this cumbersome,
dangerous and often ‘fatal’ file. Assess uses one old-style ‘ini’ file called ‘Assess.ini’ but
will work fine without it. Use it only if you want to reconfigure the slider to new colors or
to save and retrieve old threshold values, etc. If you destroy this file by accident or by
intention, Assess will run with its default values. However, it will create a new ‘ini’ file in
the directory where Assess is located.
71
XVI. Options
Save area with % disease: Set this flag (check)
if you want the lesion and leaf areas saved
when you calculate % area. Default: off (not
checked).
Configure Assess: Opens the ‘Configuration’ dialog box. The user can configure the
slider (colors and behavior) (see figure below).
HSI Shift factor (on the dialog box below): The value in this edit box controls the look
of the slider and the conversion from RGB to HSI. Assess does not conform exactly to the
standard definition of hue. Normally, red starts at zero (0), but in Assess, we shifted this
value by 196 for practical reasons. This puts the red color (used extensively in lesion
analysis) in the middle of the slider (see the slider track below) and makes it very easy to
select all the ‘reddish’ colors, in a straight fashion (no need to wrap around). You can reset
this value to zero (at your own risk!) but resetting the value is not recommended!
Reset Slider to Default: Resets the slider to its original state (when it was installed for the
first time).
Always Update Leaf Mask: A flag used in conjunction with ‘Leaf AOI’. When this
option is checked (default), Assess makes a new mask each time the leaf is thresholded, so
that the mask is always current and the lesions are restricted to the leaf. Keep it on when
measuring diseases on different leaves. Default: on (checked).
72
Perform Median Filter on Image at opening: When checked, Assess performs a median
filter on the image. This has the effect of ‘smoothing’ the data before analysis. Once
selected, Assess will ‘remember’ the setting permanently until the option is turned off.
Default: off (not checked).
Perform Low Pass on Image at Opening: When checked, Assess performs a low-pass
filter on the image. This has the effect of removing ‘high-energy’ pixels from the data
before analysis. Once selected, Assess will remember the setting permanently until the
option is turned off. Default: off (not checked).
Use Image Background in Cut Operations: This will use a piece of background from
the image to fill-in cut portions during a “Cut” operation. This must be checked if you are
using the Automatic Panel to measure diseases. Default: on (checked).
Outline leaves at opening: This option will instruct Assess to outline the leaves,
immediately after opening the image. Default: off (not checked).
Process Leaves at Opening: This option will instruct Assess to determine the threshold
levels for the leaf. It must be left on if you are using the Automatic Panel. Default: on
(checked)
73
XVII. Tutorials
In the following tutorials, you will be asked to threshold images. Typically, values will be given
to you to set threshold levels to select the leaf or the lesions. One may ask: How did we come up
with such values? The answer is quite simple: Common sense, the image histogram, and trial and
error! Throughout these tutorials, you will realize that there is no single ‘best’ solution to a
problem of this nature. The examples provided in this section are based on the author’s personal
experience and do not, by any means, suggest that this is the only way to measure diseases or to
use the software. The primary objective of the tutorials is to help you become familiar with the
most important features of Assess, without having to spend too much time reading the manual.
This section contains 19 tutorials.
List of Tutorials.
The files to be used in these tutorials are found at the beginning of each tutorial as in the
example below.
74
The sample images are assumed to be in the directory where Assess was installed. If you
choose the default installation, these files will be under:
C:\Program Files\Assess Image Analysis\images
Note: To get results identical to those in the tutorials, make sure that the following filter
options are turned off: ‘Options|Perform Low Pass Filter on Image at Opening’ and
‘Options|Perform Median Filter on Image at Opening’.
Purpose: To familiarize the user with the operation of the Threshold Panel.
This tool is central to all the activities in Assess.
Activity: You will open a test image and set the low and high threshold levels to separate
the leaf from the background.
75
5. Measure leaf area (optional): Simply click on the button labeled ‘Area’ and read the
result in the ‘Area’ edit box at the bottom of the Threshold Panel. It should read 100594.
This is the number of pixels in the combined area of the leaves. Of course, a measurement
in pixels is in most cases useless. The system must be calibrated in order to get the real
physical area of the leaves. This will be done in another tutorial.
Conclusion: You have learned how to set threshold levels to select objects of interest (leaves
in this case). This is the most critical part of the process. Once objects have been selected and
highlighted on screen, they can be analyzed or measured by a single mouse click and without
additional input from the user.
76
Tutorial 2. Using filters on the Threshold Panel
Activity: The user will use a test image containing a leaf and threshold the image to select
the leaf with and without filtering.
Step 3. Go to the Filtering drop-down list box (in the processing section of the Threshold
Panel): it should read ‘Smooth (median)’.
Step 5. Click on the ‘Apply’ button to threshold the image with the same values as before
(Low = 0; High = 198).
Step 6. You should see a lot of noise in the background and hundreds of tiny holes in the
leaf. Obviously, this image is not clean!
77
Filtered image.
Notice noise reduction, compared to the figure below.
Non-filtered overlay.
Notice isolated pixels in the background and holes in the leaf.
78
Tutorial 3. Working with the ‘Rectangular Area of Interest (AOI)’ tool
Purpose: To familiarize the user with the use of the Area of Interest (AOI). This is useful
when only a portion of the image needs to be analyzed.
Activity: In this tutorial the user will open a file, set threshold levels and select a
rectangular AOI. We will also use the popup menu associated with the ‘Rectangular AOI’
tool to explore the image using some of the on-the-fly options, available with this tool.
1. Locate the mouse cursor on the image. The cursor should appear as a cross. If the
cursor looks like a pointing hand, click on the ‘Reset AOI’ button on the Toolbar (the
button with a red rectangle): this will hide the Rectangular AOI tool and reset its size to
the full image. The cursor should now turn into a cross, when positioned on the image.
Note: If the cursor appears as an arrow when positioned on the image, the
overlay is off. Click on the ‘Toggle’ button on the Threshold Panel or the
‘Overlay Control’ button on the Toolbar. The caption of the overlay control
button should read ‘Ovl ON’.
2. Press and hold down the left mouse button and drag the mouse. You should see a
rectangle being drawn.
3. Release the mouse button. You have just set the area of interest to the rectangle shown
on the screen. All processing and measurements will now be restricted to this area.
Note: You can do steps 2 and 3 as many times as you wish. Make sure you locate the
mouse cursor outside the Rectangular AOI tool. Each time you repeat these steps you
will be setting a new AOI. There is only one AOI for each image at any given time.
4. Threshold the image. Using the slider thumbs, set the low and high threshold levels to 0
and 198, respectively. You should see the portion of the leaf inside the AOI rectangle
highlighted (covered in white or red, depending on which palette is used). The rest of the
image remains uncovered.
79
5. Optional: Click on the ‘Area’ button on the Threshold Panel to measure the portion of the
leaf inside the AOI.
Thresholding on-the-fly
In the following exercise you will use some of the features of the Rectangular AOI tool.
You will use the image already opened and threshold the area to detect lesions (spots) as
you move or change the size of the AOI. Generally, you will keep the size of the AOI
relatively small to achieve a good speed (the original purpose of this option).
For the sake of this exercise we will consider the spots on the test leaf to be lesions.
2. Set threshold levels for the lesions: Move the lower and upper slider thumbs to,
respectively, 31 and 87. The spots on the leaf should now be highlighted.
3. Set ‘Threshold on-the-fly’ option: The AOI tool must be visible, as shown in the figure
below (the Rectangular AOI tool may have ‘marching ants’). If this tool is hidden, click
on the Rectangular AOI tool on the Toolbar to bring it to the front. Right click inside the
AOI. You should see a popup menu, as shown below.
AOI
Popup menu
80
5. Using ‘Threshold on-the-fly’: Now move or resize the AOI tool and see the
results: as you release the mouse button, Assess thresholds the AOI with the
current settings of the Threshold Panel. Since we have selected ‘Lesion’, the
spots on the leaf are highlighted.
Use this feature with a small AOI to see if the threshold levels are good (i.e., all or
most of the objects of interest are highlighted). You can also read the total area of the
spots inside the AOI tool.
6. Select ‘Outline on-the-fly’: Right-click on the rectangular AOI as in steps 3 and 4 and
select ‘Outline on-the-fly’. As you move or resize the AOI selection tool, the detected
objects (inside the AOI) are automatically outlined.
7. Select ‘Percent disease on-the-fly’: Right-click on the rectangular AOI as in steps 3 and
6 and select ‘Percent disease on-the-fly’. The threshold levels for both the leaf and the
lesions must be set for this option to produce a meaningful result.
If you have not changed the threshold values set earlier in this tutorial, you are ready to
test the ‘Percent disease on-the-fly’. If the values were changed, set them to the following
(in the same order).
Now move or resize the Rectangular AOI tool. The percent area of the spots relative to
the leaf area contained in the AOI is automatically computed and displayed. The lesions
are also shown on the overlay.
81
Tutorial 4. Using the ‘Freehand Area of Interest’ tool
Purpose: To familiarize the user with the use of the ‘Freehand Area of Interest’ tool.
This is useful when a non-rectangular portion of the image is needed for analysis.
Activity: In this tutorial the user will open a file, set threshold levels and draw the outline
of an area of arbitrary shape and size. The outline drawn by the user is converted to a mask
and used as an AOI during thresholding and measurement activity on the overlay.
Freehand Area of Interest: Entire Shape drawn by user Lesions detected within the Freehand AOI.
image as AOI Note that all highlighted objects (spots)
are within the user-drawn curve.
82
Tutorial 5. Using the Leaf Area of Interest (‘Leaf AOI’)
Purpose: There are instances when the background can be difficult to separate from the
objects of interest (lesions). Assess provides a special type of Area of Interest, which will
restrict processing to the leaf. This assumes that we are able to separate the leaf from the
background. This type of problem is frequently encountered in the analysis of images of
foliar diseases taken with a white background. There are several solutions to this problem;
the ‘Leaf AOI’ introduced here is one possible solution and is specific to Assess.
Activity: You will open a test file containing an image of diseased leaves, scanned with a
white background. You will 1) separate the leaf from the background using the HSI color
space and the Saturation color plane, 2) enable the Leaf AOI and 3) threshold the image
to extract the lesions using the Hue color plane, which is very well suited for this type of
analysis.
Step 1. Click on the ‘Palette’ button on the Toolbar to set a red overlay color,
if you wish.
Step 2. Set the ‘Leaf/Lesion’ button to ‘Leaf’ (we process the leaf first).
Step 3. Set the color space to ‘HSI’ if it is not already set to this value.
Step 4. Set the color plane to ‘S’ (saturation).
Step 5. Move the lower and upper slider thumbs to, respectively, 52 and 163.
Step 6. Click on the ‘Leaf AOI’ button on the Toolbar.
We have now separated the leaf from the background and stored this information to restrict
any future processing of the lesions to the leaf area.
83
Step 7. Set the ‘Leaf/Lesion’ button to ‘Lesion’ (we now threshold the lesions).
Step 8. Set the color space to ‘HSI’ as in step 3 if it is not already set to this value.
Step 9. Set the color plane to ‘H’ (Hue).
Step 10. Move the lower and upper slider thumbs to, respectively, 31 and 103.
Notice that the lesions are detected and kept within the leaf surface.
Compare the results you just obtained with the default rectangular AOI (below)
Step 11. Turn off the ‘Leaf AOI’ option by clicking on the Rectangular AOI
button. This will also set the Rectangular AOI option.
Step 12. Click on the ‘Apply’ button on the Threshold Panel to re-threshold the image
(assuming the ‘Leaf/Lesion’ button is set to ‘Lesion’). The lesions detected extend into the
background and have poorly defined edges (figure below, left).
The figures below illustrate the results of the operations performed in this tutorial.
‘Leaf AOI’ off: Notice lesions extending ‘Leaf AOI’ on: Lesions are correctly
into the background. contained in the leaf area.
Purpose: There are instances when the colors of the background pixels overlap with those
of the objects we want to measure on specific color planes. In the following example, the
objects of interest are colored (i.e., have a saturation well above zero). We will use this
useful property of the HSI color space to separate the colored objects from the white
84
background, which is ‘unsaturated’ by definition (i.e., has a saturation close or equal to
zero). The principle behind the conversion process is the following: in a thresholded image,
the overlay serves as a mask to protect any overlaid pixel. All non overlaid (exposed)
pixels of the image are converted to a default color.
Activity: You will open a file, set threshold levels for the ‘Leaf’, threshold the image and
change the background color.
This image contains a background and coriander seeds. We want to separate the seeds
from the background.
Note: This image was scanned with a white background (the default cover color of flatbed
scanners).
Before you execute the steps outlined below, try to select the seeds without selecting the
background, using the Hue color plane as in the previous tutorials. You may also try to use
the RGB color space.
This particular image is best processed using the HSI color space and the ‘Saturation’
color plane. The rationale, as explained above, is that gray pixels (including white) have
a very low saturation (close or equal to zero). On the other hand, the pixels making up the
coriander seed are colored and have, therefore, a much higher saturation. All we have to
do is set the lower threshold level above the level of the background and the upper
threshold level very high.
Step 2. Click on the ‘Palette’ button on the Toolbar to set a red overlay color
if the current overlay color is white.
Step 3. Set lower thumb to 33 and upper thumb to 185. The seeds are clearly selected,
without the shadow that would have been selected with the Intensity, Red, Green or Blue
color plane. The Hue color plane does not give good results either.
Step 4. Convert background to blue: If the rectangular AOI tool is visible, place the
mouse cursor inside the AOI and right-click (if the AOI is not visible, press the ‘Reset
AOI’ button [the button with a red rectangle] to make it visible). From the popup menu,
select ‘Substitute Background’. This option is also available from ‘Edit|Substitute
Background’. All the areas that are not overlaid in red will be converted to the default
blue color (as shown in the figure below).
Note: In fact you can convert the background to any color. Select ‘Edit|Select
Background color’ to open the Windows color dialog box, pick a color and exit. The
85
color you selected becomes the default substitution color. This feature may be useful for
publication or presentation purposes, if one needed a uniform background of a given color.
86
Tutorial 7. Disease measurement
Purpose: The purpose of this exercise is to quantify the amount of disease present on the
leaf in the test image. Spatial calibration is not required in this case, as the result
represents a ratio of two areas and is, therefore, ‘unit-less’. For the sake of this exercise,
we will perform ‘Hue’ analysis on both leaf and lesions. Assess will allow mixing of color
spaces and color planes. For instance, we could use the ‘Blue’ component of the RGB
color space to extract the leaf and the ‘Hue’ component from the HSI color space to extract
the lesions.
Activity: In the operations that follow, you will open an image, set the threshold levels for
the leaf and the lesions and measure the percentage of the leaf covered by the lesions (i.e.,
% disease).
Step 1. Set ‘Leaf/Lesion’ value: Select ‘Leaf’ by clicking the ‘Leaf/Lesion’ button
(below the color plane button). The button label should read ‘Leaf’.
.
Step 2. Set the color space: Click on the color space button and set it to ‘HSI’. You may
omit this step if the button label already reads ‘HSI’. Note that this button toggles between
two values (‘HSI’ and ‘RGB’) each time it is pressed.
Step 3. Set the color plane: Click on the ‘H’ radio button in the color plane area, if it is
not already on ‘H’. This will instruct Assess to use the Hue component of the image pixels.
87
4.3. Outline leaf (optional): Click on the ‘Outline’ button to view the outline of
the leaf. The result of the outline operation is shown below (figure on the right).
6.1. Lower thumb: Drag the lower thumb to 31 or type ‘31’ in the lower
edit box next to the slider.
6.2. Upper thumb: Drag the upper thumb to 101 or type ‘101’ in the upper
edit box next to the slider (you should see lesions highlighted as in figure
A, on the next page).
88
6.3. Outline lesions (optional): Click on the ‘Outline’ button to view the outline
of the lesions (figure right, below).
7. Percent area: The preparation stage is complete. We are ready for measurement.
Click on the ‘% Area’ button to compute the percent disease. The value reported
in the ‘Percent’ box is computed as follows: Percent = (lesion/area)*100. The
value in ‘Area’ represents the area of the entire leaf, lesions included; the value in
‘Lesions’ represents the area of the lesions.
89
Tutorial 8. Spatial calibration
Purpose: To perform a spatial calibration in Assess, using an image taken from a video or
digital camera. Images scanned into Assess are automatically calibrated and the resolution
recorded (generally, there is no need for calibration). The calibration procedure for non
calibrated images is critical if the intent is to measure area or length of objects of interest.
Because of the hardware independence of Assess, there is no way to know in advance
about the particular physical characteristics of the acquisition system. It is, therefore, the
responsibility of the user to provide such information.
Activity: The user will open a file containing a grid of known physical size, select an area
of known x and y dimensions and perform the calibration. The sides of the rectangle will
be used to get the physical size of the width and height of a pixel. A calibration ratio is then
computed for the area of a pixel. Once this is done, Assess automatically converts pixels
into physical units.
Step 1. Draw a rectangle with known length and height. For this exercise, let us use 50
mm for length and 30 mm for height.
90
Step 2. From the Threshold Panel, click on the ‘Calibrate’ button to open the
'Measurment defaults' dialogue box.
Step 3. Enter the horizontal value: Click on the label ‘Horizontal’ (in red). The mouse
cursor moves to the corresponding edit box. Enter ‘50’.
Step 4. Enter the vertical value: Click on the label ‘Vertical’ (in green). Enter ‘30’ in the
corresponding edit box.
Your form should look like the figure below. The calibration values may
be slightly off, as the selection rectangle in step 1 is unlikely to be
drawn exactly the same way by different users.
Step 7. The calibration is done. You can save it or simply use it for this session.
91
Testing the new calibration values:
Use the ‘Digital Ruler’ to draw rectangles and lines of different sizes on the calibration grid.
The values reported should be very close to the actual size. If they are off by more than 1%,
you may have to redo your calibration and be precise in 1) drawing the area to measure and
2) making sure that you enter the correct values in the edit boxes.
1. Select an option (line, rectangle, horizontal line, vertical line, freehand line or freehand
area drawing) by clicking on the appropriate button (the buttons are labeled with figures
representing the options).
2. Go to the image and position the mouse cursor at the start of the object to measure.
3. Drag the mouse to where you want it to be.
4. Look at the edit boxes on the Digital Ruler to read your measurement.
5. Record your measurement (by hand!). It will be erased and replaced by the next
measurement.
Very important:
For proper calibration, the user must provide both horizontal and vertical values for the
rectangle used in the calibration process. However, Assess will allow you to calibrate a single side
(x or y), but makes the assumption that the side for which the physical value is missing is similar
to the one for which the value is provided (i.e., it assigns the same calibration value to both sides).
This is highly discouraged, as only the side for which a physical value was provided will be
calibrated properly.
92
Tutorial 9. Measurement of ground cover
Purpose: To measure ground cover using the hue component of the HSI color space.
Accurate ground cover measurement using black and white images is very difficult, if not
impossible. This is due to the shadow projected by seedlings onto the ground and also due
to the soil color. In black and white, seedlings and soil can have pixels of similar values,
making it cumbersome to separate the two. By contrast, hue represents ‘pure’ color (tint)
and is independent of intensity (the black-and-white component of a pixel). The ‘color’ of
a seedling is generally green, whereas that of the soil is generally brown. As can be seen
in this tutorial, seedlings and ground are easily separated on the hue color plane.
Activity: Using a test file provided with Assess, the user will separate the ground from the
seedlings (plants) using hue and measure the area of the seedlings relative to the total area.
The principle is the same as measuring percent area infected in foliar diseases. In this case
there is no background to worry about, since we will use the entire image or an area of
interest (AOI) as the ‘ground’. All we have to do is isolate the seedlings and measure the
area they occupy relative to the ground. The hue color plane is excellent to use for this type
of analysis.
When you are done with the procedures below, get the Agronomist Panel or the
Automatic Panel and click on ‘%GC-Auto’ or ‘%GC’ and compare!!
Step 2. Set the color space to ‘HSI’ (it may already be set).
Step 3. Set the color plane to ‘H’ (it may already be set), to select ‘Hue’.
Step 4. Move the lower thumb to ‘0’ (far left) and the upper thumb to ‘255’ (far right). In
this operation all the pixels in the AOI will be selected and counted as ground. If you are
analyzing multiple images, you do not have to perform this step for the rest of the session.
Step 5. Set the ‘Leaf/Lesion’ button to ‘Lesion’, the color space to ‘HSI’ and the color
plane to ‘H’.
Step 6. Set the lower thumb to ‘93’ and the upper thumb to ‘186’. Notice that the
seedlings are selected.
Step 7. Measure % cover: Simply click on the ‘% Area’ button on the Threshold Panel.
The result reported in the ‘Percent’ edit box should read 53.66% (see the figure below).
93
Measurement of ground cover. Notice that the shadow is excluded.
As was seen in this tutorial, it is much simpler to measure ground cover than to measure
foliar diseases. The main reason for this simplicity is the fact that we only had to isolate
the seedlings from the ground. In the hue color plane shown below, you could see that the
seedlings stand out in green, whereas the ground appears red; all we had to do was pick the
green pixels! To view the hue color plane of the image, go to the Menu Bar and select
‘Image|View HSV|Hue’ (after viewing, make sure to use ‘Edit|Undo’ to get back your
original RGB image, or simply reload the image). It would have been very difficult to
achieve the same result using any of the other color plane and color space combinations.
The user is encouraged to test this assertion.
Additionally you may want to view the image histogram (‘Image|Show Histogram’).
Check the ‘Link to Threshold Panel’ check box on the Histogram dialog box, and select
‘H’ for the color plane in the Threshold Panel. You can see two major peaks, one green,
representing the seedlings, the second red, representing the ground. (Note: if you have
used the ‘Image|View HSV|Hue’ described above, you must undo the operation before
calling the histogram or reload the original image.)
94
Hue plane (8 bits) of ‘canola2.tif’: Notice the clear separation between the green seedlings
and the red-looking ground. The histogram shows two distinct peaks, representing the
ground (red) and the seedlings (green), respectively.
95
Tutorial 10. Measuring root length
Purpose: To become familiar with the process of measuring plant root length.
Activity: The user will open a test file, set threshold levels to select the roots and perform
root length measurement. In this exercise, we will use saturation to separate the root from
the background. The image used is a color image with a white background.
Unfortunately, this image is not typical of what one would expect. In a real situation, the
root should be fanned as much as possible and preferably backlit. On a flatbed scanner, this
is not always possible. Notwithstanding the mediocre quality of the image, we will still use
it to illustrate the technique.
Step 1. Click on the ‘Palette’ button on the Toolbar to set a red overlay.
Step 2. Optional. Click on the ‘Freehand AOI’ button on the Toolbar and draw a
curve around the root area to exclude the thick part (unless you want to measure
everything).
Step 3. Set the color space to ‘HSI’.
Step 4. Set the color plane to ‘S’ (Saturation).
Step 5. Set lower and upper thumbs to 18 and 159, respectively.
Step 6. Click on the ‘Root L’ button on the Threshold Panel. That is all there is to it! You
will notice that the overlay of the root segments is reduced to a thickness of 1 pixel
throughout the image. What is shown on screen and measured is the ‘skeleton’. Roots are
measured taking into consideration the orientation of the root pieces.
Note: The measurements are in pixels. Typically, you would calibrate the system
beforehand as shown in Tutorial 8 and also enable the spreadsheet to log the data.
Root length measurement is ideal for unattended batch processing, provided that the
images have good contrast so that the threshold levels (in the Saturation or Intensity color
plane) remain fairly constant.
96
components. You should get identical results for the four components, which will prove
that they are identical, in a typical monochrome image.
Below are figures to illustrate the results of processing we have performed in this tutorial.
97
Tutorial 11. Counting and measuring lesions
Purpose: To become familiar with the process of counting objects using Assess. Often,
plant pathologists need information about lesion/pustule count and size in quantitative
epidemiology, inheritance and other studies.
Activity: The user will open a file provided with Assess, set threshold levels to isolate
lesions, select the features to measure for each lesion and log the data in the spreadsheet.
The system must be calibrated in order to get physical sizes for the objects we want to size.
Step 1. Set threshold levels for ‘Leaf’ and ‘Lesion’ to the following values (in order):
Set leaf
‘Leaf/Lesion’ button = Leaf
Color space = HSI
Color plane = ‘H’ (hue)
‘Leaf’ threshold levels Low = 31 High = 191
Set lesions
‘Leaf/Lesion’ button = Lesion
Color space = HSI
Color plane = ‘H’ (hue)
‘Lesion’ threshold levels Low = 31 High = 101
Step 2. Check ‘Spreadsheet’ on the Threshold Panel. This step will enable writing to the
spreadsheet.
Step 3. Select the features to extract: Click on ‘Options’ on the Threshold Panel.
98
The ‘Feature extraction options’ tab sheet should look like the one in the figure below:
Click on ‘OK’ to accept these settings and exit the form.
Step 4. Make sure that the ‘Leaf/Lesion’ button is set to ‘Lesion’ and click on ‘Count’: The
lesions are counted, painted in different colors and displayed as shown on the next
page.
Note: We have excluded some lesions based on size (those less than 100 pixels or larger than
50000 pixels). The sizes reported are all in pixels because we have not calibrated the system.
It is left as an exercise to the user to perform the calibration (Tutorial 8) and redo this tutorial.
99
Step 5. View the data: Click on the ‘Spreadsheet’ button on the Toolbar.
You will need to scroll the spreadsheet to go to the top.
To view a specific lesion, click on the object in the spreadsheet (any cell in the row)
and go to the image. Crosshairs will be positioned at the origin of the lesion (Org.X,
Org.Y).
100
Tutorial 12. Manual separation of touching objects
Purpose: To use a line drawing tool to separate touching objects. The problem of
separating touching objects is not a trivial one in image processing. Sometimes (often!),
we have to do it manually. This operation must be preceded by a selection of the objects
of interest (a threshold operation). After the manual separation is completed, the objects
are generally counted and/or measured.
Activity: You will open a file, set up threshold levels to select the objects of interest,
manually separate touching objects and perform a count operation.
Click on the ‘Palette’ button on the Toolbar to use a red overlay. This is optional
(the results are not affected by the palette).
Step 1. Set threshold levels: Set threshold levels as described in Tutorial 11.
101
Step 3. Draw separation lines: Go to the image window and draw lines to separate what
you consider to be touching lesions. For the sake of the exercise, just draw lines through
some objects (see the yellow lines in the figure below). As you start drawing, the original
color image becomes invisible. This is normal; the image will become visible when you
release the mouse button.
Step 4. Count lesions: Click on ‘Count’ in the Threshold Panel. You will notice in the
figure on the next page that the yellow lines are not counted as part the lesions. They are
treated as background. The lesions are now ‘separated’.
102
Lesions counted after manual separation. Notice that the yellow
lines are treated as background and ignored.
103
Tutorial 13. Automatic separation of touching objects
Purpose: To familiarize the user with the ‘watershed’ procedure used in automatic
separation of touching objects.
Activity: You will open a file and threshold the image to select objects. After successfully
selecting the objects (coriander seeds), you will notice that some of them are touching.
You will use the watershed operation to automatically separate them.
This image shows coriander seeds against a white background. We want to separate the
background from the seeds, as in Tutorial 5.
This particular image is best processed using the HSI color space and the Saturation
color plane.
Step 2. Click on the ‘Palette’ button on the Toolbar to use a red overlay,
since we have a white background (just for visibility).
Step 3. Set the lower thumb to ‘33’and upper thumb to ‘185’ to identify the seeds.
Step 4. Separate the seeds: You will notice that some seeds are touching.
We will apply the watershed operation to automatically separate them.
Click on the ‘Watershed’ button on the Threshold Panel (the button with
the crossed leaf).
Note: If you find that some small pieces are counted, increase the size exclusion (under
‘Options’ on the Threshold Panel) to 200 or 300 pixels, to eliminate small unwanted
objects.
Optional: Count the seeds before separating them and compare the results.
104
Overlay after automatic separation of objects (watershed)
105
Tutorial 14. Blue versus white background in assessment of foliar diseases
Purpose: To demonstrate the ease with which percent disease is measured in images with
a blue background. Even though you can separate a leaf from a white background,
additional steps are needed to accurately separate the lesions from the leaf. In routine
analysis (hundreds of samples), this could represent a substantial saving of time.
Activity: You will measure percent disease in two test images, the first taken with a white
background (default for scanners) and the second with a blue background.
Click on the ‘Palette’ button on the Toolbar to use a red overlay (for good visibility, since
we have a white background).
Leaf/lesion Leaf
Color space HSI
Color plane ‘S’ (Saturation)
Threshold levels Low = 31 (anywhere between 28 and 60)
High = 183 (anywhere between 160 and 200)
We are using the Saturation color plane to separate the leaf from the background. This is based on
the fact that white has a very low or zero saturation, whereas the colors of the objects are much
more saturated. The leaf should be highlighted (see the figure below, left)
Step 2. Threshold the lesions: Set the following values in the order given below:
Leaf/Lesion ‘Lesion’
Color space ‘HSI’
Color plane ‘H’
Threshold levels Low = 26
High = 103
You will notice that the lesions appear to extend into the background, which will greatly
overestimate the percent disease (see the figure below, middle).
One solution is to use the leaf (thresholded with the Saturation color plane) as an area of interest
(i.e., use the ‘Leaf AOI’ option).
106
Using the ‘Leaf AOI’:
a) Click on the ‘Leaf/Lesion’ button to select ‘Leaf’ (the button caption should read ‘Leaf’).
Make sure that the color plane is still set on ‘S’ and that the leaves are cleanly separated from the
background as shown below (left).
b) Click on the ‘Leaf AOI’ button on the Toolbar to select the ‘Leaf AOI’
option. The button should remain ‘down’.
c) Click on the ‘Leaf/Lesion’ button again to select ‘Lesion’. Make sure that the color plane is
‘H’ and that the threshold levels are still as you set them earlier (in step 2).
d) Click on the ‘Apply’ button to threshold the image and highlight the lesions (see the figure
below, right). Compare the results shown in the middle and right images below.
Step 3. Measure percent disease: Click on the ‘% Area’ button. The ‘Percent’ edit box should
read ‘40.07’ % if the threshold levels are exactly the same as indicated above.
107
B) Using a blue background
Click on the rectangular AOI button to cancel the ‘Leaf AOI’ option.
Step 3. Set the lower thumb to 31 and the upper thumb to 103 (highlight the lesions).
Step 4. Set the ‘Leaf/Lesion’ button to ‘Leaf’, the color space to ‘HSI’ and the color plane to ‘H’
(Hue).
Step 5. Set the lower thumb to 31 and the upper thumb to 191 (highlight the leaf).
Step 6. Click on the ‘%Area’ button. The average for the four leaves is 37.75%.
If you were scanning images of other leaves into the same image window, it is likely that the
threshold levels would remain fairly constant so that the entire process could be reduced to three
mouse clicks: 1) scan, 2) check the threshold levels for the leaf and lesions, using the
‘Leaf/Lesion’ button (adjust if necessary) and 3) measure the percent infection.
Leaves selected using Hue Lesions selected using Hue Outline of lesions
108
Tutorial 15. Using the image histogram
Purpose: To select threshold levels using the image histogram utility provided in Assess.
In most cases, there is no need to view the image histogram to set threshold levels.
However, the use of the image histogram may sometimes speed up the process, by
suggesting cut off points.
Activity: You will open a test file provided with Assess and set threshold levels using
information from the image histogram only.
Step 2. Check the ‘Link to Threshold Panel’ check box. The work done on this form is
transmitted to the Threshold Panel. The histogram shown on the form corresponds to the
color plane on the Threshold Panel.
Step 3. If you have just opened Assess and did not change the settings on the Threshold
Panel, skip to step 4. Otherwise, set the color space to ‘HSI’ and color plane to ‘H’ (Hue).
Step 4. On the image, set the AOI to the left most leaf (the histogram shown represents the
AOI).
Step 5. Check the ‘Smooth’ check box in the Histogram dialog box. This will enable
histogram smoothing.
Step 6. Smooth the histogram: Drag the trackbar thumb slowly until you get clean peaks.
If you have problem reproducing the figure below, type ‘35’ in the edit box next to the
trackbar. Three major peaks, reminiscent of normal distributions, should be apparent. The
contours of the peaks are now smooth and the overall look of the histogram is much more
improved and suggestive of threshold levels.
Step 7. Interpretation: The peaks in the figure above are color-coded and correspond to
the actual hue of the objects.
A) Peak 1 consists mainly of yellow to red pixels and represents the lesions.
B) Peak 2 consists mainly of green pixels and represents the healthy leaf tissue.
Step 8. Using the histogram as a thresholding tool: Bring the Threshold Panel to the
front and set the ‘Leaf/Lesion’ button to ‘Lesion’. Make sure the color space is ‘HSI’ and
the color plane is ‘H’.
109
Step 9. Stretch the selection rectangle to the left and/or right (or position it) to cover peak
1 (the right side of the rectangle should be in the valley between peaks 1 and 2). This will
select all the red pixels in the AOI (see the figure below) and highlight the lesions.
Background
AOI Leaf 3
Selection tool
Healthy
2
1
Lesions
Step 10. Go to the Threshold Panel and select ‘Leaf’ on the ‘Leaf/Lesion’ button.
Make sure color space is ‘HSI’ and color plane is ‘H’.
Step 11. Stretch the selection tool to the right to cover peaks 1 and 2 (place the right side
of the rectangle between peaks 2 and 3; leave the left side of the rectangle to the left of peak
1, as shown in the figure above). This should select the entire leaf (lesions included).
Notice that the background remains unselected.
Step 12. Move and/or resize the selection tool to cover peak 3 only. Notice that only the
background is selected.
110
Tutorial 16. Programming a macro
Activity: You will open a file and set the threshold levels for the leaf and lesions in the opened
image. You will then make a macro to reflect all the steps taken in analyzing the image.
To keep things simple, we will develop a macro out of the second part of Tutorial 14. We will
assume that the image in the file is fairly typical of a batch of images scanned previously.
Note: Comments (“//xxx”) were inserted at various locations in the macro program developed
below. These are for documentation only. Comments are ignored by the macro interpreter.
Step 1. Open the Macro utility by selecting ‘Macro|Create Macro’ from the Menu Bar.
Step 3. Set the ‘Leaf/Lesion’ button to ‘Leaf’, the color space to ‘HSI’ and the color
plane to ‘H’ (Hue).
Step 4. Set the lower thumb to 31 and the upper thumb to 191 (the leaf should be
overlaid).
Step 5. Set the ‘Leaf/Lesion’ button to ‘Lesion’, the color space to ‘HSI’ and the color
plane ‘H’ (Hue).
Step 6. Set the lower thumb to 31 and the upper thumb to 103 (The lesions should be
overlaid).
Up to here we have set up all the needed values to analyze the image, as we have done in
Tutorial 14. These values are stored in the image window and displayed on the Threshold
Panel.
Step 7. In the ‘Macro source’ dialog box, click on the button with a slider
icon and labeled ‘Settings’. This will ‘download’ all the values we have set in
steps 3 to 6 and convert them into specific calls to Assess.
111
The macro recorder form should look like the form below.
The macro program above sets the Threshold Panel but does not do anything else. The
image is still not thresholded. We need to issue the commands to select the leaf and the
lesions and measure the percent disease.
If we assume that the threshold values are correct and constant (i.e., the same for all
subsequent images) then we can continue the program by appending specific commands to
threshold and measure:
a) Select the leaf: Double-click ‘Select_Leaf’ from the Setup routines (yellow), or drag
this command to the User Macro List.
c) Measure the leaf: Add the command ‘Get_Leaf_Area’ from the Measurement
routines (blue).
112
f) Add ‘Get_Lesion_Area’ to measure the area of the lesions.
The program above should perform everything that was done in Tutorial 14.
2) Execute your macro: Go to the ‘Macro source’ dialog box. Press on the ‘Test Macro’
button and watch the execution. The results should be exactly the same as in Tutorial
14.
113
Important: The program above will be much more useful if we 1) enable the spreadsheet
and 2) provide some means of adjusting the threshold values during execution, so that
we can use it with many other (similar) images.
Spreadsheet:
h) Enable spreadsheet: insert ‘Set_SpreadSheet_ON’ from the Setup routines just
before ‘Get_Percent_Disease’ (drag and drop it or double-click to append it and use the
Up arrow to move it up). Now the spreadsheet is enabled. The next time you play the
macro, you will get data logged into the spreadsheet from all the measurement calls,
because the spreadsheet is on all the time. We have to disable it right after
‘Get_Percent_Disease’.
Fine-tuning the threshold levels (user intervention): The solution is to insert a ‘Pause’.
At execution time the Macro Player will idle, letting you work on the Threshold Panel (or
any other parts of the program) until you press the ‘Resume’ button on the player (which
should be blinking).
j) Insert ‘Pause’ from the Control routines (aqua) between ‘SetHighThreshold(103)’ and
‘Select_Leaf’. Now the program will execute until ‘Pause’. Typically, you will check
that the threshold levels are correct for a new image and then press on the ‘Resume’ button
on the player. Do not delete the image or perform any operation other than adjusting
the threshold levels.
The program we just developed will work on images opened one by one by the user. This
is not a batch processing macro program! To make it a batch program, we still have to add
two more routines: 1) a flag to signal that it is a batch program and 2) an indication where
the loop for the processing starts.
k) Insert ‘Batch_Process’ from the Control routines (aqua) at the very beginning of the
program (drag and drop it or double-click to append it and use the Up arrow to move it up).
l) Insert ‘Start_Batch_Here’ after ‘Batch_Process’. When Assess reads the next file, it
will jump to ‘Start_Batch_here’ and execute all the commands that come after. This will
be done on each of the files supplied in the Macro Player (see Chapter XIII for more on the
Macro Player).
Now we have a program that is capable of batch processing. The ‘Pause’ command allows
you to make minor adjustments to the threshold levels for each file in the batch.
m) Save your macro by clicking on the ‘Save Macro’ button. Give it a name with a ‘.mac’
extension.
114
n) Drag and drop image files into the Macro Player, using Windows Explorer, and click
‘Play’.
Important: Batch processing of images for measurement is very dangerous and may
lead to erroneous data if not executed correctly. The program developed in this
tutorial is solely meant as an exercise on how to write a macro program in Assess.
115
Tutorial 17. Automatic Panel
Make the Automatic Panel visible (if it is not on the screen). To select a panel, click on the
slider button on the Main Toolbar and select the desired panel.
Click on the ‘%Auto’ button on the Automatic Panel. You should read ‘52.82%’! There is
nothing else to do.
If you want to know the percent for each leaf, click on the ‘Detail’ button. The results are
shown in the figure below. Notice the change of appearance in the Automatic Threshold
Panel. The percent necrotic areas are 99.70 and 21.26, for the left and right leaves,
respectively.
116
117
Tutorial 18. The Agronomist Panel
Purpose: To measure percent ground cover using the Agronomist panel.
Make the Agronomist panel visible. To select a panel, click on the slider button on the Main
Toolbar and select the desired panel.
Click on the “GC-Auto” button. The result should be 49.77%, as shown in the figure below.
Note: this operation can also be performed from the Automatic Panel (“%GC” button).
118
Tutorial 19. Macros and the automatic features of Assess
Purpose: to create a “batch” macro to measure plant disease using the automatic features of Assess.
On the Menu bar go to ‘Macro|Create a Macro’.
From the ‘Control’ section of the macro utility, double-click on ‘Batch_Process’ (or drag it to the
user macro list).
From the ‘Control’ section of the macro utility, double-click on ‘Start_Batch_Here’.
Turn on the spreadsheet for writing: drag or double-click on ‘Set_Speadsheet_ON’ from the
‘Setup’ section.
From the ‘Measurement’ section, double-click on ‘Get_Percent_Disease_Auto’
119
Save the macro (click on ‘Save Macro’on the form).
120
XVIII. Questions and answers
1. Q. When I load a new image, the threshold level settings are lost.
A. Assess will keep the settings only if you load the image into an existing image
window. Do not close the window when you are done with the analysis; just load
(or acquire) your next image. The new picture will replace the old one, and all the
settings are kept.
3. Q. When I try to resize or draw the selection rectangle, the image flickers
extensively.
A. Two factors can cause severe flickering:
a) The image may be in stretch mode. You can reduce or eliminate flickering
by checking off the stretch option in the Menu Bar, under ‘View|Stretch’.
b) The image may be very large. Try to create smaller images out of the
original. Position the mouse cursor on the AOI (selection rectangle),
right-click on the mouse and select ‘Make new bitmap from AOI’. You
may also crop the image to remove all unused areas (right-click on the AOI
and select ‘Crop’).
6 Q. When using the ‘% Area’ option, can I mix RGB and HSI color spaces (i.e.,
threshold lesions using HSI and leaf using RGB)?
A. Yes. In this version of Assess, you can mix color spaces and color planes for
disease quantification.
121
Threshold Panel and press ‘Apply’. This will force a resize and redraw of the
overlay. You may go back and turn off the ‘Stretch’ property.
8. Q. I have taken images with a white background. When the images are
thresholded using Hue, some of the background is selected. Is there a way
out?
A. It depends on the object you are measuring. If it has a color (i.e., not a
black-and-white image) and if there is no white in the object (leaf, lesion), you can
substitute the background color with a color that does not occur in the object to be
measured. First, ‘white’ means that the color is undefined (i.e., the saturation is
equal or very close to zero). We can take advantage of this fact and threshold the
image using ‘Saturation’ (‘S’ in the color plane). Once the entire object is selected,
right-click on the Rectangular AOI (bring it to front if it is not visible) to call a
pop-up menu and select ‘Substitute Background’. All the areas which had not
been overlaid (i.e., background) will be converted to a new color (default color is
blue). The default substitution color can be set from the Menu Bar (‘Edit|Select
Background Color’). Once the background color has been changed, the image can
be analyzed using Hue (see Tutorial 14). Alternatively, you can use the
‘Saturation’ color plane to extract the leaf and use the ‘Leaf AOI’ option (Tutorial
5).
9. Q. Every time I position the mouse cursor on the image I see a hand pointer (as
a cursor) and I cannot draw a new AOI.
A. The rectangular AOI tool is active and occupies the entire image. Go to the
Toolbar and reset the AOI (the button is labeled with a red rectangle). This hides
the selection rectangle and gives you the ability to draw a new AOI. The cursor
should now be a cross. Make sure that the overlay is on (check the overlay status
on the Toolbar; it should read ‘Ovl ON’).
122
Appendix
Assess works internally with 24-bit images, regardless of the color depth of the original
image. Each pixel has a red, a green and a blue component (shown as three planes in the
figure below). Each plane is one byte (8 bits) deep, meaning that a pixel can have 28 = 256
values in each of the R-G-B planes. The total number of possible values for each pixel is
therefore 256 x 256 x 256 = 16.7 million). The size of an image is computed as follows:
Size (in bytes) = Width (pixels) * Height (pixels) * Color depth (bytes)
A transparent overlay layer is automatically placed on top of the original RGB image for
drawing (visualizing) pixels of interest. The schematic representation above is what
you see on screen. Three more planes, containing the Hue, Saturation and Intensity planes
are maintained in memory and are not visible.
123
2. Color spaces
124
Suggested Reading
Baxes, G. A. 1984. Digital Image Processing: A Practical Primer. Prentice-Hall, Engelwood
Cliffs, N.J.
Burdik, H .E. 1997. Digital Imaging: Theory and Application. McGraw-Hill, New York.
Foley, J. D. and Van Dam, A. 1990. Fundamentals of Interactive Computer Graphics, 2nd edition.
Addison Wesley, Reading, Mass.
Pratt, W. K. 1991. Digital Image Processing, 2nd edition. John Wiley & Sons, New York.
Russ, J. C. 1998. Image Processing Handbook. CRC Press, Boca Raton, Fla.
125