# An Image-Based Fall Detection System for the Elderly
## 4 Methodology
### Object Detection and Person Tracking
\begin{table}
\begin{tabular}{l l} \hline \hline
**Notation** & _Definition_ \\ \hline \(F\) & Extracted current frame from the video stream. \\ \(F^{\prime}\) & Extracted latest frame from the video stream. \\ \(fps\) & Frames per sec cond. \\ \(H\) & Hue image of F\({}^{\prime}\). \\ \(T_{N}\) & The current time. \\ \(T_{L}\) & The last time when it detected the chair. \\ \(O_{i}\) & The bounding box of the \(i^{th}\) object’s detection result. \\ \(fid\) & The number of frames extracted from the video stream. \\ \(fid^{N}\) & The number of the last frame when the person was near the chair. \\ \(fid^{p}\) & The number of the last frame when it detected the person. \\ \(fid^{C}\) & The number of the frame when the person is obscured. \\ \(C_{i}\) & The bounding box of the \(i^{th}\) chair. \\ \(C_{n}\) & The chair that is the nearest chair to the \(i^{th}\) person. \\ \(P_{i}\) & The bounding box of the \(i^{th}\) person in the current frame. \\ \(\overline{P}_{i}\) & The bounding box of the \(i^{th}\) person's tracking result. \\ \(P_{i}^{N}\) & The latest bounding box of the \(i^{th}\) person when he is near the chair. \\ \(P_{i}^{p}\) & The latest bounding box of the \(i^{th}\) person when it detects the person. \\ \(P_{i}^{S}\) & The bounding box of the \(i^{th}\) person before 1.5 s. \\ \(P_{i,\,fid}\) & The bounding box of the \(i^{th}\) person in the \(fid^{th}\) frame. \\ \(P_{i,\,fid}{}^{H}\) & The hue images of the \(P_{i,\,fid}\) area in \(H\). \\ \(D_{x}\) & The horizontal distance from \(P\) to \(C\). \\ \(D_{y}\) & The vertical distance from \(P\) to \(C\). \\ \(D\cdot C_{y}\) & The vertical distance from \(P\). _center_ to \(C\)._center_. \\ \(B_{i}\) & The \(i^{th}\) binary back projection images of each \(P_{i,\,fid}{}^{H}\). \\ \(M_{i}\) & Boolean, true while it detects the \(i^{th}\) person in the current frame. \\ \(M_{i,fid}\) & Boolean, true while it detects the \(i^{th}\) person in the \(fid^{th}\) frame. \\ \(S_{i}\) & The state of the \(i^{th}\) person in the current frame. \\ \(S_{i,fid}\) & The state of the \(i^{th}\) person in the \(fid^{th}\) frame. \\ \hline \hline \end{tabular}
\end{table} 
Table 1: List of notations and definitions. ```
Input: \(F\) Output: \(C_{i}\), \(P_{i,fid}\)
1. \(F\) = Extract (video streaming)
2. Fill the image size of \(F\) to a multiple of 32
3. Load YOLOv3 model parameter
4. \(O_{i}\leftarrow\) YOLO detector (\(F\))
5. for all \(O_{i}\) do
6. if \(T_{L}\) = 0 then
7. if \(O_{i}\)-class_name = Chair then
8. \(C_{i}\gets O_{i}\)
9. else if \(O_{i}\)-class_name = Bench then
10. \(C_{i}\gets O_{i}\)
11. \(C_{i}\)_height = 2 * \(C_{i}\)-height
12. \(C_{i}\)_top = \(C_{i}\)-top + \(C_{i}\)-height
13. if \(O_{i}\)-class_name = Person then
14. \(P_{i,fid}\gets O_{i}\)
15. end for
16. \(T_{L}\gets T_{N}\)
```  
**Algorithm 1** Object detection  
```
Input: \(F^{\prime}\), \(P_{i,fid}\) Output: \(P_{i}\)
1. \(\mathrm{H}\leftarrow\) GetHue (Convert \(F^{\prime}\) from RGB to HSV)
2. for all \(P_{i,fid-1}\) do
3. \(P_{i,fid-1}\)\({}^{H}\leftarrow\) Get \(P_{i,fid-1}\) area hue in \(\mathrm{H}\)
4. end for
5. \(B_{i}\) = Back projection (\(P_{i,fid-1}\)\({}^{H}\), \(\mathrm{H}\))
6. \(B_{i}\) = Convert to binary (\(B_{i}\))
7. \(B_{i}\) = Erosion (\(B_{i}\))
8. \(B_{i}\) = Dilation (\(B_{i}\))
9. for all \(P_{i,fid-1}\) do
10. \(\overline{P}_{i}\leftarrow\) Camshift (\(P_{i,fid-1}\),\(B_{i}\))
11. \(M_{i,fid}\) = false
12. for all \(P_{i,fid-1}\) do
13. if (\(\overline{P}_{i}\)-center in \(P_{i}\)) then
14. \(M_{i,fid}\) = true
15. Break
16. end for
17. if (\(M_{i,fid}\) = false) then
18. Execute fall detection
19. end for
```  
**Algorithm 2** Person tracking