## 3 Design and Implementation
### Classification Algorithm
**(b) Phase 2: Gesture classification algorithm**

**Input**: a piece of raw data from each of the five axes of the acceleration sensor

**Output**: classified haptic pattern

**Definition of variable in Phase2:**

_DATA_SIZE_: the number of data to discriminate the seven haptic gestures (default is 50)

for(i = 0; i \(<\)_DATA_SIZE_; i++)

Gather current x, y, z, x-z, and y-z data from the sensor;

Calculate moving average of x, y, z, x-z, and y-z;

Normalize the calculated moving averages and store to N\({}_{\text{x}}\), N\({}_{\text{y}}\), N\({}_{\text{z}}\), N\({}_{\text{x-z}}\), and N\({}_{\text{y-z}}\);

arrayN\({}_{\text{x}}\)[i] = N\({}_{\text{x}}\);

arrayN\({}_{\text{y}}\)[i] = N\({}_{\text{y}}\);

arrayN\({}_{\text{z}}\)[i] = N\({}_{\text{z}}\);

arrayN\({}_{\text{y-z}}\)[i] = N\({}_{\text{y-z}}\);

arrayN\({}_{\text{x-z}}\)[i] = N\({}_{\text{x-z}}\);

Decide the _type of gesture_ by comparing arrayN\({}_{\text{x}}\), arrayN\({}_{\text{y}}\), arrayN\({}_{\text{z}}\), arrayN\({}_{\text{y-z}}\), arrayN\({}_{\text{x-z}}\) to the predefined pattern information of each gesture;

Return type of gesture;

## 4 User Performance and Usability

### Experimental Setup

The proposed haptic passcode authentication system was implemented and tested for its performance in a laboratory. A regular ID tag with an RFID tag provided a convenient platform for implementation on the assumption that users in the intelligent and automated environment need to carry an ID tag as a means of personal identification. Fifteen college students, eleven of them male, with an average age of 26.4, tried to generate a passcode through haptic manipulation of the ID tag to test for successful access to the authentication system. Participants first created and predefined their own four-digit passcode by designating four gestures in succession out of the seven haptic gestures provided and stored them in the authentication system. No repetition of the same gesture was allowed for creating a passcode. Participants were to match this stored passcode with their haptic gestures with an ID tag to successfully access the authentication system. Participants were allowed to have at least 10 min to practice generating all seven haptic gestures before the test. During the test, participants were asked to perform ten times the four-digit passcode, composed of four different haptic gestures from the final set shown in Table 1, that matched the passcode they predefined and stored using the ID tag. The acceleration sensor generates signals according to the patterns until the user stops the gesture to return to the normal, in other words, a standby status. The passcode was then decomposed into unit haptic gestures and compared to the preselected gestures according to the algorithm described in Section 3.3. A total of 150 trials were collected. ### Results

#### 4.2.1 System Accuracy

The system accuracy was analyzed out of 150 trials in terms of success and failure using a confusion matrix. The levels of recognition accuracy of each haptic gesture and confusion with each other are presented in Table 2.

Figure 3: Frequency distribution of the normalized probability values on the \(z\) axis and \(x\) axis for classification of detected “TO” patterns: (**a**) Phase 1 for determining whether an effective gesture pattern was detected, and the first stage of Phase 2 for classification of a “TO” pattern using the normalized probability values on the z axis; (**b**) The second stage of Phase 2 for classification of a “TO” pattern using the normalized probability values on the x axis. The average rate of successful recognition for the four-digit haptic passcode authentication was 88.9%. Due to the difficulty in haptic manipulation of the ID tag, some haptic gestures showed lower accuracy than others. For example, the vertical flip of 180 degrees (VF180) and turning over (TO), which require 180-degree horizontal flipping manipulation, seemed to be difficult for the participants to make.