# An Image-Based Fall Detection System for the Elderly
## 4 Methodology
### Fall Detection  
Algorithm 8 shows the steps of fall detection. If IFADS can detect the person, we detect the fall by the previous state of the person. If the state of the person in the latest frame is standing, it means that the person falls while walking. We obtain the bounding box of the person \(P_{i}^{S}\). Since a person usually falls within 1.5 s, the person's height 1.5 s before is the normal height of the person. If the person falls and is unable to stand up, the maximum of the person's height is similar to his/her height when he/she is doing a heel sit. Because a person bends his/her thigh and shank when he/she does a heel sit, the height of the person is about 6/8 times the height of the person when he/she is standing. Unlike when doing a heel sit, when a person falls, because he/she feels pain, the person bends his/her back instead of keeping his/her back straight, resulting in a difference of about one half of a head in  
Figure 4: The flow of the state when the person is sitting, in progress, or in danger. height. As mentioned above, if the height of the person is less than or equal to 5.5/8 times the height 1.5 s before, we consider that the person falls. Conversely, if the state of the person in the latest frame is in danger, it means the person is beside the chair, trying to sit down on or stand up from the chair. For that, we obtain the bounding box of the person \(P_{i}^{B}\) when the person is near the chair by posture recognition pre-progress. If the height of the person is less than or equal to 5.5/8 times the height when the person is beside the chair, we likewise consider that the person falls. Conversely, if IFADS cannot detect the person, it executes fall detection for the missing person to detect a fall. Then, if the person remains in the fallen state for more than 3 s, IFADS triggers the alarm. ```
Input: \(fid\), \(P_{i}\), \(P_{i,fid}\), \(M_{i}\), \(S_{i,fid}\), \(P_{i}^{B}\) Output: \(S_{i}\)
1. if (\(M_{i}\) = true) then
2. if (\(S_{i,fid-1}\) = Standing) then
3. \(P_{i}^{B}\gets P_{i,fid-fps*1.5}\)
4. if (\(5.5/8*P_{i}^{B}\).\(height\geq P_{i}\).\(height\)) then
5. \(S_{i}\leftarrow\) Falling
6. else if (\(S_{i,fid-1}\) = In danger) then
7. Execute posture recognition pre-progress (\(fid\))
8. if (\(5.5/8*P_{i}^{B}\).\(height\geq P_{i}\).\(height\)) then
9. \(S_{i}\leftarrow\) Falling
10. Else
11. Execute fall detection for missing person
12. if (\(S_{i}\)= Falling more than 3 s) then
13. Trigger alarm
```  
**Algorithm 8** Fall detection  
When IFADS cannot detect the person, it executes fall detection to detect a fall. Before fall detection, we need to obtain the latest bounding box of the missing person in the previous frame. Algorithm 9 shows the steps of fall detection for a missing person pre-progress. From the current frame to the first frame, we find the latest frame when IFADS detects the person. If IFADS finds the person, it returns the person's bounding box \(P_{i}^{P}\) and the number of that frame \(fid^{N}\). ```
Input: \(fid\), \(M_{i,fid}\) Output: \(P_{i}^{P}\), \(fid^{P}\)
1. for \(fid^{N}=fid\) to 0 do
2. if \(M_{i,fid}\) = true then
3. \(P_{i}^{P}\gets P_{i,fid^{P}}\)
4. return \(P_{i}^{P}\), \(fid^{P}\)
5. end for
```  
**Algorithm 9** Fall detection for a missing person pre-progress  
Algorithm 10 shows the steps of fall detection for a missing person. First, we obtain the bounding box of the person \(P_{i}^{P}\) from when IFADS detected the missing person the last time to evaluate whether the person fell. If the state of the person is far from the chair or near the chair, it means that the person may have fallen while walking. If the person cannot be detected, we cannot obtain the height of the person's bounding box. Thus, if the person's height in the \(fid^{P}\) frame is less than or equal to the average of the height of standing and falling, we consider that the person may have fallen.