Threshold

Threshold[data]

thresholds data by replacing values close to zero by zero.

Threshold[data,tspec]

thresholds data using threshold specification tspec.

Threshold[image,]

thresholds an image.

Threshold[sound,]

thresholds a sound object.

Details

  • Threshold works with 3D as well as 2D images, and also with data arrays of any rank.
  • Threshold[data] is equivalent to Threshold[data,{"Hard",10-10}].
  • The threshold specification tspec can be of the form {tfun,pars}.
  • Possible tfun names and options include:
  • {"Hard",δ}0 TemplateBox[{x}, Abs]<=delta; x TemplateBox[{x}, Abs]>delta
    {"Soft",δ} 0 TemplateBox[{x}, Abs]<=delta; sgn(x) (TemplateBox[{x}, Abs]-delta) TemplateBox[{x}, Abs]>delta;
    {"Firm",δ,r,p} 0 TemplateBox[{x}, Abs]<=delta-delta p r; (sgn(x) (delta+delta r-delta p  r) (TemplateBox[{x}, Abs]-delta+delta p r))/(delta r) delta-delta p r<TemplateBox[{x}, Abs]<=delta+delta (-p) r+delta r; x TemplateBox[{x}, Abs]>delta+delta (-p) r+delta r;
    {"PiecewiseGarrote",δ}0 TemplateBox[{x}, Abs]<=delta; x-(delta^2)/x TemplateBox[{x}, Abs]>delta
    {"SmoothGarrote",δ,n}
    {"Hyperbola",delta} 0 TemplateBox[{x}, Abs]<=delta; sgn(x) sqrt(x^2-delta^2) TemplateBox[{x}, Abs]>delta;
    {"LargestValues",k}keep the largest k data points
  • In all cases delta is assumed to be a positive number or a thresholding function tfunc to compute delta. Each tfunc[data] should return a positive number.
  • The parameter conditions for "Firm" are that r is a positive real and p a real number between 0 and 1.
  • The parameter conditions for "SmoothGarrote" is to have n be a positive machine integer.
  • The threshold delta can be automatically computed using the following methods:
  • {"BlackFraction",b}make a fraction b of all pixels be black
    "Cluster"cluster variance maximization (Otsu's algorithm)
    "Entropy"histogram entropy minimization (Kapur's method)
    "Mean"use the mean level as the threshold
    "Median"use the median pixel level as the threshold
    "MinimumError"KittlerIllingworth minimum error thresholding method

Examples

open allclose all

Basic Examples  (3)

Zero out elements that are very close to 0:

Perform a clustering threshold on an image:

Use a "Soft" threshold function:

Keep 5 largest data values:

Properties & Relations  (5)

"Hard" thresholding is similar to Chop:

Data values with absolute value below threshold delta are set to 0:

"Soft" thresholding performs a shrinking operation:

Data values below a certain threshold are set to 0; those above are "shrunk" by :

"Firm" thresholding is a compromise between "Hard" and "Soft" thresholding:

"Firm" thresholding has uniformly smaller variance than "Hard" thresholding:

In the limit β->, "Firm" threshold performs "Soft" thresholding:

In the limit β->η, "Firm" threshold performs "Hard" thresholding:

"PiecewiseGarrote" thresholding:

This is similar to "Firm" thresholding with the advantage of having a single parameter delta:

"SmoothGarrote" thresholding:

In the limit n->, "SmoothGarrote" goes to "Hard" thresholding:

Introduced in 2010
 (8.0)
 |
Updated in 2012
 (9.0)