AirContour:Building Contour-based Model for In-Air Writing Gesture Recognition 44:13 xh-axis,respectively.Thus,the corresponding reference coordinate plane is xh-Zh plane,xh-yh plane,and yh -zh plane. 4.2.3 Reference Axis Pair Determination.As shown in Figure 6,when we detect the reference coordinate plane,we can determine the viewing angle based on the orientation of the coordinate plane.To describe the reference coordinate plane and its associated orientation,we introduce the reference axis pair.For the detected xh-zh plane,yh-zh plane,xh-yh plane,the corresponding reference axis pairs are xh,zh ><-yh,Zh >xh,yh >when writing with right hand.Accord- ingly,the reference axis pairs are xh,zh>,<yh,zh >xh,yh >when writing with the left hand.By obtaining the projection of reference axis pair in the principal plane,we can detect the reversal and skew of the projected 2D contour. As shown in Figure 11(b),Figure 12(b),and Figure 13(b),the user writes with the right hand, and the reference plane is xh-zh plane,yh-zh plane,and xh-yh plane,respectively.Thus the corresponding reference axis pairs are xh,zh ><-yh,Zh>,and xh,yh >It is noteworthy that when the user writes with the right hand and the reference plane is yh-zh plane,the reference axis pair is <-yh,Zh>instead of yh,zh >Therefore,we project-yh-axis of human-frame into the principal plane based on M(Rp[0,-1.0]),as the cyan dashed line indicates in Figure 12(b). In the figures,to clearly show the small contour in the coordinate range,we shorten the projection vi of an axis by multiplying a scale factor a,ie.,updating vi as avi and setting a =0.2 by default. In Figure 10-Figure 14,the reference axis pairs are emphasized with bold dashed lines. 4.3 2D Contour Calibration in Principal Plane We use the projection of reference axis pair,e.g.,the projections of xh-axis,zh-axis in Figure 10(b), to calibrate the projected 2D contour in the principal plane through reversing,rotating,and nor- malizing. Reversing:First,we verify whether the projected axes in the principal plane satisfy the right- hand rule based on their cross product.If not,we will reverse the 2D contour in the principal plane for calibration.For convenience,we use<v,v2>to represent the projection of the refer- ence axis pair in the principal plane.If v and vz can not meet the condition of the right-handed coordinate system,i.e.,satisfying Equation(8),then it means the projected reference axis pair and the projected 2D character contour in the principal plane are reversed.Then,we reverse the above axis pair and 2D contour around xp-axis for calibration,i.e.,updating(xp yp,)with Equation(9). as shown in Figure 11(c),Figure 13(c),and Figure 14(c).Otherwise,the 2D contour keeps the same orientation,ie[xp=[xp,as shown in Figure 10(c)and Figure 12(c).Here,paxis, yp-axis mean the coordinate axes in principal-frame,while (xp,,yp,)means the coordinates in principal-frame. v1X"2<0 (8) [%=K-n (9) Rotating:Until now,we have introduced the reversal operation to calibrate the 2D contour. However,the contour still has the problem like skew,as shown in Figure 10(c)-Figure 14(c).At this time,we introduce the calibration axis ve in the principal plane to tune the contour through rotation.For xh-Zh plane and yh-Zh plane,zhaxis is set as the calibration axis vc,while for xh- yh plane,yh-axis is set as ve.After that,we use Equation(10)to calculate the rotation angle of 2D contour,i.e.,the contour rotates A0 counterclockwise to make ve overlap yp-axis.The rotation can be found from Figure 10(c)-Figure 14(c)to Figure 10(d)-Figure 14(d),respectively.In Equation(10), vy means yp-axis in principal-frame,while Sgn is a sign function used to determine the rotation angle in counterclockwise(positive)or clockwise(negative).After the calibration with rotation, ACM Transactions on Sensor Networks,Vol.15,No.4.Article 44.Publication date:October 2019.AirContour: Building Contour-based Model for In-Air Writing Gesture Recognition 44:13 xh-axis, respectively. Thus, the corresponding reference coordinate plane is xh − zh plane, xh − yh plane, and yh − zh plane. 4.2.3 Reference Axis Pair Determination. As shown in Figure 6, when we detect the reference coordinate plane, we can determine the viewing angle based on the orientation of the coordinate plane. To describe the reference coordinate plane and its associated orientation, we introduce the reference axis pair. For the detected xh − zh plane, yh − zh plane, xh − yh plane, the corresponding reference axis pairs are < xh, zh >, < −yh, zh >, < xh,yh >, when writing with right hand. Accordingly, the reference axis pairs are < xh, zh >, < yh, zh >, < xh,yh >, when writing with the left hand. By obtaining the projection of reference axis pair in the principal plane, we can detect the reversal and skew of the projected 2D contour. As shown in Figure 11(b), Figure 12(b), and Figure 13(b), the user writes with the right hand, and the reference plane is xh − zh plane, yh − zh plane, and xh − yh plane, respectively. Thus the corresponding reference axis pairs are < xh, zh >, < −yh, zh >, and < xh,yh >. It is noteworthy that when the user writes with the right hand and the reference plane isyh − zh plane, the reference axis pair is < −yh, zh > instead of < yh, zh >. Therefore, we project −yh-axis of human-frame into the principal plane based on M(Rhp [0, −1, 0]T ), as the cyan dashed line indicates in Figure 12(b). In the figures, to clearly show the small contour in the coordinate range, we shorten the projection vi of an axis by multiplying a scale factor α, i.e., updatingvi as αvi and setting α = 0.2 by default. In Figure 10–Figure 14, the reference axis pairs are emphasized with bold dashed lines. 4.3 2D Contour Calibration in Principal Plane We use the projection of reference axis pair, e.g., the projections of xh-axis, zh-axis in Figure 10(b), to calibrate the projected 2D contour in the principal plane through reversing, rotating, and normalizing. Reversing: First, we verify whether the projected axes in the principal plane satisfy the righthand rule based on their cross product. If not, we will reverse the 2D contour in the principal plane for calibration. For convenience, we use < v1,v2 > to represent the projection of the reference axis pair in the principal plane. If v1 and v2 can not meet the condition of the right-handed coordinate system, i.e., satisfying Equation (8), then it means the projected reference axis pair and the projected 2D character contour in the principal plane are reversed. Then, we reverse the above axis pair and 2D contour around xp -axis for calibration, i.e., updating (xpi ,ypi ) with Equation (9), as shown in Figure 11(c), Figure 13(c), and Figure 14(c). Otherwise, the 2D contour keeps the same orientation, i.e., [xv pi ,yv pi ] T = [xpi ,ypi] T , as shown in Figure 10(c) and Figure 12(c). Here, xp -axis, yp -axis mean the coordinate axes in principal-frame, while (xpi ,ypi ) means the coordinates in principal-frame. v1 ×v2 < 0 (8) xv pi ,yv pi T = [xpi , −ypi] T (9) Rotating: Until now, we have introduced the reversal operation to calibrate the 2D contour. However, the contour still has the problem like skew, as shown in Figure 10(c)–Figure 14(c). At this time, we introduce the calibration axis vc in the principal plane to tune the contour through rotation. For xh − zh plane and yh − zh plane, zh-axis is set as the calibration axisvc , while for xh − yh plane, yh-axis is set as vc . After that, we use Equation (10) to calculate the rotation angle of 2D contour, i.e., the contour rotates Δθc counterclockwise to makevc overlapyp -axis. The rotation can be found from Figure 10(c)–Figure 14(c) to Figure 10(d)–Figure 14(d), respectively. In Equation (10), vy means yp -axis in principal-frame, while Sgn is a sign function used to determine the rotation angle in counterclockwise (positive) or clockwise (negative). After the calibration with rotation, ACM Transactions on Sensor Networks, Vol. 15, No. 4, Article 44. Publication date: October 2019