Namespace: Stemmer.Cvb.Foundation
Assembly: Stemmer.Cvb.Foundation (in Stemmer.Cvb.Foundation.dll) Version: 14.0.0.0
Parameters
- img
- Type: Stemmer.CvbImage
Image to be thresholded. - windowSize
- Type: SystemInt32
Window size to be for calculating the dynamic threshold.
Bigger window sizes will lead to higher processing times.
- threshold
- Type: SystemInt32
Threshold offset to use
Return Value
Type: ImageThe thresholded image.
Exception | Condition |
---|---|
ArgumentNullException | If the input img is null |
ObjectDisposedException | If the input img has already been disposed |
Dynamic thresholding works such that for each pixel of the input image, the average gray value over a mask with given size (centered around the pixel in question) is calculated. If the difference between this average and the pixel that is currently being looked at is above the specified threshold, then the corresponding pixel in the output image is set to white, otherwise it is black.
This function is particularly useful when dealing with images that have a non-uniform illumination.