# Detection of Pitt-Hopkins Syndrome Based on Morphological Facial Features
## 2 Materials and Methods
### Methodology  
All processing was performed using Python 2.7 and the following libraries: _sys_, _os_, _glob_, _Dlib_, _NunPy_, _Scikit-image_ and _Scikit-learn_[32; 33; 34; 35; 36]. The proposed pipeline consists of six stages, depicted in Figure 1:  
(1) Pre-processing: Images were normalized using automatic histogram equalization and median filtering to obtain uniform brightness and contrast levels. The location of the face was extended by 30 pixels in all directions, and all pixels outside this region were discarded (Figure 2a). Images were re-sized to 600 \(\times\) 600 pixels. Figure 1: Pipeline of the proposed system. (2) Face detection: This step was performed using Histogram of Oriented Gradients (HOG) feature detectors [37; 38]. The HOG face detector assumes that the shape and texture of a face can be described by the distribution of gradients of intensity or edge directions. As the first step of the HOG face detector, the gradient vector (magnitude and angle) of every pixel of the picture is computed. The final HOG descriptor size is the vector of all components of the normalized blocks in the detection window. For this implementation, the size of the detection window was 64 \(\times\) 64 pixels, and 1400 histograms or training vectors were generated. The combined vectors are the input of a linear kernel support vector machine (SVM) [39] classifier trained for face detection on public image datasets as described in previous works [37; 38]. The classifiers returned the bounding box of the face. (3) Face alignment and registration: In the face alignment step, the face is rotated, scaled, and translated considering the rigid and non-rigid face deformations. For this task, 5-point facial landmarks were used: 2 points for the corners of the left eye, 2 points for the corners of the right eye and 1 point for the tip of the nose. The horizontal and vertical (\(x\), \(y\)) coordinates of the five points were detected with the pre-trained model based on the HOG descriptor and SVM classifier applied for face detection. First, the center of each eye (centroid) was calculated in accordance with the two corner points detected. Then, taking into account the differences in \(x\) and \(y\) coordinates of the centroids of both eyes and the arc-tangent function, the angle of rotation was calculated. Once the face is rotated, it is scaled back to the dimension of 600 \(\times\) 600 pixels. (4) Landmark localization: The localization of landmarks follows the method of [PERSON] [40], which is able to precisely localize 68 landmarks. The implementation of this method, available in _Dlib_ library, uses a training data set that consists of labeled facial landmarks on face images and the probability of distance between pairs of pixels near the facial landmarks. An ensemble of regression trees is trained to estimate the facial landmark positions using only pixel intensities. The configuration of 68 landmarks distributed around the eyes, nose, mouth, and contour of the face was selected and is illustrated in Figure 2b. The landmarks overlaid on the original facial image are shown in Figure 3a. (5) Geometrical feature extraction: Patients with PTHS present special facial features related to the geometry of the face. Therefore, geometric features, specifically of distance, area and angles, as defined by the relationship among the landmarks previously located, were explored to support diagnosis of PTHS. Three distance features, _R1_, _R2_, and _R3_, were defined by the distances between the eyes (landmarks 39 and 40, in Figure 3b), width of the nose (landmarks 31 and 35) and width of the mouth (landmarks 48 and 54). These features were normalized by the respective baselines _B1_, _B2_, and _B3_ (the width of the face in three different locations) so that they are invariant to scale, rotation, and translation. For the first feature _R1_, the baseline _B1_ is the distance between the temples, for _R2_ the baseline _B2_ is the distance between the cheekbones, and for _R3_ the baseline _B3_ is the width of the jaw (Figure 3b).