SoAutoThresholdingQuantification Class Reference
[Statistics]

ImageViz SoAutoThresholdingQuantification engine More...

#include <ImageViz/Engines/ImageAnalysis/Statistics/SoAutoThresholdingQuantification.h>

Inheritance diagram for SoAutoThresholdingQuantification:
SoImageVizEngine SoEngine SoFieldContainer SoBase SoRefCounter SoTypedObject

List of all members.

Classes

class  SbAutoThresholdingDetail
 Results details of threshold by automatic segmentation. More...

Public Types

enum  RangeMode {
  MIN_MAX = 0,
  OTHER = 1
}
enum  ThresholdCriterion {
  ENTROPY = 0,
  FACTORISATION = 1,
  MOMENTS = 2
}

Public Member Functions

 SoAutoThresholdingQuantification ()

Public Attributes

SoSFEnum computeMode
SoSFImageDataAdapter inGrayImage
SoSFEnum rangeMode
SoSFVec2f intensityRangeInput
SoSFEnum thresholdCriterion
SoImageVizEngineAnalysisOutput
< SbAutoThresholdingDetail
outResult

Detailed Description

ImageViz SoAutoThresholdingQuantification engine

The SoAutoThresholdingQuantification engine extracts a value to automaticaly threshold on a gray level image.

Three methods of classification are available: Entropy, Factorisation or Moments. The computed threshold is provided in the SbAutoThresholdingDetail object.

Entropy
The entropy principle defines 2 classes in the image histogram by minimizing the total classes' entropy, for more theory the reader can refers to references [1] and [2]. Considering the first-order probability histogram of an image and assuming that all symbols in the flowing equation are statistically independent, its entropy (in the Shannon sense) is defined as:

\[H=-\sum_{i=0}^{n} p[i] \times \log(p[i])_ 2\]

Where $n+1$ is the number of grayscales, $p[i]$ the probability of occurrence of level and $(x)_2$ is the log in base 2.

Let us denote $t$ the value of the threshold and $[I_1,I_2]$ the search interval. We can define two partial entropies:

\[H_w[t]=-\sum_{I_1}^{t} p_1[i] \times \log(p_1[i])_2\]

\[H_b[t]=-\sum_{t+1}^{I_2} p_2[i] \times \log(p_2[i])_2\]

Where $p_1[i]$ defines the probability of occurrence of level in the range $[I_1,t]$ and $p_2[i]$ defines the probability of occurrence of level $i$ in the range [t+1,I2]. We search the threshold value $T$ which minimizes the sum $S(t)=H_w[t]+H_b[t]$:

\[T=\arg min_t(H_w[t]+H_b[t])\]

SoAutoThresholdProcessing_image01.png
SoAutoThresholdProcessing_image02.png

Figure 1: Example of thresholding using the entropy method

Factorization
The factorization method is based on the Otsu criterion (see [3] for details), i.e. minimizing the within-class variance:

$\sigma^2_W[t]=w_0[t] \times \sigma_0^2[t]+w_1[t] \times \sigma_1^2[t]$

Where $w_0[t]$ and $w_1[t]$ are respectively the probabilities occurrence $^2[t]$ and $^2[t]$ , the variances of classes $C_0$ and $C_1$.

A faster and equivalent approach is to maximize the between-class variance:

\[\sigma_B^2[t]=w_0[t] \times w_1[t] \times (\mu_0[t]-\mu_1[t])^2\]

The within-class variance calculation is based on the second-order statistics (variances) while the between-class variance calculation is based on the first order statistics (means). It is therefore simplest and faster to use this last optimization criterion. We then search the value $T$ which maximizes the between-class variance such as:

\[T=\arg min_t(\sigma_B^2[t])\]

SoAutoThresholdProcessing_image03.png
SoAutoThresholdProcessing_image04.png

Figure 2: Example of thresholding using the factorization method

Moments
The moment SoAutoThresholdingProcessing uses the moment-preserving bi-level thresholding described by W.H.Tsai in [4]. Moments of an image can be computed from its histogram in the following way:

\[m_j=\sum_{i=0}^n p[z_i]^j\]

Where $p[z_i]$ is the probability of occurrence of grayscale $z_i$. For the following we note $f$ the original grayscale image and $g$ the threshold image. Image $f$ can be considered as a blurred version of an ideal bi-level image which consists of pixels with only two gray values: $z_0$ and $z_1$. The moment-preserving thresholding principle is to select a threshold value such that if all below-threshold gray values of the original image are replaced by $z_0$ and all above threshold gray values replaced by $z_1$, then the first three moments of the original image are preserved in the resulting bi-level image. Image $g$ so obtained may be regarded as an ideal unblurred version of $f$. Let $p_0$ and $p_1$ denote the fractions of the below-threshold pixels and the above-threshold pixels in $f$, respectively, then the first three moments of $g$ are:

\[m'_j=\sum_{i=0}^n p[z_i]^j\mbox{, j=0,1,2,3}\]

And preserving the first three moments in $g$, means the equalities:

\[m'_j=m_j\mbox{, j=0,1,2,3}\]

To find the desired threshold value $T$, we can first solve the four equations system to obtain $p_0$ and $p_1$, and then choose $T$ as the $p_0$-tile of the histogram of $f$. Note that $z_0$ and $z_1$ will also be obtained simultaneously as part of the solutions of system.

SoAutoThresholdProcessing_image05.png
SoAutoThresholdProcessing_image06.png

Figure 3: Example of thresholding using the moment-preserving method

[1] T.Pun, Entropic thresholding: A new approach, comput. Graphics Image Process. 16, 1981, 210-239
[2] J. N. Kapur, P. K. Sahoo, and A. K. C. Wong, "A New Method for Gray-Level Picture Thresholding Using the Entropy of the Histogram" Computer Vision, Graphics and Image Processing 29, pp. 273-285, Mar. 1985
[3] Otsu, N. 1979. A thresholding selection method from grayscale histogram. IEEE Transactions on Systems, Man, and Cybernetics9(1): 62-66
[4] Tsai, W. H. 1985. Moment-preserving thresholding: A New Approach. Computer Vision, Graphics, and Image Processing 29: 377-393

SEE ALSO

SoAutoThresholdingProcessing

FILE FORMAT/DEFAULT


Library references: auto_threshold_value


Member Enumeration Documentation

Enumerator:
MIN_MAX 

With this option the histogram is computed between the minimum and the maximum of the image.

OTHER 

With this option the histogram is computed between user-defined bounds intensityRangeInput.

Enumerator:
ENTROPY 

The measure of dispersion used in the algorithm is the entropy of the intensity distribution.

FACTORISATION 

The measure of dispersion used in the algorithm is the variance of the intensity distribution.

MOMENTS 

The measure of dispersion used in the algorithm is the moments of the intensity distribution.


Constructor & Destructor Documentation

SoAutoThresholdingQuantification::SoAutoThresholdingQuantification (  ) 

Constructor.


Member Data Documentation

Select the compute Mode (2D or 3D or AUTO) Use enum ComputeMode.

Default is MODE_AUTO

The input grayscale image Default value is NULL.

Supported types include: grayscale image.

The input intensity range used when rangeMode = OTHER.

Default value is SbVec2f(0.0f,255.0f).

The thresholding results.

Default value is NULL.

The input intensity range.

Use enum RangeMode. Default is MIN_MAX

The criterion to detect thresholds on histogram.

Use enum ThresholdCriterion. Default is ENTROPY


The documentation for this class was generated from the following file:

Open Inventor Toolkit reference manual, generated on 15 Mar 2023
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/