Description
Sets the method and parameters used to compute the Thresholds property.
-
Return Type
-
None
-
Syntax
-
object.SetThresholdParameters [Method], [NumberOfPhases], [TrimLeftPercent], [TrimRightPercent], [MethodDependent]
The SetThresholdParameters Method syntax has these parts: |
| object | An expression evaluating to an object of type McHistogram. | | Method | Optional. A mcHistThresholdsMethod enumeration, as described in settings. The thresholding method and any optional flags.
| | NumberOfPhases | Optional. A Long value. Each thresholding Method can support a maximum number of Phases. A Phase is a segment of the luminance range to be thresholded. All Methods support at least two Phases (dark and bright); several support three (dark, middling and bright), and some support many Phases. The maximum number of phases supported by a given Method is available via the MaxThresholdPhases property. This is 2 by default.
| | TrimLeftPercent | Optional. A Double value. For histogram-based methods, the percentage of the pixels to trim from the left of the histogram before computing the thresholds. This is zero by default.
| | TrimRightPercent | Optional. A Double value. For histogram-based methods, the percentage of the pixels to trim from the right of the histogram before computing the thresholds. This is zero by default.
| | MethodDependent | Optional. A Double value. Extra parameter data needed for some methods. This is missing by default as most methods do not need any such parameters.
| Settings The settings for Method are:
 | mchmCurrentMethod | 0 |
Whatever method was already set.
|
 | mchmMinimumVarianceMethod | 1 |
The ratio of between-phase to total variance is minimized (method of Otsu). Works with either two or three phases. This is the default method if SetThresholdParameters has not been called.
|
 | mchmLegacyIPP4Method | 2 |
A version of MinimumVariant with a bias towards low values. works with two phases only.
|
 | mchmTrimmedHistogramMethod | 3 |
Three phases are computed, based on the TrimLeftPercent and TrimRightPercent arguments to SetThresholdParameters. Phase 0 is the leftmost, trimmed section of the histogram, Phase 1 is the middle section between the trimmed portions, and Phase 2 is the rightmost, trimmed section of the histogram. If only two phases are set as the NumberOfPhases, then only the left two are available.
|
 | mchmMaskMethods | 255 |
mask for the mchtmXxxxMethod values
|
 | mchmIgnoreBlack | 4096 |
Pixels in the leftmost bin are not included in the threshold computations, allowing you to ignore under illuminanted regions.
|
 | mchmIgnoreWhite | 8192 |
Pixels in the rightmost bin are not included in the threshold computations, allowing you to ignore oversaturated regions.
|
Remarks
If the mchmIgnoreBlack or mchmIgnoreWhite flags are set in the Method, then the black (leftmost bin) or white (rightmost bin) pixels are removed before applying any TrimLeftPercent or TrimRightPercent, respectively. That is, the trim percentages refer to percentages of total number of pixels after, not before, the optional removal of saturated pixels.
A SetThresholdParameters Property Changed notify is fired when any of the parameters is changed.
Exceptions
The NumberOfPhases must be between 2 and the MaxThresholdPhases for the specified Method.
|