Northern Eclipse Help Reference

 Threshold


This function is used to select objects in an image by specifying range(s) of values that differentiate it from the rest of the image. This process is alternatively known as binarization, segmentation, or object detection.  Each pixel is tested independently and it is either selected or not according to the same criteria.  The goal is to adjust the range(s) until only the pixels in the object are selected.  This happens differently depending on whether the image is monochrome or color.

Monochrome (8 or 16 bit) thresholding:

You will need to select a range of intensities that corresponds to the gray values in the object.  The gray values can be seen in the main status bar by moving the mouse over the image before calling this function.  The display will change as you adjust the values, showing you the selected pixels in red/white and unselected pixels in cyan/black.  The range will be between 0 and 255 for 8-bit images and 0 to 65535 for 16-bit images. 

If the “From” value is higher than the “To” value, then the range will wrap around effectively selecting every value except what falls between the range markers. 

When you are satisfied with the results click on Close.  If you ever want to remove the threshold from an image, select Threshold and turn off the “Threshold Image” check box.

Color (24 bit) thresholding:

Color thresholding is more complex since every pixel has 3 intensities associated with it (RGB or HSV).  You need to adjust the ranges so that each pixel falls within all three ranges.  You can work in either RGB or HSV models, but HSV is recommended since it is more intuitive.  You can use the region selection tools to select one or more small regions on the image, and by clicking on “Update from Selection” the ranges will be adjusted to select those pixels.  You can also use the eyedropper tool to add pixels to the range.  Selected pixels show up in their normal pixel color, but unselected pixels show up in dark gray.  You can choose to use less ranges by unchecking the range that you don’t want to use. 

Each range has it’s own “From” and “To”, and the ranges are tested independently.  If the “From” value is higher than the “To” value then the range will wrap around effectively selecting every value except what falls between the range markers. 

Sometimes, all the information needed to successfully threshold an image is present in one plane only in a color image.  This color plane (R,G,B,H,S,V) can be extracted and treated like a monochrome image, which is much easier to threshold. 

When you are satisfied with the results, click on Close.  If you ever want to remove the threshold from an image, select Threshold and turn off the “Threshold Image” check box.

Common Thresholding problems:

Thresholding alone may not always be able to determine what is an object.  These common problems can be solved with steps taken either before or after the threshold step.  Note that some images may have more than one of these problems at the same time.  We recommend that you try to minimize or remove the problem(s) at the source for best results.  Not every image can be successfully thresheld. 

1) Uneven Illumination:
An unevenly illuminated scene will cause problems and will need to be handled before the threshold step by using background subtraction (see Boolean) or Adaptive Threshold.  This is the most common threshold problem.

2) Noise:
If the image has noise in it you will need to process the image to remove the noise.  You can use a convolution filter or a binary operation to remove many types of noise.  If the noise is a single, or small # of pixels, then it can be filtered by the Object Size Filter under Data Options.

3) Debris:
Sometimes the range that selects your object also selects debris or unwanted objects.  If they are smaller or larger, or have a much different shape than the object you want, then you can use bin classification to classify and not include those objects that fall within that bin.  You could alternatively classify the objects you do want and not include any objects that do not fall within your bin.  You can also select the objects that you want with a region selection tool before measuring and use a region policy under Data Options.  Finally, you can just choose to ignore the data that corresponds to those unwanted objects.

4) Holes:
Sometimes the brightness in the center of the object has a bright glint or has an area that, if selected, would also select unwanted pixels.  In that case you can use the Fill Holes option under Data Options to automatically fill all closed objects prior to measuring.  Note that there cannot be a break in the perimeter for this to work.  Note that this is different than the fill holes command, which actually changes the image data in order for the holes to be selected.

5) Contrast Lighting techniques:
Some contrast lighting techniques enhance contrast in an image by brightening one edge of an object and darkening the opposite edge, giving it an embossed look.  This hides the “true” edge and makes the center of the object the same intensity as the background.  Sometimes you can threshold just the edges using the wraparound range method discussed earlier and rely on fill holes for the rest.  If the edges don’t form a complete perimeter then a combination of convolution filters, Boolean operations, and Binary Operations may be needed in order to threshold an image.

6) Touching Objects:
Sometimes objects end up touching and being measured as one object when they should be 2 (or more).  Once thresheld, these objects can be separated by using a touchup tool to physically separate them.  Alternatively, you can use the shape factor to determine from the shape if it is one object or two (or three).  Another solution exists if they are all approximately the same size and you just want a count.  Calculate the size of one object by itself.  Threshold the objects and take the total object area and divide it by the single object area to get a “statistical count”, that is usually close enough to a true count but requires much less work than manual separation.  The difficulty in successfully separating overlapping objects is in direct proportion to the percentage of overlap expected.

Thresholding requires practice for most people.  If you have any other thresholding problems, you may need to contact your local dealer for assistance.


See Also

Auto Threshold Bright, Auto Threshold Dark, Adaptive Threshold

References

Table of Contents
Function Reference
Menu Reference
Toolbar Reference