Optimum Global Thresholding Using Otsu's Method

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Optimum Global Thresholding Using Otsu’s Method

Otsu’s method is optimum in the sense that it maximizes the between-class variance, a
well-known measure used in statistical discriminant analysis. The basic idea is that well-
thresholded classes should be distinct with respect to the intensity values of their pixels and,
conversely, that a threshold giving the best separation between classes in term of their intensity
values would be the best threshold. In addition to its optimality, Otsu’s method has the important
property that is based entirely on computations performed on the histogram of an image, an
easily obtainable 1-D array.

Otsu’s algorithm may be summarized as follows:

1. Compute the normalized histogram of the input image. Denote the components of the
histogram by pi, i=0, 1, 2, …, L-1.
2. Compute the cumulative sums, P1(k), for k =0, 1, 2, ..., L-1, using Eq:
k
P1(k) = ∑ pi
i=0

3. Compute the cumulative means, m(k), for k=0, 1, 2, …, L-1, using Eq:
k
m(k) = ∑ i p i
i=0

4. Compute the global intensity mean, mG, using Eq:


L−1
mG = ∑ ip i
i=0

5. Compute the between-class variance, σ2B(k), for k=0, 1, 2, …, L-1, using Eq:

2
[mG P 1 ( k ) −m(k )]2
σ B(k) =
P1 ( k ) [1−P1 ( k ) ]
6. Obtain the Otsu threshold, k*, as the value of k for which σ 2B(k) is maximum. If the
maximum is not unique, obtain k* by averaging the values of k corresponding to the
various maxima detected.
7. Obtain the separability measure, η*, by evaluating the following equation at k=k*.
σ 2B (k )
η(k) =
σ 2G
The Canny Edge Detector

The Canny method is generally acknowledged as the best ‘all-round’ edge detection
method developed to date. Canny aimed to develop an edge detector that satisfied three key
criteria:

1. A low error rate.


2. The detected edge points should be well localized.
3. There should be only one response to a single edge.
The basic procedure can be summarized in the following steps:
1. The image is first smoothed using a Gaussian kernel: Gradient operators are sensitive
to noise and this preliminary step is taken to reduce the image noise. The greater the
width of the kernel, the more smoothing (i.e. noise reduction) is achieved. However,
larger kernels result in a greater error in the edge location.
2. Find the edge strength: This is achieved by taking the gradient of the image with the
Sobel operators in the horizontal and vertical directions and then adding the
magnitude of these components as a measure of the ‘edge strength’. Thus E(x,y) = |
Gx(x,y)|+|Gy(x,y)|.
3. Calculate the edge direction: This is easily calculated as
−1 Gy (x , y )
Θ = tan
Gx( x , y )
4. Digitize the edge direction: Once the edge direction is known, we approximate it to
an edge direction that can be traced in a digital image. Considering an arbitrary pixel,
the direction of an edge through this pixel can take one of only four possible values -
0° (neighbours to east and west), 90° (neighbours to north and south), 45°
(neighbours to north-east and south-west) and 135° (neighbours to north-west and
south-east). Accordingly, we approximate the calculated u by whichever of these four
angles is closest in value to it.
5. Nonmaximum suppression: After the edge directions are known, nonmaximum
suppression is applied. This works by tracing along the edge in the edge direction and
suppressing any pixel value (i.e. set it equal to zero) that is not considered to be an
edge. This will give a thin line in the output image.
6. Hysteresis: After the first five steps have been completed, the final step is to track
along the remaining pixels that have not been suppressed and threshold the image to
identify the edge pixels. Critical to the Canny method, however, is the use of two
distinct thresholds – a higher value T2 and a lower value T1. The fate of each pixel is
then determined according to the following criteria:
 if |E(x,y)| < T1, then the pixel is rejected and is not an edge pixel;
 if |E(x,y)| >T2, then the pixel is accepted and is an edge pixel;
 if T1 < |E(x,y)| < T2, the pixel is rejected except where a path consisting
of edge pixels connects it to an unconditional edge pixel with |E(x,y)| >T2.

Entropy-Based Thresholding
Entropy measures of thresholding are based on the concept of entropy. The entropy
statistic is high if a variable is well distributed over the available range, and low if it is well
ordered and narrowly distributed: specifically, entropy is a measure of disorder, and is zero for a
perfectly ordered system. The concept of entropy thresholding is to threshold at an intensity for
which the sum of the entropies of the two intensity probability distributions thereby separated is
maximized. The reason for this is to obtain the greatest reduction in entropy—i.e., the greatest
increase in order—by applying the threshold: in other words, the most appropriate threshold
level is the one that imposes the greatest order on the system, and thus leads to the most
meaningful result.
The intensity probability distribution is again divided into two classes—those with gray
levels up to the threshold value k and those with gray levels above k. This leads to two
probability distributions A and B:
p 1 p2 pk
A: , , …,
Pk Pk Pk
pk +1 pk +2 pL
B: , , …,
1−Pk 1−Pk 1−Pk
where
k
Pk = ∑ pi
i=1

L
1-Pk = ∑ pi
i=k+1

The entropies for each class are given by:


k
pi p
H(A) = -∑ ln ⁡( i )
i=1 Pk Pk
L
pi pi
H(B) = - ∑ ln ⁡( )
i=k+1 1−P k 1−P k
And the total entropy is:
H(k) = H(A) + H(B)

LAWS’ Texture Energy Approach


Laws’ texture energy approach involved the application of simple filters to digital
images. The basic filters he used were common Gaussian, edge detector, and Laplacian-type
filters, and were designed to highlight points of high “texture energy” in the image. By
identifying these high energy points, smoothing the various filtered images, and pooling the
information from them, he was able to characterize textures highly efficiently. A set of 3×3 or
5×5 convolution masks is used to compute texture energy. The masks are computed from the
vectors each of which indicates local averaging, edge detection, spot detection, ripple detection
and wave detection.
Having produced images that indicate, e.g., local edginess, the next stage is to deduce the
local magnitudes of these quantities. These magnitudes are then smoothed over a fair-sized
region rather greater than the basic filter mask size. The effect of this is to smooth over the gaps
between the texture edges and other microfeatures. At this point the image has been transformed
into a vector image, each component of which represents energy of a different type. Although
Laws
used both squared magnitudes and absolute magnitudes to estimate texture energy, the former
correspond to true energy and give a better response, while the latter are useful in requiring less
computation:
l+p m+ p
E(l,m) = ∑ ∑ ¿ F ( i, j ) ∨¿ ¿
i=l− p j=m− p

A further stage is required to combine the various energies in a number of different ways,
providing several outputs that can be fed into a classifier to decide upon the particular type of
texture at each pixel location. If necessary, principal components analysis is used at this point to
help select a suitable set of intermediate outputs.

You might also like