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:

PartDescription
objectAn expression evaluating to an object of type McHistogram.
MethodOptional. A mcHistThresholdsMethod enumeration, as described in settings.

The thresholding method and any optional flags.

NumberOfPhasesOptional. 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.

TrimLeftPercentOptional. 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.

TrimRightPercentOptional. 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.

MethodDependentOptional. 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:

ConstantValueDescription
 mchmCurrentMethod0

Whatever method was already set.

 mchmMinimumVarianceMethod1

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.

 mchmLegacyIPP4Method2

A version of MinimumVariant with a bias towards low values. works with two phases only.

 mchmTrimmedHistogramMethod3

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.

 mchmMaskMethods255

mask for the mchtmXxxxMethod values

 mchmIgnoreBlack4096

Pixels in the leftmost bin are not included in the threshold computations, allowing you to ignore under illuminanted regions.

 mchmIgnoreWhite8192

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.