ThresholdThe Threshold module is used to remove parts of the image that fall within a specified intensity range. This module can be used to segment objects of consistent intensity values (i.e. remove black or white parts of the image).
The interface displays the intensity histogram. Histograms chart the pixel value (0-255) on the X axis with the number of pixels (0-image size) having that intensity value on the Y axis. Using the histograms you can filter pixels with those values out of the image leaving the desired object in view.
The Histogram is set to ignore all black and all white pixels in the chart. This allows for somewhat dark or light images to still show a useful histogram. These values can be added back in if needed but they do not affect the threshold operation.
Note that when lighting conditions change the values you used may fail to segment the image correctly. Be sure to specify as wide a threshold value as possible to account for these changes.
1. Enter the From and To range to specify the part of the histogram you would like to preserve. You can also use the scroll triangles ontop of the histograms to drag the mask to the appropriate spot. Dragging the scroll or specifying the range will change the current image to reflect the masked out places.
2. If you would like to see the histogram in a line format select the "Line Graph" radio button.
3. If you would like to create a mask (i.e. a white pixel) instead of preserving the current pixel values select 'Create Mask'. This will replace all non-masked pixels with a white color.
4. Often image histograms can become somewhat unusable due to excessive 0 (black) or 255 (white) pixels. To remove these two values from the histogram graph and increase the resolution of lower count pixels select the "Ignore Black Pixels" or "Ignore White Pixels". This will remove those values from the histogram to reveal better detail for other pixel counts.
5. Select the Hysteresis amount. See below for a discussion on Hysteresis.
6. If you want to threshold color saturation select the appropriate radio button ontop of the histogram. This will cause the module to use the color intensity as the histogram comparison and not the image intensity. This can be used as an effective way to remove non-colored objects from the image.
One of the issue with thresholding based on absolute values are pixels that fall just below or above the thresholding limit. Live images from cameras (esp WebCams) will flicker a lot in terms of pixel color and intensity. This gives the image a 'live' feeling even when viewing a stationary object. When the image is thresholded large portions of the image may be just at the threshold boundary and in some frames will be in the valid part of the image and sometimes not. To reduce this problem one can widen the threshold values encompassing more of the pixels that are flickering from image to image. This, however, causes much more of the image to not be thresholded which may render the action of thresholding useless.
To solve this issue hysteresis can be used. Using a hysteresis amount will act similar to widening the threshold values BUT only for pixels connected to the current hard threshold. Thus, you can really tighten the thresholded values and then increase the hysteresis amount which will cause the object the increase in area but NOT include other parts of the image that would have been if the threshold were simply increased.
As a simple explanation think of hysteresis are widening the area of the object after thresholding is complete.
|Red Filtered and Thresholded
From the example above you can see that the wood chips below the car have a lot of red components in them. If we want to remove that area from the image we have to threshold the image with a very high tight range which removes most of the license plate (see first image below). This renders the thresholding someone useless. Introducing hysteresis, however, allows us to include most of the license plate back into the image without including the wood chip areas since the license plate has the reddest parts of the image in comparison to the wood chips.
|Extreme Thresholded Image (Masked)
|With Hysteresis (Masked)
For more information
Wikipedia - Thresholding
FIP - Segmentation
| New Post
|Threshold Related Forum Posts
RR keeps crashing, no historogram, out-of-memory error / win7 pro 64bit
Hi, after an long search I found your software which is really great and will work well for my application.
Hi, I am trying to detect the border's of curved metal plate, i want to matc...
Looking for a solution to use the software for a solar tracker by attaching a mirror to a pan tilt device. Following steps are r...
I have searched the forum and documentation, but have not found a good solution to my issue. I have...