# Dynamic Vertical Mapping with Crowdsourced Smartphone Sensor Data
## 3 Approach
### Reference Pressure Extraction
#### 3.3.1 Light Sensor  
As has been already suggested by [PERSON] et al. [22], the OITransition can be identified by aggregating multiple smartphone sensor data. A very promising sensor for this is the ambient light sensor, considering the fact that there is a difference of the light intensity between indoors and outdoors. For identifying the OITransition, in our research, we fuse light and proximity sensors, with 7 and 25 Hz recording rates, respectively. The first sensor helps us to identify the transition, and the second is used as a supportive sensor, indicating when to trust the data, as it can indicate that an object blocks the light sensor.  
As can be seen in Figure 2, the light intensity drops when entering the building during the day and increases during the night, while the proximity sensor indicates whether to trust the light sensor, because of various phone poses (e.g., phone in pocket). Hysteresis thresholding is used for maximizing the margins of the signal that belong outdoors and indoors. Finally binary classification is applied on the basis of the high and low distribution frequency, while the decision of whether the data is collected during day or night taken from the hour angle \(\omega_{0}\) of the sun (negative at sunrise; positive at sunset) is computed with  
\[\cos\omega_{0}=-\tan\phi\cdot\tan\delta\]  
where \(\phi\) is the latitude of the observer on the earth and \(\delta\) is the sun's declination.  
Figure 2: Light data from six outdoor-indoor transitions (OITransitions) collected during the same day, five during day time and one during night. As can be seen, during the OITransition (after the 70 th sample), the light intensity rapidly decreases during the day (**left axis**) and increases during the night (**right axis**).  
The hysteresis thresholding algorithm uses multiple thresholds to find rapid changes in a signal. The algorithm is thus used to discriminate indoor and outdoor locations. Figures 3 and 4 show that it allows the identification of OITransitions with great accuracy. First, we estimate the upper and lower thresholds for the hysteresis thresholding, on the basis of a histogram analysis. In the histogram analysis, we compute frequency distributions of discrete light intensities. We select the upper and lower thresholds on the basis of the pattern of the distribution. If an OITransition exists in the sensor data segment, then the distribution forms a bimodal pattern and the thresholds are selected from the lower and higher peaks of the distribution. Alternatively, if the sensor data segment contains an OITransition, the distribution shows a symmetric pattern and it is not be taken into consideration as a potential OITransition segment. After the upper and lower thresholds have been defined, the upper threshold is used to find the start of a rapid transition. Once a start point is found, then the path is traced from the rapid signal transition through the signal, segment by segment, marking indoors whenever it is above the lower threshold. It stops marking indoors only when the value falls below the lower threshold.  
Unfortunately, as can be seen in Figure 4, the accuracy of the indoor classification at night-time is reduced in comparison to during the day time.  
Figure 4: Outdoor–indoor transition (OITransition) classification using light at night. The binary flag of **1** (orange line and right axis) indicates indoor area.  
Figure 3: Outdoor–indoor transition (OITransition) classification using light. The binary flag of **1** (orange line and right axis) indicates indoor area. We note that during the period after sample \(7\times 10^{5}\), the smartphone was in a pocket. However, it is wrongly classified as indoors. This demonstrates the need for fusion with the proximity sensor, which can indicate whether the phone is exposed (the light sensor can be trusted) or not.