To account for noise in the infrared detection signals, the first derivative data is
filtered using a three element median filter before the second derivative is calculated.
Median filtering is a non-linear filtering technique useful for the suppression of impulse
noise and the smoothing of edges. It works by taking a set number of data points and
determining the mathematical median of them, which then replaces the data point. An
example of a three element median filter is shown in Figure 2-9. In this example, three
elements of the raw data are grouped together and sorted from low to high. In this
configuration, the median of the data is simply the middle of the three numbers, which is
now the filtered data point [12].
The impulses in the second derivative data represent inflection points on the stairs;
the interior concave stair corer will yield a positive impulse while an exterior convex
stair corner will yield a negative impulse. The system accounts for the stairs that the
Andros has passed by detecting these impulses; if the impulse that is less than a given
threshold value, a stair is counted. The direction of travel upon the stairs, and therefore
whether to add or subtract a stair to the total number counted, is determined by which
sensor detected the impulse first. If the front detector senses the impulse before the rear,
then a stair is added. If the rear detector senses the impulse before the front, then a stair
is subtracted from the total.
The computation of the first and second derivatives of the stair representation and the
application of the median filter induces a delay in the detection of the stair inflections.
Each of the derivative computations account for a one-cycle delay, while the median
filter accounts for a three-cycle delay for a total delay of five cycles. As the detectors are