Name
var_thresholdvar_thresholdVarThresholdvar_thresholdVarThresholdVarThreshold — Threshold an image by local mean and standard deviation analysis.
Herror var_threshold(const Hobject Image, Hobject* Region, const Hlong MaskWidth, const Hlong MaskHeight, double StdDevScale, double AbsThreshold, const char* LightDark)
Herror T_var_threshold(const Hobject Image, Hobject* Region, const Htuple MaskWidth, const Htuple MaskHeight, const Htuple StdDevScale, const Htuple AbsThreshold, const Htuple LightDark)
Herror var_threshold(Hobject Image, Hobject* Region, const HTuple& MaskWidth, const HTuple& MaskHeight, const HTuple& StdDevScale, const HTuple& AbsThreshold, const HTuple& LightDark)
HRegion HImage::VarThreshold(const HTuple& MaskWidth, const HTuple& MaskHeight, const HTuple& StdDevScale, const HTuple& AbsThreshold, const HTuple& LightDark) const
HRegionArray HImageArray::VarThreshold(const HTuple& MaskWidth, const HTuple& MaskHeight, const HTuple& StdDevScale, const HTuple& AbsThreshold, const HTuple& LightDark) const
void VarThreshold(const HObject& Image, HObject* Region, const HTuple& MaskWidth, const HTuple& MaskHeight, const HTuple& StdDevScale, const HTuple& AbsThreshold, const HTuple& LightDark)
HRegion HImage::VarThreshold(Hlong MaskWidth, Hlong MaskHeight, const HTuple& StdDevScale, const HTuple& AbsThreshold, const HString& LightDark) const
HRegion HImage::VarThreshold(Hlong MaskWidth, Hlong MaskHeight, double StdDevScale, double AbsThreshold, const HString& LightDark) const
HRegion HImage::VarThreshold(Hlong MaskWidth, Hlong MaskHeight, double StdDevScale, double AbsThreshold, const char* LightDark) const
void HOperatorSetX.VarThreshold(
[in] IHUntypedObjectX* Image, [out] IHUntypedObjectX** Region, [in] VARIANT MaskWidth, [in] VARIANT MaskHeight, [in] VARIANT StdDevScale, [in] VARIANT AbsThreshold, [in] VARIANT LightDark)
IHRegionX* HImageX.VarThreshold(
[in] Hlong MaskWidth, [in] Hlong MaskHeight, [in] VARIANT StdDevScale, [in] VARIANT AbsThreshold, [in] BSTR LightDark)
static void HOperatorSet.VarThreshold(HObject image, out HObject region, HTuple maskWidth, HTuple maskHeight, HTuple stdDevScale, HTuple absThreshold, HTuple lightDark)
HRegion HImage.VarThreshold(int maskWidth, int maskHeight, HTuple stdDevScale, HTuple absThreshold, string lightDark)
HRegion HImage.VarThreshold(int maskWidth, int maskHeight, double stdDevScale, double absThreshold, string lightDark)
The operator var_thresholdvar_thresholdVarThresholdvar_thresholdVarThresholdVarThreshold selects from the input image
ImageImageImageImageImageimage those regions RegionRegionRegionRegionRegionregion in which the pixels
fulfill a threshold condition. The threshold is calculated from the
mean gray value and the standard deviation in a local window of size
MaskWidthMaskWidthMaskWidthMaskWidthMaskWidthmaskWidth x MaskHeightMaskHeightMaskHeightMaskHeightMaskHeightmaskHeight around each pixel
(x,y). If MaskWidthMaskWidthMaskWidthMaskWidthMaskWidthmaskWidth or MaskHeightMaskHeightMaskHeightMaskHeightMaskHeightmaskHeight is even, the
next larger odd value is used. The mask window should be greater
than the image features to be segmented and it should comprise at
least three pixels.
Let g(x,y) be the gray value at position (x,y) in the input
image ImageImageImageImageImageimage and m(x,y) and d(x,y) the corresponding
mean and standard deviation of the gray values in the window around
that pixel and
v(x,y) = max( StdDevScaleStdDevScaleStdDevScaleStdDevScaleStdDevScalestdDevScale * d(x,y),AbsThresholdAbsThresholdAbsThresholdAbsThresholdAbsThresholdabsThreshold)
for StdDevScaleStdDevScaleStdDevScaleStdDevScaleStdDevScalestdDevScale >= 0
or
v(x,y) = min( StdDevScaleStdDevScaleStdDevScaleStdDevScaleStdDevScalestdDevScale * d(x,y),AbsThresholdAbsThresholdAbsThresholdAbsThresholdAbsThresholdabsThreshold)
for $StdDevScaleStdDevScaleStdDevScaleStdDevScaleStdDevScalestdDevScale < 0$.
The standard deviation is used as a measure of noise in the image
and scaled by StdDevScaleStdDevScaleStdDevScaleStdDevScaleStdDevScalestdDevScale to reflect the desired
sensitivity. The threshold condition is determined by the parameter
LightDarkLightDarkLightDarkLightDarkLightDarklightDark:
LightDarkLightDarkLightDarkLightDarkLightDarklightDark = 'light'"light""light""light""light""light":
g(x,y) >= m(x,y) + v(x,y).
LightDarkLightDarkLightDarkLightDarkLightDarklightDark = 'dark'"dark""dark""dark""dark""dark":
g(x,y) <= m(x,y) - v(x,y).
LightDarkLightDarkLightDarkLightDarkLightDarklightDark = 'equal'"equal""equal""equal""equal""equal":
m(x,y) - v(x,y) <= g(x,y)
<= m(x,y) + v(x,y).
LightDarkLightDarkLightDarkLightDarkLightDarklightDark = 'not_equal'"not_equal""not_equal""not_equal""not_equal""not_equal":
m(x,y) - v(x,y) > g(x,y) or g(x,y) > m(x,y) + v(x,y).
All pixels fulfilling the above condition are aggregated into the
resulting region RegionRegionRegionRegionRegionregion.
For the parameter StdDevScaleStdDevScaleStdDevScaleStdDevScaleStdDevScalestdDevScale values between -1.0 and
1.0 are sensible choices, with 0.2 as a suggested value. If the
parameter is too high or too low, an empty or full region may be
returned. The parameter AbsThresholdAbsThresholdAbsThresholdAbsThresholdAbsThresholdabsThreshold places an additional
threshold on StdDevScaleStdDevScaleStdDevScaleStdDevScaleStdDevScalestdDevScale*d(x,y). If
StdDevScaleStdDevScaleStdDevScaleStdDevScaleStdDevScalestdDevScale*d(x,y) is below AbsThresholdAbsThresholdAbsThresholdAbsThresholdAbsThresholdabsThreshold for
positive values of StdDevScaleStdDevScaleStdDevScaleStdDevScaleStdDevScalestdDevScale or above for negative
values StdDevScaleStdDevScaleStdDevScaleStdDevScaleStdDevScalestdDevScale, AbsThresholdAbsThresholdAbsThresholdAbsThresholdAbsThresholdabsThreshold is taken
instead.
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Automatically parallelized on tuple level.
- Automatically parallelized on domain level.
Mask width for mean and deviation calculation.
Default value: 15
Suggested values: 9, 11, 13, 15
Restriction: MaskWidth >= 1
Mask height for mean and deviation calculation.
Default value: 15
Suggested values: 9, 11, 13, 15
Restriction: MaskHeight >= 1
Factor for the standard deviation of the gray values.
Default value: 0.2
Suggested values: -0.2, -0.1, 0.1, 0.2
Minimum gray value difference from the mean.
Default value: 2
Suggested values: -2, -1, 0, 1, 2
Threshold type.
Default value:
'dark'
"dark"
"dark"
"dark"
"dark"
"dark"
List of values: 'dark'"dark""dark""dark""dark""dark", 'equal'"equal""equal""equal""equal""equal", 'light'"light""light""light""light""light", 'not_equal'"not_equal""not_equal""not_equal""not_equal""not_equal"
Let A be the area of the input region, then the runtime is O(A).
var_thresholdvar_thresholdVarThresholdvar_thresholdVarThresholdVarThreshold returns 2 (H_MSG_TRUE) if all parameters are correct.
The behavior with respect to the input images and output regions can
be determined by setting the values of the flags 'no_object_result',
'empty_region_result', and 'store_empty_region' with set_system. If
necessary, an exception is raised.
dyn_thresholddyn_thresholdDynThresholddyn_thresholdDynThresholdDynThreshold,
thresholdthresholdThresholdthresholdThresholdThreshold
W.Niblack, ”An Introduction to Digital Image Processing”, Page 115-116,
Englewood Cliffs, N.J., Prentice Hall, 1986
Foundation