ClassesClassesClassesClasses | | | | Operators

histo_to_threshT_histo_to_threshHistoToThreshhisto_to_threshHistoToThreshHistoToThresh (Operator)

Name

histo_to_threshT_histo_to_threshHistoToThreshhisto_to_threshHistoToThreshHistoToThresh — Determine gray value thresholds from a histogram.

Signature

histo_to_thresh( : : Histogramm, Sigma : MinThresh, MaxThresh)

Herror T_histo_to_thresh(const Htuple Histogramm, const Htuple Sigma, Htuple* MinThresh, Htuple* MaxThresh)

Herror histo_to_thresh(const HTuple& Histogramm, const HTuple& Sigma, HTuple* MinThresh, HTuple* MaxThresh)

void HistoToThresh(const HTuple& Histogramm, const HTuple& Sigma, HTuple* MinThresh, HTuple* MaxThresh)

void HOperatorSetX.HistoToThresh(
[in] VARIANT Histogramm, [in] VARIANT Sigma, [out] VARIANT* MinThresh, [out] VARIANT* MaxThresh)

static void HOperatorSet.HistoToThresh(HTuple histogramm, HTuple sigma, out HTuple minThresh, out HTuple maxThresh)

Description

histo_to_threshhisto_to_threshHistoToThreshhisto_to_threshHistoToThreshHistoToThresh determines gray value thresholds from a histogram for a segmentation of an image using thresholdthresholdThresholdthresholdThresholdThreshold. The thresholds returned are 0, the maximum gray value in the histogram, and all minima extracted from the histogram. Before the thresholds are determined, the histogram is smoothed with a Gaussian smoothing function.

histo_to_threshhisto_to_threshHistoToThreshhisto_to_threshHistoToThreshHistoToThresh can process the absolute and relative histograms that are returned by gray_histogray_histoGrayHistogray_histoGrayHistoGrayHisto. Note, however, that here only byte images should be used, because otherwise the returned thresholds cannot easily be transformed to the thresholds for the actual image. For images of type uint2, the histograms should be computed with gray_histo_absgray_histo_absGrayHistoAbsgray_histo_absGrayHistoAbsGrayHistoAbs since this facilitates a simple transformation of the thresholds by simply multiplying the thresholds with the quantization selected in gray_histo_absgray_histo_absGrayHistoAbsgray_histo_absGrayHistoAbsGrayHistoAbs. For uint2 images, it is important to ensure that the quantization must be chosen in such a manner that the histogram still contains salient information. For example, a 640 x 480 image with 16 bits per pixel gray value resolution contains on average only 307200 / 65536 = 4.7 entries per histogram bin, i.e., the histogram is too sparsely populated to derive any useful statistics from it. To be able to extract useful thresholds from such a histogram, SigmaSigmaSigmaSigmaSigmasigma would have to be set to an extremely large value, which would lead to very high run times and numerical problems. The quantization in gray_histo_absgray_histo_absGrayHistoAbsgray_histo_absGrayHistoAbsGrayHistoAbs should therefore normally be chosen such that the histogram contains a maximum of 1024 entries. Hence, for images with more than 10 bits per pixel, the quantization must be chosen greater than 1. The histogram returned by gray_histo_absgray_histo_absGrayHistoAbsgray_histo_absGrayHistoAbsGrayHistoAbs should furthermore be restricted to the parts that contain salient information. For example, for an image with 12 bits per pixel, the quantization should be set to 4. Only the first 1024 entries of the computed histogram (which contains 16384 entries in this example) should be passed to histo_to_threshhisto_to_threshHistoToThreshhisto_to_threshHistoToThreshHistoToThresh. Finally, MinThreshMinThreshMinThreshMinThreshMinThreshminThresh must be multiplied by 4 (i.e., the quantization), while MaxThreshMaxThreshMaxThreshMaxThreshMaxThreshmaxThresh must be multiplied by 4 and increased by 3 (i.e., the quantization minus 1).

Parallelization

Parameters

HistogrammHistogrammHistogrammHistogrammHistogrammhistogramm (input_control)  histogram-array HTupleHTupleHTupleVARIANTHtuple (integer / real) (int / long / double) (Hlong / double) (Hlong / double) (Hlong / double) (Hlong / double)

Gray value histogram.

SigmaSigmaSigmaSigmaSigmasigma (input_control)  number HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Sigma for the Gaussian smoothing of the histogram.

Default value: 2.0

Suggested values: 0.5, 1.0, 2.0, 3.0, 4.0, 5.0

Typical range of values: 0.5 ≤ Sigma Sigma Sigma Sigma Sigma sigma ≤ 30.0 (lin)

Minimum increment: 0.01

Recommended increment: 0.2

MinThreshMinThreshMinThreshMinThreshMinThreshminThresh (output_control)  integer-array HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Minimum thresholds.

MaxThreshMaxThreshMaxThreshMaxThreshMaxThreshmaxThresh (output_control)  integer-array HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Maximum thresholds.

Example (HDevelop)

* Calculate thresholds from a byte image and threshold the image.
gray_histo (Image, Image, AbsoluteHisto, RelativeHisto)
histo_to_thresh (AbsoluteHisto, 4, MinThresh, MaxThresh)
threshold (Image, Region, MinThresh, MaxThresh)

* Calculate thresholds from a 12 bit uint2 image and threshold the image.
gray_histo_abs (Image, Image, 4, AbsoluteHisto)
AbsoluteHisto := AbsoluteHisto[0:1023]
histo_to_thresh (AbsoluteHisto, 16, MinThresh, MaxThresh)
MinThresh := MinThresh*4
MaxThresh := MaxThresh*4+3
threshold (Image, Region, MinThresh, MaxThresh)

Possible Predecessors

gray_histogray_histoGrayHistogray_histoGrayHistoGrayHisto

Possible Successors

thresholdthresholdThresholdthresholdThresholdThreshold

See also

auto_thresholdauto_thresholdAutoThresholdauto_thresholdAutoThresholdAutoThreshold, binary_thresholdbinary_thresholdBinaryThresholdbinary_thresholdBinaryThresholdBinaryThreshold, char_thresholdchar_thresholdCharThresholdchar_thresholdCharThresholdCharThreshold

Module

Foundation


ClassesClassesClassesClasses | | | | Operators