# Feature Extraction

Feature extraction is a very important issue in pattern recognition and classification. Suitable and discriminative features can efficiently present different contents in the image and offer strong supports for final classification. A large number of features have been proposed, however, we introduce some important and effective features applied for representing the staining patterns in this section. Roughly, we introduce the features from two aspects, i.e., low-level features and mid-level features.

## Low-Level Features

We define the features describe image content from the primitive level as low-level features. It is a relative concept to the mid-level features obtained by using Bag-of- Words (BoW) framework.

### Local Binary Patterns

LBP [39] is initially proposed to describe textural features for a local region. It can be obtained by thresholding the gray value of the circularly symmetric neighbor pixels with that of the center pixel. The neighbors whose difference is positive are set as ‘1’ while others are set as ‘0’. Then, these binary values are converted to a decimal number.

Let *I* be a grayscale image and *I (x, y)* be a gray value at location *(x, y)* in *I.* Then LBP at location *(x, y)* is defined as

where *I(x _{it} y_{i})* is the gray value of

*P*equal spaced pixels on a circle of radius

*R*around center pixel

*(x, y)*and

*(xi, y*is the location of neighbors given by

_{i})*(xi, y*

_{i}) =

*(x + R*cos(2n

*i/P), y + R*sin(2n

*i/P))).*If the neighbors do not fall in the center of pixels, their gray values should be estimated by interpolation [40]. Figure2.11 illustrates the procedure to obtain LBP

_{p},

_{r}value with different

*(P, R).*

The LBP_{p},_{r} produces 2^{P} different output values, therefore we can calculate the LBP_{p},_{r} value for each pixel of an image and build a histogram with 2^{P} bins as the image descriptor. The original LBP_{p},_{r} achieves invariance against any monotonic transformation and the scaling of the gray-scale.

To achieve rotation invariance, a unique identifier is assigned to each rotation invariant LBP [40], which is formulated by

**Fig. 2.11 **Local binary patterns with different *(P, R)**s:* (4, 1), (8, 1) and (16, 2) where *ROR(x, s)* performs circle-right-shift on the binary number *x s* times. For example, *LBP _{P},_{R}* values 10000100b,00100001b and01000010b all map to the unique value 00100001b.

Another extension of original LBP called “uniform” patterns [40]. A uniformity measure *U(LBP _{P},_{R})* is introduced to denote the times of spatial transitions (bitwise 0/1 changes) in the LBPs. For instance, pattern 00000010b and 00111000b have

*U(LBP*value of 2; pattern 01100010b have

_{P},_{R})*U(LBP*value of 4. Uniform LBP assigns different label to each “uniform” pattern and gives a unique number to all the “non-uniform” patterns. The uniform LBP has

_{P},_{R})*P(P —*1) + 3 different values. Figure2.12 shows 58 different “uniform” patterns of (8,

*R)*neighborhood. Each “uniform” pattern has an unique label from 1 to 58 and all “non-uniform” patterns (there are 198 patterns are “non-uniform”) are assigned the same label 59. Let

*U*be the label for a “uniform” pattern, where

_{P}(i, j)*i*is the number of ‘1’ in the pattern (row number in Fig.2.12) and

*j*is the rotation degree (column number in Fig. 2.12) The uniform LBP can be formulated as

The “uniform” patterns provide stronger ability of discrimination in comparison to including all patterns, because they have different statistical properties [40, 44]. Most of the LBPs in natural images are uniform. The proportion of “non-uniform” patterns is so small, therefore the estimation of their probabilities is unreliable. Meanwhile, “uniform” patterns are more stable and only considering “uniform” patterns makes the distribution estimation more reliable.

To improve the capability of rotation invariance and elevate the discrimination, some rotation invariant patterns with low occurrence frequencies, i.e., “non-uniform” patterns of rotation invariant LBPs, are eliminate. The improved rotation invariant texture feature can be defined as [40]

Each rotation invariant “uniform” pattern is assigned a unique label equal to the number of ‘1’ in the pattern, while all the “non-uniform” patterns are labeled by *P +* 1. Therefore, there are *P +* 2 different values for *LBP ^{r}P^{u}R* and the final feature is the histogram of

*LBP*accumulated over the entire image.

^{r}PR**Fig. 2.12 **The different “uniform” patterns in the case of *P =* 8. The white circle denotes ‘1’ while the dark circle denotes ‘0’