# A Novel Device-Free Counting Method Based on Channel Status Information
## 3 Crowd Counting Based on CSI
### Feature Extraction  
A suitable feature plays a key role. Nowadays, various statistical features [22; 23; 24] have been exploited for detection, such as the variance, mean, std, max-min. Nevertheless, these measures can only describe one-dimensional data (i.e., scalar), which necessitates the introduction of amplitude  
Figure 2: Comparison between the original and the filtered signal. (**a**) amplitude; (**b**) phase.  
and phase covariance matrix as a feature one to enable counting in the multi-dimensional data. Then, the corresponding feature matrix can be represented as,  
\[\begin{split} a(i,j)&=cov(\angle H(i),\angle H(j)),\\ b(i,j)&=cov(\lVert H(f_{i})\rVert,\lVert H(f_{j}) \rVert),\end{split} \tag{6}\]  
where \(\angle H(i)\), \(\lVert H(f_{i})\rVert\) are the phase and amplitude information, respectively.  
In the following, \(A\) and \(B\) are utilized to denote the amplitude and phase covariance matrix, respectively, i.e.,  
\[\begin{split} A&=[a(i,j)]_{N*N}\,,\\ B&=[b(i,j)]_{N*N}\,,\end{split} \tag{7}\]  
where \(a(i,j)\) and \(b(i,j)\) denote the phase and information covariance between vectors \(i\) and \(j\), respectively.  
Both Figures 3 and 4 show the variation of CSI amplitude values with different numbers of moving people. Herein, Figure 3 demonstrates the CSI changes with one antenna when 0, 2, 4 people are walking, respectively, and Figure 4 displays the change with three antennas. The X-axis denotes the package index, while the Y-axis denotes the CSI amplitude value. For both cases, it can be clearly observed that the different degree of change of the CSI amplitude with the number of people increases. In addition, the amplitude varies sharply with the increase of packet number instantaneous. Therefore, the amplitude information can be considered as means of the crowd counting.  
Since there is a random noise and unsynchronized time clock, the raw phase information is unavailable, as shown in Figure 5a. However, most existing works also involve the phase  
Figure 4: CSI amplitude changes with the people number on three antennas. (**a**) zero people; (**b**) two people; (**c**) four people.  
Figure 3: CSI amplitude changes with the people number on one antenna. (**a**) zero people; (**b**) two people; (**c**) four people.  
information [18; 19; 25; 26]. One of the most important reasons is that the phase information is more sensitive. In our work, in order to achieve people-counting through the phase information, we employ a linear transformation to remove random noise from the raw phase values. The measured phase \(\hat{\phi}_{i}\) for the \(i\)th subcarrier can be expressed as  
\[\hat{\phi}_{i}=\phi_{i}+2\pi k_{i}\triangle t+2\pi k_{i}\triangle w, \tag{8}\]  
where \(\phi_{i}\) is the raw phase. \(2\pi k_{i}\triangle t\) and \(2\pi k_{i}\triangle w\) are the unknown phase shifts caused by the clock offset \(t\) and frequency difference \(w\), respectively.  
To remove the impact of random noise, the linear transformation can be written as  
\[\tilde{\phi}=\hat{\phi}_{i}-\alpha k_{i}-\beta, \tag{9}\]  
where \(\alpha\) and \(\beta\) denote intuitively the slope and offset of phase change over all subcarriers, respectively, \(\tilde{\phi}\) is the random phase offset which has been removed. Figure 5b illustrates an example of the phase after transformation, which is stably distributed.