# Modified Gingival Index (MGI) Classification Using Dental Selfies
## 2 Materials and Methods
### Methods
#### 2.2.1 Part 1 Image Transformation and Feature Engineering  
The 35 features were extracted using the following 3-step process; Step 1: separate the image into two regions--the tooth region and gum region (Figure 8). Step 2: image transformation to achieve normalization of colors and hues, and edge enhancement. Step 3: feature extraction from the resulting transformed image. We will now describe these three steps more closely. Step 1: image separation into two regions--we used the K-mean clustering algorithm with K = 2 to separate the image into its two most prominent clusters (regions)--the gum region and tooth region. See Figure 8 for an example of separation into two clear and distinct regions. Step 2: image transformation--as mentioned, the dental selfies taken by users vary widely due to differences between cameras used, lighting conditions, image perspective, distance and zooming, lighting conditions, and more. Thus, we utilize six transformations to normalize image variation. Five of the six transformations we utilize are widely known from the literature. One transformation we developed specifically for normalizing dental images. The six are: Teeth Normalized (TN), Histogram  
Figure 8: Image separation into two regions—left: the original tooth image; right: the separation into two regions (clusters) produced by the K-mean algorithm. Figure 7: Overview of the method described in the paper. Dataset acquisition: eight single tooth images manually cropped from each dental selfie taken by iGAM users. Fed into two-part classification method: part (**1**) image transformation and feature engineering—extraction of features tailored to dental images; part (**2**) two-stage cascade of binary classifiers—Healthy/Unhealthy, Mild/Severe. Equalization Matching (HistMatch) [28], HSV (Hue), Bilateral Filter (BF) [29], Histogram of Oriented Gradients (HOG) [30], and Canny edge detector (CNY) [31]. These transformations can be divided into three: the first three (TN, HistMatch, and Hue) serve to normalize differences in lighting conditions between images, based on color-tone comparison. The fourth de-noises the image. The last two (HOG and CNY) were used to enhance the gradient, magnitude, and angle at the edge between the tooth and gum regions, as we assumed that the greater the contrast between gums and teeth the worse the inflammation (redness). Next is a short explanation about each of the transformations used: we start by describing the new transformation we developed, which we call teeth normalized (TN), tailored especially for images from a dental context--it normalizes the image colors by dividing each pixel's value by the mean color value of the tooth region as determined by the K-mean clustering algorithm. We rely on the assumption that the difference in average tooth color between individuals, effectively normalizes color variation. Histogram Equalization Matching (HistMatch)--is a method which equalizes image contrast to a preselected randomly picked tooth image. Since the images were produced by different cameras and under different conditions the HistMatch transformation normalized all images to one scale. HSV representation (Hue)--HSV (hue, saturation, value) is an alternative form of encoding color (comparable to RGB), Hue transformation simply means using only the Hue channel (from the HSV encoding) of the image, as we assume that inflammation can be identified by the Hue of the color regardless of lightness and saturation. Bilateral filter (BF) [29]--is a nonlinear, edge-preserving, and noise-reducing method which normalizes and smoothens each pixel with the average value of its neighbors. Here, our aim is to clean the image of noise, while preserving the distinction between gum and tooth regions as much as possible. Histogram of Oriented Gradients (HOG)--is a method that captures the gradient and the orientation in a localized section of the image.