# CEPP: Perceiving the Emotional State of the User Based on Body Posture
## 3 Overview of CEPP
### Recognizing the User's Emotional State  
In this section, we explain how _CEPP_ recognizes the emotional state of the user. The pseudo code for _CEPP_ is illustrated in Algorithm 1. Firstly, the algorithm is started when the user is identified in the field of view of the camera. After the user is identified, the proposed algorithm obtains the silhouette of the user. The silhouette of the user is obtained by utilizing one the features from OpenNI library that can identify the user with a three-dimensional (3D) camera [19]. With this feature, the user can be classified as white and the background is illustrated as black based on the acquired silhouette of the user. Once the silhouette of the user is completely generated, we compute the center of mass of the user, where we proceed to the next equation:  
\[\gamma_{x}=\frac{1}{N}\underset{(x,y)\in S}{\sum}x,\ \ \ \gamma_{y}=\frac{1}{N} \underset{(x,y)\in S}{\sum}y, \tag{1}\]  
where \(\gamma_{x}\) and \(\gamma_{y}\) represent the center of the user, \(N\) depicts the number of detected pixels within the domain \(S\),  
\[S=\{(x,y)|I_{s}(x,y)<255\}, \tag{2}\]  
and \(I_{s}\) is the user's silhouette image. Note that the center of mass coordinate of \(x\) and \(y\) (\(\gamma_{x}\) and \(\gamma_{y}\)) in the above equation is the average of the pixels that have a value which is not 255 (white). The same procedure is applied to the ground truth images. While we are computing the center of mass of the user, we transform the silhouette \begin{table}
\begin{tabular}{c c} \hline \hline
**Emotional State** & **Body Posture** \\ \hline Happiness & Shoulders up \\ \hline Interest & Lateral hand and arm movement and arm stretched out frontal \\ \hline Boredom & Raising the chin (moving the head backward), collapsed body posture, and head bent sideways \\ \hline Disgust & Shoulders forward, head downward and upper body collapsed, and arms crossed in front of the chest \\ \hline Hot anger & Lifting the shoulder, opening and closing hand, arms stretched out frontal, pointing, and shoulders squared \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Description of body postures based on emotional states. image of the user into an edge image of the user, \(I_{e}\). Afterwards, we calculate the degree between the center point and the edge of the user's body posture:  
\[\phi=\arctan\frac{I_{e(y)}-\gamma_{y}}{I_{e(x)}-\gamma_{x}}\times\frac{180}{\pi}, \tag{3}\]  
where \(I_{e(x)}\) and \(I_{e(y)}\) are the \(x\) and \(y\) coordinates of the pixel that are detected in \(I_{e}\) and \(\phi\) depicts the degree of the center point, \(\gamma\), corresponding to \(I_{e(x)}\) and \(I_{e(y)}\). After we obtain \(\phi\) for each corresponding edge pixel, we compute the Euclidean distance, \(\rho_{\phi}\), as the following equation:  
\[\rho_{\phi}=\sqrt{(\gamma_{x}-I_{e(x)})^{2}+(\gamma_{y}-I_{e(y)})^{2}}. \tag{4}\]  
```
1:procedureCEPP
2:init:
3: Compute a set of ground truth silhouettes \(I_{s}(g)\)
4: Generate a set of ground truth edges \(I_{e}(g)\)
5: Create a set of ground truth center of point \(\gamma(I_{s}(g))\)
6:loop:
7:if user \(u\) is identified then
8: Create silhouette of the user \(I_{s}(u)_{i}\)
9: Generate edge of the user \(I_{e}(u)_{i}\)
10: Compute center of mass \(\gamma(I_{s}(u)_{i})\)
11:if\(\gamma\) is computed then
12: Extract feature \(f_{u}(\gamma(I_{s}(u)_{i}),I_{e}(u)_{i})\)
13: Extract feature \(f_{g}(\gamma(I_{s}(g)_{i}),I_{e}(g)_{i})\)
14: Compute similarity distance \(\zeta(f_{u},f_{g})\)
15:endif
16: Recognize emotional state based on \(\zeta\)
17:endif
18:goto loop. 19:endprocedure
```  
**Algorithm 1** Pseudo code of _CEPP_. Then, we sort a set of computed \(\rho_{\phi}\) based on \(\phi\) from the lowest degree to the highest degree with the matched Euclidean distance. Moreover, we transform the sorted set of \(\rho_{\phi}\) as the feature \(f_{g}\) or \(f_{u}\) when the computed image is one of ground truth images (the user image). Once we obtain the features of the ground truth and the user, we proceed to compute similarity distance.