The first variable is the Primary Peak. It is obtained by finding the highest point in the membrane as seen in Fig. 1. pix_drum outputs the (x, y) pixel coordinates of the primary peak. That is, the (x, y) pixel coordinates of the peak that is pressed deeper.
Every other peak is considered a secondary peak. Secondary Peaks are the result of finger pressure and are calculated through concavity analysis, as seen in Fig. 2. They are calculated in the following way:
1) a first vector d is the line from the corner to the primary peak.
If there is no lateral pressure, this difference should be zero. This estimate is currently being done by two-dimensional linear regression based on a previous training set.
Lateral intensity is calculated in the following way:
1) the total area T of the two rectangles on each side of the primary peak is calculated.
2) the % of black pixels is substracted from T to get the total black area.