Head action recognition method and device, storage medium and head-mounted equipment
By using gyroscope sampling values in head mounted devices to determine the direction and status of head motion, the problem of low accuracy of head motion recognition in the prior art is solved, and higher recognition accuracy and fewer false detection are achieved.
Patent Information
- Application Number
- CN202510244281.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-03
- Publication Date
- 2025-06-13
AI Technical Summary
The accuracy of posture recognition of existing head-mounted devices is low, especially due to the different movement habits of different users, which leads to inconsistent accuracy of head movement command recognition.
By obtaining the sampled value of the gyroscope, first determine the head action direction, then determine the action state based on the action direction and the previous action state, and finally determine the head action type based on the action state. This method improves the accuracy of the action direction and state by comparing the sampled values at the current and previous moments, thereby improving the accuracy of the recognition of the head action type.
It effectively reduces misdetection and interference, improves the accuracy of head movement direction and status, and thus improves the accuracy of head movement type recognition.
Smart Images

Figure CN120143983A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of wearable devices. Specifically, a head motion recognition method, device, storage medium, and head-mounted device are provided. Background Art
[0002] To facilitate the operation of head-mounted devices, some head-mounted devices are configured to detect the head motions of users, and are also configured with operation instructions corresponding to each head motion, so as to operate and control the head-mounted device by detecting the head motions of users and determining the corresponding operation instructions.
[0003] Currently, the method of head-mounted device attitude recognition has the problem of low accuracy. For example, some head-mounted devices determine the head motions of users by comparing the detection values of gyroscopes with preset thresholds. Different users have different motion habits, resulting in different detection values corresponding to the swing amplitudes, and the accuracy of the detection of head motion instructions for different users' head motion instructions is different. Summary of the Invention
[0004] In a first aspect, an embodiment of this application provides a head motion recognition method, which is applied to a head-mounted device. The head-mounted device includes a gyroscope. The head motion recognition method includes: obtaining a sampling value of the gyroscope; the sampling value includes a previous first sampling value and a current first sampling value in the X-axis direction, and a previous second sampling value and a current second sampling value in the Z-axis direction; comparing the previous first sampling value, the current first sampling value, the previous second sampling value, and the current second sampling value to determine the motion direction at the current moment; determining the motion state at the current moment based on the motion direction at the current moment and the previous motion state obtained in advance; and determining the head motion type according to the motion state at the current moment.
[0005] Compared with directly determining the type of head movement using the amplitude of the gyroscope sampling values, in the embodiments of the present application, during recognition, first, the head movement direction is determined through the sampling values, and then, based on the head movement direction, the type of head movement is determined only after determining the movement direction at the current moment and the head movement at the current moment, which can effectively reduce the situation of false detection and reduce interference. When determining the movement direction, the movement direction is determined by comparing the sampling values at the current moment and the previous moment, making the determined movement direction more accurate. Accordingly, when determining the current movement state, it is jointly determined by combining the movement direction at the current moment and the previous movement state, making the determined current movement state at the current moment highly accurate. Whether it is the head movement direction or the movement state, both are jointly determined by the movements at the previous and current moments. Compared with the method of directly determining the current head movement direction or movement by the sampling value at a single moment, the head movement direction determined by the method provided in the present application is more accurate and can effectively reduce. The type of head movement determined by the more accurate movement direction and movement state at the current moment will also be more accurate.
[0006] In one embodiment, comparing the first sampling value at the previous moment, the first sampling value at the current moment, the second sampling value at the previous moment, and the second sampling value at the current moment to determine the movement direction at the current moment includes: combining and comparing the first sampling value at the previous moment, the first sampling value at the current moment, the second sampling value at the previous moment, and the second sampling value at the current moment to obtain a combined comparison result; the combined comparison includes: comparing the first sampling value at the current moment with the first sampling value at the previous moment, comparing the second sampling value at the current moment with the second sampling value at the previous moment, and comparing the absolute values of the first sampling value at the current moment and the second sampling value at the current moment; determining the rising state of the sampling point at the current moment according to the combined comparison result; wherein, the rising state of the sampling point represents the change direction of the sampling value of this sampling point; comparing the rising state of the sampling point at the current moment with the previously obtained rising state of the sampling point at the previous moment to determine the movement direction at the current moment.
[0007] Compared with directly judging the movement direction by the positive or negative of the amplitude of the sampling value, in the embodiments of the present application, when determining the movement direction at the current moment, the rising state of the sampling point at the current moment is determined through the combined comparison between the sampling values, and then the movement direction at the current moment is jointly determined by combining the rising state of the sampling point at the current moment and the rising state of the sampling point at the previous moment. The rising state of the sampling point represents the change direction of the sampling value of this sampling point. Only by the rising state of the sampling point at the current moment and the rising state of the sampling point at the previous moment can a wave peak or wave valley be jointly determined, which can make the determined movement direction more complete and accurate, and effectively reduce the situation of false detection.
[0008] In one embodiment, determining the rising state of the sampling point at the corresponding current moment according to the combined comparison result includes: if the first sampling value at the current moment is greater than the first sampling value at the previous moment, and the absolute value of the first sampling value at the current moment is greater than the absolute value of the second sampling value at the current moment, determining that the rising state of the sampling point at the current moment is the first rising state; the first rising state represents that the sampling value of the sampling point changes in the positive direction of the gyroscope coordinate system; if the second sampling value at the current moment is greater than the second sampling value at the previous moment, and the absolute value of the second sampling value at the current moment is greater than the absolute value of the first sampling value at the current moment, determining that the rising state of the sampling point at the current moment is the first rising state; if the first sampling value at the current moment is less than the first sampling value at the previous moment, and the absolute value of the first sampling value at the current moment is greater than the absolute value of the second sampling value at the current moment, determining that the rising state of the sampling point at the current moment is the second rising state; the second rising state represents that the sampling value of the sampling point changes in the negative direction of the gyroscope coordinate system; if the second sampling value at the current moment is less than the second sampling value at the previous moment, and the absolute value of the second sampling value at the current moment is greater than the absolute value of the first sampling value at the current moment, determining that the rising state of the sampling point at the current moment is the second rising state.
[0009] In one embodiment, comparing the rising state of the sampling point at the current moment with the rising state of the sampling point at the previous moment obtained in advance to determine the action direction at the current moment includes: if the rising state of the sampling point at the current moment is the second rising state, the rising state of the sampling point at the previous moment is the first rising state, and the first sampling value at the previous moment is greater than the preset maximum threshold, and the absolute value of the first sampling value at the current moment is greater than the absolute value of the second sampling value at the current moment, determining that the action direction at the current moment is the first action direction; the first action direction represents the positive direction of the X axis; if the rising state of the sampling point at the current moment is the first rising state, the rising state of the sampling point at the previous moment is the second rising state, and the first sampling value at the previous moment is less than the preset minimum threshold, and the absolute value of the first sampling value at the current moment is greater than the absolute value of the second sampling value at the current moment, determining that the action direction at the current moment is the second action direction; the second action direction represents the negative direction of the X axis.
[0010] In the embodiments of the present application, the magnitude between the first sampling value and the second sampling value at the current moment is used to determine the axis on which the action occurs. That the first sampling value at the current moment is greater than the second sampling value at the current moment indicates that the action occurs on the X-axis. Only when the rising state of the sampling point at the current moment is different from the rising state of the sampling point at the previous moment can a peak or a trough be determined. Compared with directly determining the action mode by the positive or negative of the sampling value, in the embodiments of the present application, the action direction can be determined only through a complete peak or trough. Therefore, the action direction is determined only when the rising state of the sampling point at the current moment is different from the rising state of the sampling point at the previous moment. This method combines the change of the gyroscope sampling values at the previous and current moments, which helps to improve the integrity of the determined action direction at the current moment, thereby improving the accuracy of the determined action direction at the current moment. At the same time, judging whether the first sampling value at the previous moment is greater than a preset maximum threshold or less than a preset minimum threshold helps to reduce the interference of some pseudo-peaks.
[0011] In one embodiment, after determining that the action direction at the current moment is the first action direction, the method further includes: obtaining the previous action direction; if the previous action direction is not the first action direction, then retaining the first sampling value at the previous moment used to determine the action direction at the current moment and using it as a new peak value; if the previous action direction is the first action direction, and the first sampling value at the previous moment used to determine the action direction at the current moment is greater than the peak value, then determining that there is a pseudo-peak, and retaining the first sampling value at the previous moment used to determine the action direction at the current moment and using it as a new peak value; and, after determining that the action direction at the current moment is the second action direction, the method further includes: obtaining the previous action direction; if the previous action direction is not the second action direction, then retaining the first sampling value at the previous moment used to determine the action direction at the current moment and using it as a new trough value; if the previous action direction is the second action direction, and the first sampling value at the previous moment used to determine the action direction at the current moment is less than the trough value, then determining that there is a pseudo-trough, and retaining the first sampling value at the previous moment used to determine the action direction at the current moment and using it as a new trough value.
[0012] In the embodiment of the present application, during the process of action direction recognition, the swing amplitude of the user's head may not reach the maximum, so that the first sampling value sampled at the current moment may not reach the maximum value and cannot be used to represent the peak, and there may be a situation of false peaks. Similarly, in the second action direction, there may be a situation of false valleys. Therefore, for the judgment of false peaks and false valleys, by judging whether the action directions of two consecutive times are the same, it is determined whether there is a peak or a valley. If they are different, it proves that there is a peak or a valley. If they are the same, it means that the action does not reach the maximum swing amplitude, and there may be false peaks or false valleys. Furthermore, the false peaks or false valleys can be used to improve the accuracy of head movement recognition.
[0013] In one embodiment, the comparing the rising state of the sampling point at the current moment with the rising state of the sampling point at the previous moment obtained in advance to determine the action direction at the current moment includes: if the rising state of the sampling point at the current moment is the second rising state, the rising state of the sampling point at the previous moment is the first rising state, and the second sampling value at the previous moment is greater than the preset maximum threshold, and the absolute value of the second sampling value at the current moment is greater than the absolute value of the first sampling value at the current moment, then it is determined that the action direction at the current moment is the third action direction; the third action direction represents the positive direction of the Z axis; if the rising state of the sampling point at the current moment is the first rising state, the rising state of the sampling point at the previous moment is the second rising state, and the second sampling value at the previous moment is less than the preset minimum threshold, and the absolute value of the second sampling value at the current moment is greater than the absolute value of the first sampling value at the current moment, then it is determined that the action direction at the current moment is the fourth action direction; the fourth action direction represents the negative direction of the Z axis.
[0014] In the embodiment of the present application, that the second sampling value at the current moment is greater than the first sampling value at the current moment indicates that the action occurs in the Z-axis direction. Only when the rising state of the sampling point at the current moment is different from the rising state of the sampling point at the previous moment can a peak or a valley be determined. Compared with directly determining the action mode by the positive and negative of the sampling value, in the embodiment of the present application, the action direction is determined only when the rising state of the sampling point at the current moment and the rising state of the sampling point at the previous moment are in different states. This method combines the change situation of the gyroscope sampling values at the front and back moments, which helps to improve the integrity of the action direction determined at the current moment, thereby improving the accuracy of the action direction determined at the current moment. At the same time, judging whether the first sampling value at the previous moment is greater than the preset maximum threshold or less than the preset minimum threshold helps to reduce the interference of some false peaks.
[0015] In one embodiment, after determining that the action direction at the current moment is the third action direction, the method further includes: obtaining the previous action direction; if the previous action direction is not the third action direction, retaining the second sampling value at the previous moment used to determine the action direction at the current moment and using it as the new peak value; if the previous action direction is the third action direction and the second sampling value at the previous moment used to determine the action direction at the current moment is greater than the peak value, determining that there is a false peak, and retaining the second sampling value at the previous moment used to determine the action direction at the current moment and using it as the new peak value; and, after determining that the action direction at the current moment is the fourth action direction, the method further includes: obtaining the previous action direction; if the previous action direction is not the fourth action direction, retaining the second sampling value at the previous moment used to determine the action direction at the current moment and using it as the new trough value; if the previous action direction is the fourth action direction and the second sampling value at the previous moment used to determine the action direction at the current moment is less than the trough value, determining that there is a false trough, and retaining the second sampling value at the previous moment used to determine the action direction at the current moment and using it as the new trough value.
[0016] In one embodiment, determining the action state at the current moment based on the action direction at the current moment and the previously obtained previous action state includes: when the action direction at the current moment is any one of the preset target directions, obtaining the previous action state and the previous action direction; the preset target directions include one of the first action direction, the second action direction, the third action direction, and the fourth action direction; if the previous action state is the preset standby state, determining that the action state at the current moment is the first half of the target action state; the target action is the action corresponding to the action direction at the current moment; if the previous action state is the first half of the target action state, the previous action direction is different from the action direction at the current moment, and the absolute value of the time difference between the time corresponding to the action state at the current moment and the time corresponding to the previous action state is greater than the preset time threshold, determining that the action state at the current moment is the second half of the target action state.
[0017] Compared with the motion direction determined by the sampling value at a single moment, in the embodiments of the present application, the motion direction at the current moment is jointly judged by combining the parameters at two different moments, namely the previous action state and the motion direction at the current moment, which helps to improve the determination of the motion direction at the current moment. At the same time, the motion state is divided into a standby state, a first half action state, and a second half action state, and the motion state is more finely divided, further improving the accuracy of the determination of the motion state. In addition, it takes a certain amount of time to execute an action. Therefore, when it is determined that the motion direction of the previous action is different from the motion direction at the current moment, it is also judged whether the absolute value of the time difference between the moment corresponding to the current action state and the moment corresponding to the previous action state is greater than the preset time threshold, and whether there is sufficient duration between the first half action and the second half action, so as to improve the accuracy of action state recognition, and further improve the accuracy of head action recognition.
[0018] In one embodiment, after obtaining the previous action state and the previous motion direction, the method further includes: if the previous action state is the second half action state of the target action, and if the previous motion direction is different from the motion direction at the current moment, and the absolute value of the time difference between the moment corresponding to the current action state and the moment corresponding to the previous action state is greater than the preset time threshold, determining that the current action state is a continuous action state.
[0019] In the embodiments of the present application, a method for recognizing a continuous action state is also provided to determine a more accurate head action type through the continuous action state.
[0020] In one embodiment, after obtaining the previous action state and the previous motion direction, the method further includes: if the previous action state is the first half action state of the target action, and the motion direction at the current moment is the same as the previous motion direction, updating the current action state to the first half action state of the target action and re-recognizing the action state.
[0021] In the embodiments of the present application, if the motion directions at two consecutive moments are the same, and the previous action state is the first half action state of the target action, it indicates that the maximum amplitude of the action has not been reached at the previous moment, and a complete action cannot be determined. Therefore, starting from the current action state, the new action state at the next moment is re-detected to reduce the influence of user disturbance on the recognition accuracy.
[0022] In one embodiment, the target action corresponds to the direction corresponding to the first half of the action state. After obtaining the previous action state and the previous action direction, the method further includes: if the previous action state is the first half of the action state of a non-target action or the second half of the action state of a non-target action, updating the action state at the current moment to the first half of the action state of the target action and re-identifying the action state; the non-target action is the other action except the target action among the nodding action and the shaking head action.
[0023] In the embodiment of the present application, if the previous action state is the first half of the action state of a non-target action or the second half of the action state of a non-target action, it indicates that the current moment corresponds to the target action while the previous moment corresponds to the non-target action, and the two actions are inconsistent. It may be that the user's actions are not continuous. Therefore, re-detection is performed at the current moment to detect a more accurate action.
[0024] In one embodiment, determining the head action type according to the action state at the current moment includes: if the action state at the current moment is the second half of the action state of the target action and the previous action state is the first half of the action state of the target action, determining that the head action type is the type corresponding to the target action; and / or, if the action state at the current moment is the continuous action state of the target action, determining that the head action type is the type corresponding to the target action.
[0025] In one embodiment, after determining the action direction at the current moment, the method further includes: if the action direction at the current moment is not any direction corresponding to the nodding action and the shaking head action respectively, determining that the action state at the current moment is the release state; in response to the action state at the current moment being the release state, starting from the current moment, re-identifying the action direction and the action state.
[0026] In the embodiment of the present application, if the action direction at the current moment is not any direction corresponding to the nodding action and the shaking head action respectively, it indicates that the current action is an action that cannot be recognized or does not meet the requirements for being recognized as an action. It may be no action or an action type that does not need to be recognized. Therefore, it can be determined that the action state at the current moment is the release state, so as to facilitate re-identifying the action direction and the action state subsequently and improve the response efficiency of subsequent head action type recognition.
[0027] In one embodiment, determining the head action type according to the action state at the current moment includes: in response to the action state at the current moment changing to the release state, starting to time; if the timing duration reaches the preset duration, determining the head action type according to the previous action state and the current action state.
[0028] In the embodiments of the present application, if the action state changes to the release state at the current moment, it may indicate that the action has ended. Therefore, timing can be performed. When the timing reaches a certain duration and the action state has not changed, it indicates that the action has ended and the user's head movement no longer changes. Therefore, the head movement type can be determined and output based on the previous action state and the current action state.
[0029] In one embodiment, after determining that the action state at the current moment is the release state, the method further includes: obtaining the absolute values of a preset number of third sampling values of the gyroscope in the Y-axis direction; calculating the standard deviation of the absolute values of the preset number of third sampling values to obtain a target parameter; calculating a target threshold according to the target parameter, a previously obtained Y-axis threshold, and a preset threshold update formula; using the target threshold as the new Y-axis threshold; if the target threshold meets the preset threshold change requirement, adjusting the preset maximum threshold or the preset minimum threshold based on a preset scaling relationship.
[0030] In the case where the user is doing strenuous exercise, the user may not want to issue a head movement instruction itself. Therefore, in the embodiments of the present application, by recording the sampling values of the Y-axis, calculating the target sampling value and the target threshold based on the Y-axis sampling values, if the target threshold meets the preset threshold change requirement, it indicates whether the user is doing strenuous exercise. In the case where the user is doing strenuous exercise, the preset maximum threshold or the preset minimum threshold is adjusted to reduce the possibility of identifying the head movement type, thereby reducing the situation of misexecuting the corresponding instruction of the head movement due to strenuous exercise.
[0031] In a second aspect, the embodiments of the present application provide a head movement recognition device, which is applied to a head-mounted device. The head-mounted device includes a gyroscope. The head movement recognition device includes: a sampling module, configured to obtain the sampling values of the gyroscope; the sampling values include the previous moment's first sampling value and the current moment's first sampling value in the X-axis direction, and the previous moment's second sampling value and the current moment's second sampling value in the Z-axis direction; a direction recognition module, configured to compare the previous moment's first sampling value, the current moment's first sampling value, the previous moment's second sampling value, and the current moment's second sampling value to determine the action direction at the current moment; a state recognition module, configured to determine the action state at the current moment based on the action direction at the current moment and the previously obtained previous action state; an action determination module, configured to determine the head movement type according to the action state at the current moment.
[0032] In a third aspect, the embodiments of the present application provide a readable storage medium, in which a program is stored. When the program runs on a processor, the processor is caused to execute the head movement recognition method as described in any item of the first aspect.
[0033] Fourthly, an embodiment of the present application provides a method for recognizing head movements, and the embodiment of the present application also provides a head-mounted device, including: a gyroscope; a processor connected to the gyroscope and configured to execute the head movement recognition method according to any one of the first aspect. Description of the Drawings
[0034] To more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required to be used in the embodiments of the present application. It should be understood that the following drawings only show some embodiments of the present application and should not be regarded as limiting the scope. For those of ordinary skill in the art, without creative efforts, other relevant drawings can be obtained based on these drawings.
[0035] Figure 1 It is a flowchart of the head movement recognition method provided by an embodiment of the present application;
[0036] Figure 2 It is a schematic diagram of the gyroscope sampling result provided by an embodiment of the present application;
[0037] Figure 3 It is a schematic diagram of the head movement recognition device provided by the embodiment of the present application.
[0038] Icons: Head movement recognition device 200; Sampling module 210; Direction recognition module 220; State recognition module 230; Action determination module 240. Detailed Embodiments
[0039] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the following further elaborates on the present application in conjunction with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0040] First of all, an embodiment of the present application provides a method for recognizing head movements, which can be applied to a head-mounted device. The head-mounted device can be an earphone, smart glasses, a helmet, etc., which is not limited herein.
[0041] Among them, the head-mounted device includes a gyroscope. The gyroscope is a sensor that can measure the angular velocity of the device rotating around three axes (X-axis, Y-axis, and Z-axis). For specific reference, the prior art can be referred to and will not be elaborated herein.
[0042] In the embodiments of the present application, compared with the accelerometer sensor, the gyroscope has better stability when the user performs linear variable-speed activities. It can filter out a lot of noise generated by the variable-speed motion, and the output data is smoother. Moreover, this sensor is more sensitive to angle changes, and nodding and shaking the head are typical behaviors of head angle changes. Therefore, this sensor can better identify the head actions of nodding and shaking the head. Therefore, using the sampling values of the gyroscope for head action recognition helps to improve the accuracy of head action recognition.
[0043] Please refer to Figure 1 , Figure 1 which is a flowchart of the head action recognition method provided by an embodiment of the present application. The head action recognition method includes:
[0044] S110, obtaining the sampling values of the gyroscope.
[0045] In the embodiments of the present application, the sampling values may include a first sampling value and a second sampling value. The first sampling value represents the sampling value on the X axis of the gyroscope coordinate system, and the second sampling value is the sampling value on the Z axis of the gyroscope coordinate system.
[0046] In the embodiments of the present application, the first sampling value includes the first sampling value at the previous moment and the first sampling value at the current moment in the X-axis direction, and the second sampling value includes the second sampling value at the previous moment and the second sampling value at the current moment in the Z-axis direction.
[0047] Please refer to Figure 2 , Figure 2 which is a schematic diagram of the gyroscope sampling results provided by an embodiment of the present application. Among them, gyro_x, gyro_y, and gyro_z respectively represent the sampling results of the X axis, Y axis, and Z axis. As Figure 2 shown, the behavior characteristics of nodding are mainly distributed on the Z axis of the gyroscope, while the behavior characteristics of shaking the head are mainly distributed on the X axis of the gyroscope. Because the nodding behavior is mainly an action of changing the angle around the z axis, the change amplitude of the sampling value on the Z axis is relatively large, and shaking the head is mainly an action of changing the angle around the X axis, so that the change amplitude of the sampling value on the X axis is relatively large. Therefore, the types of head actions that can be recognized in the embodiments of the present application are shaking the head, nodding, and other head actions other than shaking the head and nodding. By the characteristic distribution of the sampling values of the gyroscope on different coordinate axes, it is possible to distinguish whether the user is making a nodding action, a head-shaking action, or other head actions.
[0048] Next, as Figure 2As shown, the sampled values of the gyroscope form different peaks and valleys. A complete nodding or shaking motion of the head includes one peak and one valley. The positive or negative value of the sampled value on the Z-axis indicates whether the nodding motion starts upward or downward, and the positive or negative value of the sampled value on the X-axis indicates whether the shaking motion starts to the right or to the left. Therefore, in the actual detection process, the order of the peak and the valley does not need to be considered, but one peak and one valley need to be detected continuously and adjacently. Therefore, in the embodiments of the present application, the sampled value at the current moment and the sampled value at the previous moment can be obtained, and the type of the head motion can be jointly determined by combining the motion directions and motion states before and after.
[0049] S120. Compare the first sampled value at the previous moment, the first sampled value at the current moment, the second sampled value at the previous moment, and the second sampled value at the current moment to determine the motion direction at the current moment.
[0050] In the embodiments of the present application, by comparing the first sampled value at the previous moment and the first sampled value at the current moment, the change of the user's head in the X-axis direction can be determined. For example, taking the left as the positive direction of the coordinate system of the gyroscope, if the first sampled value at the previous moment is less than the first sampled value at the current moment, it indicates that the value changes in the positive direction, and it may be a left head shake. On the contrary, if the first sampled value at the previous moment is greater than the first sampled value at the current moment, it indicates that the value changes in the negative direction, and it may be a right head shake.
[0051] Similarly, by comparing the second sampled value at the previous moment and the second sampled value at the current moment, the change of the user's head in the Z-axis direction can be determined.
[0052] As mentioned above, when the user nods and shakes the head, the distribution of the sampled values of the gyroscope on the coordinate system is different. Therefore, by comparing the first sampled value at the current moment and the second sampled value at the current moment, it can be determined whether the motion occurs on the X-axis or on the Z-axis.
[0053] In an embodiment of the present application, determining the motion direction at the current moment may include: combining and comparing the first sampled value at the previous moment, the first sampled value at the current moment, the second sampled value at the previous moment, and the second sampled value at the current moment to obtain a combined comparison result; determining the rising state of the sampling point at the current moment according to the combined comparison result; wherein the rising state of the sampling point represents the change direction of the sampled value of the sampling point; comparing the rising state of the sampling point at the current moment with the previously obtained rising state of the sampling point at the previous moment to determine the motion direction at the current moment.
[0054] The combined comparison includes the foregoing comparison contents, that is, comparing the first sampled value at the current moment with the first sampled value at the previous moment, comparing the second sampled value at the current moment with the second sampled value at the previous moment, and comparing the absolute values of the first sampled value at the current moment and the second sampled value at the current moment respectively.
[0055] In an embodiment of the present application, determining the rising state of the sampling point at the corresponding current moment according to the combined comparison result may include:
[0056] If the first sampling value at the current moment is greater than the first sampling value at the previous moment, and the absolute value of the first sampling value at the current moment is greater than the absolute value of the second sampling value at the current moment, then determine that the rising state of the sampling point at the current moment is the first rising state;
[0057] If the second sampling value at the current moment is greater than the second sampling value at the previous moment, and the absolute value of the second sampling value at the current moment is greater than the absolute value of the first sampling value at the current moment, then determine that the rising state of the sampling point at the current moment is the first rising state;
[0058] If the first sampling value at the current moment is less than the first sampling value at the previous moment, and the absolute value of the first sampling value at the current moment is greater than the absolute value of the second sampling value at the current moment, then determine that the rising state of the sampling point at the current moment is the second rising state;
[0059] If the second sampling value at the current moment is less than the second sampling value at the previous moment, and the absolute value of the second sampling value at the current moment is less than the absolute value of the first sampling value at the current moment, then determine that the rising state of the sampling point at the current moment is the second rising state.
[0060] In an embodiment of the present application, the first rising state represents that the sampling value of the sampling point changes in the positive direction of the gyroscope coordinate system; the second rising state represents that the sampling value of the sampling point changes in the negative direction of the gyroscope coordinate system.
[0061] In this embodiment, the rising state of the sampling point at the current moment is denoted as isDirectionUp, the first rising state can be denoted as true, that is, it represents that the sampling value changes in the positive direction of the gyroscope coordinate system (i.e., increases or rises), and the second rising state can be denoted as false, that is, it represents that the sampling value changes in the negative direction of the gyroscope coordinate system (i.e., decreases or falls).
[0062] In an embodiment of the present application, during the process of shaking the head, there may be a small nodding motion, which will make the value of the Z-axis positive or negative. Conversely, during the process of nodding, there may be a small shaking motion, which will make the value of the X-axis positive or negative. Therefore, the sampling values at the same moment may be positive on the X-axis and negative on the Z-axis (or vice versa, negative on the X-axis and positive on the Z-axis). Therefore, when comparing, the actual amplitude of the motion should be compared. Therefore, the comparison between the first sampling value at the current moment and the second sampling value at the current moment is a comparison of the absolute values of the two. To determine the actual rising state of the sampling point and the direction of the motion through the magnitude of the absolute value.
[0063] In an actual scenario, the speed at which a user performs a head movement may vary. When the sampling rate is fixed, the sampling values of two adjacent sampling points can both be positive or negative. Further, even if the sampling value corresponding to the current moment is greater than the sampling value of the previous moment, for example, when shaking the head to the left, the first sampling value at the previous moment is 100 and the first sampling value at the current moment is 150, it is still impossible to determine whether it is a change from shaking the head to the left from 100 to 150, or shaking the head to the left to reach the maximum value and then shaking the head backward, and obtaining the sampling value 150 during the process of shaking the head to the right.
[0064] Therefore, it may not be possible to determine the actual movement direction of the action through the sign of the sampling value. Thus, in the embodiments of the present application, the combined comparison result is only used to determine the rising state of the sampling point at the current moment, and when determining the movement direction at the current moment, the rising state of the sampling point at the current moment is also compared with the rising state of the sampling point at the previous moment to determine the actual movement direction at the current moment.
[0065] In an embodiment of the present application, comparing the rising state of the sampling point at the current moment with the rising state of the sampling point at the previous moment obtained in advance to determine the movement direction at the current moment may include:
[0066] If the rising state of the sampling point at the current moment is the second rising state, the rising state of the sampling point at the previous moment is the first rising state, and the absolute value of the first sampling value at the previous moment is greater than the preset maximum threshold and the absolute value of the first sampling value at the current moment is greater than the absolute value of the second sampling value at the current moment, then determine that the movement direction at the current moment is the first movement direction;
[0067] If the rising state of the sampling point at the current moment is the first rising state, the rising state of the sampling point at the previous moment is the second rising state, and the first sampling value at the previous moment is less than the preset minimum threshold and the absolute value of the first sampling value at the current moment is greater than the absolute value of the second sampling value at the current moment, then determine that the movement direction at the current moment is the second movement direction.
[0068] In this embodiment, the fact that the first sampling value at the current moment is greater than the second sampling value at the current moment indicates that the movement occurs on the X-axis. That is, the movement that occurs is a head-shaking movement. The first movement direction and the second movement direction are used to represent different directions of the head-shaking movement (shaking the head to the left and shaking the head to the right). The first movement direction represents the positive direction of the X-axis; the second movement direction represents the negative direction of the X-axis. The actual head-shaking directions represented by the first movement direction and the second movement direction may be different according to different definitions of the positive and negative directions of the gyroscope coordinate system, and are not limited herein. For example, if the positive direction of the X-axis is defined as the left direction and the negative direction is defined as the right direction, then the first movement direction is the right direction; the second movement direction is the left direction.
[0069] In the embodiments of the present application, the head movement includes a process of rotating towards the target direction and then rotating back. For example, a left head shake includes a process of turning the head to the left and then turning back. The process of turning to the left can be regarded as the first half of the left head shake action, and turning back can be regarded as the second half of the left head shake action.
[0070] When the rising state of the sampling point at the current moment is the same as the rising state of the sampling point at the previous moment, it indicates that the user is moving in the same direction between the two moments. At this time, if the movement direction is directly determined based on the rising states of the sampling points at two adjacent moments, it may occur that the determined movement direction is opposite to the actual movement. For example, taking the left movement as the positive direction of the X-axis, when doing the second half of the left head shake action, the rising states of the sampling points detected at two moments are both the second rising state (descending or decreasing), which represents a right-turning action, opposite to the left head shake action.
[0071] As mentioned above, a complete head shake action or nod action will include a peak and a trough. Combining Figure 2 As shown, when the sampling value at the previous moment is in an ascending state and the sampling value at the current moment is in a descending state, a complete peak can be determined. Conversely, when the sampling value at the previous moment is in a descending state and the sampling value at the current moment is in the above state, a complete trough can be determined. A complete peak or trough includes both an ascending and a descending part, and the second half of each peak is connected to a trough, and the second half of each trough is connected to a peak. When the amplitude of the user's action reaches the maximum, it can correspond to the peak and trough of the gyroscope sampling. Therefore, the peak or trough can be judged by two adjacent rising states, and then the action direction can be judged by the peak and trough.
[0072] When the rising state of the sampling point at the current moment is the second rising state and the rising state of the sampling point at the previous moment is the first rising state, it represents a peak. In the embodiments of the present application, it is also necessary to judge whether the first sampling value at the previous moment is greater than the preset maximum threshold. If it is less than the preset maximum threshold, it indicates that the amplitude of the user's executed action is insufficient, and it may be that the user does not intend to issue a head movement control instruction subjectively. Therefore, in the case of a peak, only when the first sampling value at the previous moment is greater than the preset maximum threshold, the action direction at the current moment is judged by combining the sampling value at the current moment.
[0073] Similarly, the peak and trough are two opposite features. In a gyroscope, the peak and trough represent rotations in two different directions. When the rising state of the sampling point at the current moment is the first rising state and the rising state of the sampling point at the previous moment is the second rising state, it represents a trough. It is also necessary to determine whether the first sampling value at the previous moment is greater than the preset maximum threshold. If it is less than the preset maximum threshold, it indicates that the amplitude of the user's executed action is insufficient. Therefore, in the case of a trough, only when the first sampling value at the previous moment is less than the preset maximum threshold, the sampling value at the current moment is combined to determine the action direction at the current moment.
[0074] In some embodiments of the present application, after determining that the action direction at the current moment is the first action direction, the previous action direction can also be obtained; if the previous action direction is not the first action direction, the first sampling value at the previous moment used to determine the action direction at the current moment is retained and used as the new peak value; if the previous action direction is the first action direction and the first sampling value at the previous moment used to determine the action direction at the current moment is greater than the peak value, it is determined that there is a false peak, and the first sampling value at the previous moment used to determine the action direction at the current moment is retained and used as the new peak value.
[0075] When it is determined that the action direction at the current moment is the first action direction, if the previous action direction is not the first action direction, it indicates that the consecutive two action directions are inconsistent, that is, the user's head has reached the maximum swing amplitude and is in the reverse rotation process, but it is not certain whether the maximum swing amplitude has been reached during the reverse rotation process. Therefore, the first sampling value at the previous moment used to determine the action direction at the current moment can be retained and used as the new peak value.
[0076] If the previous action direction is the first action direction, it indicates that the action direction determined at the previous moment is the same as that of the present application. That is, the user has not reached the maximum swing amplitude during the head rotation process. The previous peak value is determined by a false peak, and the swing amplitude corresponding to the false peak has not reached the maximum. The false peak cannot be used to determine the motion direction. Therefore, the motion direction corresponding to the false peak can be discarded, and the action direction at the current moment and the action direction determined at the next moment are used to re-determine the head action.
[0077] After determining the false peak, the first sampling value used for the motion direction at the current moment will be larger. Therefore, the first sampling value at the previous moment used to determine the action direction at the current moment can be retained and used as the new peak value for judging whether there is a false peak when identifying the next action direction.
[0078] Thus, through the identification of false peaks, the situation of incorrect head action recognition caused by false peaks can be reduced, and the accuracy of head action recognition can be improved.
[0079] Correspondingly, for the peak corresponding to the first movement direction, the trough corresponds to the second movement direction. Therefore, after determining that the movement direction at the current moment is the second movement direction, the previous movement direction can also be obtained; if the previous movement direction is not the second movement direction, the first sampling value at the previous moment used to determine the movement direction at the current moment is retained and used as the new trough value; if the previous movement direction is the second movement direction, and the first sampling value at the previous moment used to determine the movement direction at the current moment is less than the trough value, it is determined that there is a false trough, and the first sampling value at the previous moment used to determine the movement direction at the current moment is retained and used as the new trough value.
[0080] Correspondingly, this method can effectively reduce the influence of false troughs on the accuracy of head movement recognition and improve the accuracy of head movement recognition.
[0081] Similarly, for the first movement direction and the second movement direction which are the directions of the head shaking movement, the same processing can also be performed for different directions of the head nodding movement. The following process can be included:
[0082] If the rising state of the sampling point at the current moment is the second rising state, the rising state of the sampling point at the previous moment is the first rising state, and the second sampling value at the previous moment is greater than the preset maximum threshold, and the absolute value of the second sampling value at the current moment is greater than the absolute value of the first sampling value at the current moment, then it is determined that the movement direction at the current moment is the third movement direction.
[0083] If the rising state of the sampling point at the current moment is the first rising state, the rising state of the sampling point at the previous moment is the second rising state, and the second sampling value at the previous moment is less than the preset minimum threshold, and the absolute value of the second sampling value at the current moment is greater than the absolute value of the first sampling value at the current moment, then it is determined that the movement direction at the current moment is the fourth movement direction.
[0084] The third movement direction and the fourth movement direction are the upward direction and the downward direction of the head nodding movement. The third movement direction represents the positive direction of the Z axis; the fourth movement direction represents the negative direction of the Z axis. The third movement direction and the fourth movement direction can be determined according to the direction corresponding to the Z axis of the coordinate system.
[0085] Correspondingly, after determining that the movement direction at the current moment is the third movement direction, the previous movement direction can also be obtained; if the previous movement direction is not the third movement direction, the second sampling value at the previous moment used to determine the movement direction at the current moment is retained and used as the new peak value; if the previous movement direction is the third movement direction, and the second sampling value at the previous moment used to determine the movement direction at the current moment is greater than the peak value, it is determined that there is a false peak, and the second sampling value at the previous moment used to determine the movement direction at the current moment is retained and used as the new peak value.
[0086] And, after determining that the movement direction at the current moment is the fourth movement direction, the previous movement direction can also be obtained; if the previous movement direction is not the fourth movement direction, the second sampling value at the previous moment used to determine the movement direction at the current moment is retained and used as the new trough value; if the previous movement direction is the fourth movement direction, and the second sampling value at the previous moment used to determine the movement direction at the current moment is less than the trough value, it is determined that there is a pseudo-trough, and the second sampling value at the previous moment used to determine the movement direction at the current moment is retained and used as the new trough value.
[0087] S130. Determine the movement state at the current moment based on the movement direction at the current moment and the previously obtained previous movement state.
[0088] In one embodiment, determining the movement state at the current moment based on the movement direction at the current moment and the previously obtained previous movement state may include: when the movement direction at the current moment is any one of the preset target directions, obtaining the previous movement state and the previous movement direction; if the previous movement state is the preset standby state, determining that the movement state at the current moment is the first half movement state of the target movement.
[0089] And, if the previous movement state is the first half movement state of the target movement, the previous movement direction is different from the movement direction at the current moment, and the absolute value of the time difference between the moment corresponding to the movement state at the current moment and the moment corresponding to the previous movement state is greater than the preset time threshold, it is determined that the movement state at the current moment is the second half movement state of the target movement.
[0090] Similarly, the movement state may not have been determined at the previous moment. Therefore, the previous movement state may not be the movement state determined at the previous moment, and it may be the movement state determined before the previous moment.
[0091] In this embodiment, the preset target directions include one of the first movement direction, the second movement direction, the third movement direction, and the fourth movement direction. When the movement direction at the current moment is any one of the preset target directions, it may be a head shaking or nodding movement, within the range of head movement types recognizable in this application.
[0092] The target movement is the movement corresponding to the movement direction at the current moment; for example, when the movement direction at the current moment is the first direction or the second direction, the target movement is left head shaking or right head shaking. When the previous movement direction is the third movement direction or the fourth movement direction, the target movement is up nodding and down nodding in the nodding movement.
[0093] As described above, each movement has two processes of rotation and rotation back. Therefore, in the embodiments of this application, each movement can be divided into two halves to determine the movement state at the current moment by combining the previous movement state and the movement direction at the current moment.
[0094] Among them, the standby state may mean that the head faces forward naturally. At this time, the values on the X-axis and Z-axis are usually 0 or near 0. If the previous action state is the preset standby state and the current movement direction is determined at this time, it indicates that the head is in the state of starting to rotate for the target action. Therefore, it can be determined that the action state at the current moment is the first half of the target action state. For example, during the process of the head rotating from facing forward to facing left / right.
[0095] If the previous action state is the first half of the target action state and the previous action direction is different from the action direction at the current moment, the head may be in the process of rotating back, such as during the process of the head rotating from facing left / right / up / down to facing forward. At this time, it is determined that the action state at the current moment may be the second half of the target action state.
[0096] Since an action requires a certain execution time, it is necessary to determine that the action state at the current moment may be the second half of the target action state only when the absolute value of the time difference between the moment corresponding to the action state at the current moment and the moment corresponding to the previous action state is greater than the preset time threshold, so as to reduce misjudgment.
[0097] If the previous action state is the second half of the target action state, and if the previous action direction is different from the action direction at the current moment, and the absolute value of the time difference between the moment corresponding to the action state at the current moment and the moment corresponding to the previous action state is greater than the preset time threshold, it is determined that the action state at the current moment is a continuous action state.
[0098] Since the determination of the second half of the action state already requires the previous moment to be in the first half of the action state, if the previous action state is the second half of the target action state, it indicates that an action has been completed. At this time, if it is continued to determine that the previous action direction is different from the action direction at the current moment, and the absolute value of the time difference between the moment corresponding to the action state at the current moment and the moment corresponding to the previous action state is greater than the preset time threshold, it indicates that the user has started to execute the second action, and the second action is of the same type as the previous action. Therefore, it can be determined that the action state at the current moment is the second half of the target action state.
[0099] In an embodiment of the present application, after obtaining the previous action state and the previous action direction, if the previous action state is the first half of the target action state and the action direction at the current moment is the same as the previous action direction, the action state at the current moment is updated to the first half of the target action state, and the action state is re-identified. Re-identifying the action state means that the next moment is used as the new current moment for action state recognition.
[0100] As described above, if the action directions at two consecutive moments are the same, it is possible that the two moments are rotating in the same direction, and at this time, the maximum rotation amplitude has not been reached. If it has been determined that the previous action state is the first half of the target action state, it means that both the current moment and the previous moment are in the process of executing the first half of the action. Since a complete action includes the first half and the second half of the action, it means that a new moment needs to be updated to re-determine the peak or trough. Therefore, the action state at the current moment can be used as the new previous moment, and the next moment can be used as the new current moment to re-identify the currently recognized action state.
[0101] In this embodiment, the interference of the user's head perturbation can be effectively reduced, and the accuracy of head action recognition can be improved.
[0102] In some embodiments, the target action corresponds to the direction corresponding to the first half of the action state. After obtaining the previous action state and the previous action direction, the method further includes: if the previous action state is the first half of a non-target action state or the second half of a non-target action state, then update the action state at the current moment to the first half of the target action state; the non-target action is the other action except the target action among the nodding action and the shaking head action.
[0103] If the previous action state is the first half of a non-target action state or the second half of a non-target action state. For example, the previous action state is the first half or the second half of the nodding action, and the action state at the current moment is the first half or the second half of the shaking head action (or vice versa). Then the actions corresponding to the two action states before and after are completely different, which indicates that the nodding action or the shaking head action is not continuous and may be misdetected. At this time, the action state at the current moment is used as the new previous moment, and the next moment is used as the new current moment to re-identify the currently recognized action state. This method can also effectively reduce the interference of the user's head perturbation on head action recognition and improve the accuracy of head action recognition.
[0104] S140. Determine the head action type according to the action state at the current moment.
[0105] In one embodiment, determining the head action type according to the action state at the current moment may include:
[0106] If the action state at the current moment is the second half action state of the target action and the previous action state is the first half action state of the target action, then determine that the head action type is the type corresponding to the target action. In this case, the action state at the current moment and the previous action state can form a complete action. At this time, the type of the complete action formed can be determined as the head action type. For example, if the action state at the current moment is the second half action state of left head shake and the previous action state is the first half action state of left head shake, then determine that the head action type is left head shake. Another example, if the action state at the current moment is the second half action state of up head nod and the previous action state is the first half action state of up head nod, then determine that the head action type is up head nod.
[0107] Meanwhile, if the action state at the current moment is the continuous action state of the target action, also determine that the head action type is the type corresponding to the target action. Since the continuous action state indicates that the user has completed a complete action, therefore, if the action state at the current moment is the continuous action state, the head action type can also be directly determined.
[0108] After S120, it may not belong to either the nodding or head shaking action. At this time, the head action does not fall within the range of recognizable types. Therefore, in some embodiments of the present application, after determining the action direction at the current moment, the method further includes: if the action direction at the current moment is not any one of the directions corresponding to the nodding action and the head shaking action, then determine that the action state at the current moment is the release state; in response to the action state at the current moment being the release state, starting from the current moment, re-recognize the action direction and the action state.
[0109] In the embodiments of the present application, the release state is used to represent the completion of the recognition of an action. When the action state at the current moment is the release state, starting from the current moment, re-recognize the action direction and the action state to facilitate the timely recognition of subsequent actions.
[0110] In some embodiments of the present application, determining the head action type according to the action state at the current moment includes: in response to the action state at the current moment changing to the release state, starting to time; if the timing duration reaches the preset duration, then determine the head action type according to the previous action state and the current action state.
[0111] When the action state at the current moment changes to the release state, it indicates that the user has completed the action, but the user may perform a new action to change the head action type. Therefore, timing can be started. When the timing duration reaches the preset duration, it indicates that no subsequent action has been performed within the preset duration. At this time, it can be completely determined that the user has completed an action, and then the head action type of the head action performed by the user this time can be determined according to the previous action state and the current action state.
[0112] Among them, each time the action state at the current moment changes to the release state, the timing is cleared to start timing from 0. Since it has changed to the release state, if no new action is recognized within the subsequent preset duration, it indicates that the user has not made a head movement, and it can be determined that the head movement type is no head movement.
[0113] When it is determined that the action direction at the current moment is not the direction of nodding or shaking the head, and it is determined that the action state at the current moment is the release state, it indicates no action or the action cannot be recognized. In the case where the action cannot be recognized, it may be that the user is engaged in strenuous exercise. In the case where the user is engaged in strenuous exercise, the head may move, and at this time, the action may not be the control instruction corresponding to the head movement that the user subjectively wants to issue. Therefore, in an embodiment of the present application, it is also possible to identify whether the user is engaged in strenuous exercise, so as to reduce the recognition sensitivity of head movements when the user is engaged in strenuous exercise.
[0114] In an embodiment of the present application, after determining that the action state at the current moment is the release state, it is also possible to obtain the absolute values of a preset number of third sampling values of the gyroscope in the Y-axis direction; calculate the standard deviation of the absolute values of all the preset number of third sampling values to obtain a target parameter; calculate a target threshold according to the target parameter, the previously obtained Y-axis threshold, and a preset threshold update formula; use the target threshold as the new Y-axis threshold; if the target threshold meets the preset threshold change requirement, adjust the preset maximum threshold or the preset minimum threshold based on a preset scaling relationship.
[0115] During the process of head recognition, both the first sampling value and the second sampling value are used for head movement recognition. Therefore, in an embodiment of the present application, the third sampling value of the Y-axis can be used to determine whether the user may be in a state of strenuous exercise through the third sampling value.
[0116] In this embodiment, the absolute values of the third sampling values of the gyroscope on the Y-axis can be continuously obtained and recorded. When the recorded absolute values of the third sampling values reach the preset number, the standard deviation of all the absolute values of the third sampling values can be calculated to obtain a target parameter.
[0117] In this embodiment, the Y-axis threshold is used to represent the change amplitude and will change with the user's movement during use. The Y-axis threshold obtained at the current moment can be calculated previously.
[0118] Among them, a target threshold can be calculated according to the target parameter, the previously obtained Y-axis threshold, and a preset threshold update formula, and the target threshold is used as the Y-axis threshold.
[0119] The preset threshold update formula can be expressed as:
[0120] y_axis_th_update_2
[0121] = a * y_axis_th_update_1 + (1 - a) * y_axis_cur_std_change
[0122] Where y_axis_cur_std_change is the target parameter, a is the preset coefficient value, y_axis_th_update_2 on the left side of the formula is the updated target threshold, y_axis_th_update_1 on the right side of the formula is the pre-obtained Y-axis threshold, and y_axis_cur_std_change is the target parameter.
[0123] In this embodiment, the updated Y-axis threshold is used to characterize whether the user is in a strenuous exercise state. When the Y-axis threshold meets the preset threshold change requirement, such as when the Y-axis threshold is greater than the preset fixed value, it can be determined that the user is in a strenuous exercise state. On the contrary, if the updated Y-axis threshold does not meet the preset threshold change requirement, such as when the Y-axis threshold is less than the preset fixed value, it is determined that the user may not be in a strenuous exercise state.
[0124] When the user is in a strenuous exercise state, the preset maximum threshold is enlarged or the minimum preset threshold is reduced to reduce the recognition sensitivity of determining the movement direction. On the contrary, when the user is not in a strenuous exercise state, the preset maximum threshold and the minimum preset threshold remain unchanged.
[0125] In this embodiment, the preset scaling relationship may include:
[0126] tmp_max_threshold_2 = tmp_max_threshold_1 * scale
[0127] tmp_min_threshold_2 = tmp_min_threshold_1 * scale
[0128] Where scale is the preset scaling coefficient and scale is greater than 1. It can be a fixed value. For example, scale is set to 1.6. tmp_min_threshold_1 represents the preset minimum threshold before update, tmp_max_threshold_1 represents the preset maximum threshold before update. tmp_min_threshold_2 represents the preset minimum threshold after update, and 1tmp_max_threshold_2 represents the preset maximum threshold after update.
[0129] In addition, in this embodiment, continuous sampling is performed according to the third sampling value of the Y-axis to generate a new target parameter and a new Y-axis threshold, so as to update the Y-axis threshold. Therefore, the preset maximum threshold and the preset minimum threshold will also be restored after adjustment to be adjusted according to the actual state of the user, so that corresponding recognition sensitivities can be obtained in different states of the user.
[0130] In some other embodiments of the present application, it is also possible to determine whether the user is in a state of strenuous exercise through other modules and devices, and adjust the preset maximum threshold or the preset minimum threshold when it is determined that the user is in a state of strenuous exercise or exits the state of strenuous exercise, so as to adjust the sensitivity of head movement recognition, which is not limited herein.
[0131] Through the above head movement recognition method, the accuracy of head movement recognition can be effectively improved, and then it is convenient for the head-mounted device to execute corresponding control instructions according to the head movement, thereby enhancing the user experience effect.
[0132] Based on the same inventive concept, an embodiment of the present application further provides a head movement recognition device. The head movement recognition device is applied to a head-mounted device, and the head-mounted device includes a gyroscope.
[0133] Please refer to Figure 3 , Figure 3 , which is a schematic diagram of the head movement recognition device provided by the embodiment of the present application. The head movement recognition device 200 includes:
[0134] A sampling module 210, configured to obtain sampling values of the gyroscope; the sampling values include the previous first sampling value and the current first sampling value in the X-axis direction, and the previous second sampling value and the current second sampling value in the Z-axis direction.
[0135] A direction recognition module 220, configured to compare the previous first sampling value, the current first sampling value, the previous second sampling value, and the current second sampling value to determine the action direction at the current moment.
[0136] A state recognition module 230, configured to determine the action state at the current moment based on the action direction at the current moment and the previously obtained previous action state.
[0137] An action determination module 240, configured to determine the type of head movement according to the action state at the current moment.
[0138] A direction recognition module 220 is configured to perform a combined comparison on the first sampling value at the previous moment, the first sampling value at the current moment, the second sampling value at the previous moment, and the second sampling value at the current moment to obtain a combined comparison result; the combined comparison includes: comparing the first sampling value at the current moment with the first sampling value at the previous moment, comparing the second sampling value at the current moment with the second sampling value at the previous moment, and comparing the absolute values of the first sampling value at the current moment and the second sampling value at the current moment; determining the rising state of the sampling point at the current moment according to the combined comparison result; wherein, the rising state of the sampling point represents the change direction of the sampling value of the sampling point; comparing the rising state of the sampling point at the current moment with the previously obtained rising state of the sampling point at the previous moment to determine the action direction at the current moment.
[0139] The direction recognition module 220 is configured to: if the first sampling value at the current moment is greater than the first sampling value at the previous moment, and the absolute value of the first sampling value at the current moment is greater than the absolute value of the second sampling value at the current moment, determine that the rising state of the sampling point at the current moment is the first rising state; the first rising state represents that the sampling value of the sampling point changes in the positive direction of the gyroscope coordinate system; if the second sampling value at the current moment is greater than the second sampling value at the previous moment, and the absolute value of the second sampling value at the current moment is greater than the absolute value of the first sampling value at the current moment, determine that the rising state of the sampling point at the current moment is the first rising state; if the first sampling value at the current moment is less than the first sampling value at the previous moment, and the absolute value of the first sampling value at the current moment is greater than the absolute value of the second sampling value at the current moment, determine that the rising state of the sampling point at the current moment is the second rising state; the second rising state represents that the sampling value of the sampling point changes in the negative direction of the gyroscope coordinate system; if the second sampling value at the current moment is less than the second sampling value at the previous moment, and the absolute value of the second sampling value at the current moment is greater than the absolute value of the first sampling value at the current moment, determine that the rising state of the sampling point at the current moment is the second rising state.
[0140] A direction recognition module 220 is configured to: if the rising state of the sampling point at the current moment is the second rising state, the rising state of the sampling point at the previous moment is the first rising state, the first sampling value at the previous moment is greater than a preset maximum threshold, and the absolute value of the first sampling value at the current moment is greater than the absolute value of the second sampling value at the current moment, determine that the action direction at the current moment is the first action direction; the first action direction represents the positive direction of the X-axis; if the rising state of the sampling point at the current moment is the first rising state, the rising state of the sampling point at the previous moment is the second rising state, the first sampling value at the previous moment is less than a preset minimum threshold, and the absolute value of the first sampling value at the current moment is greater than the absolute value of the second sampling value at the current moment, determine that the action direction at the current moment is the second action direction; the second action direction represents the negative direction of the X-axis.
[0141] The direction recognition module 220 is configured to, after determining that the action direction at the current moment is the first action direction, obtain the previous action direction; if the previous action direction is not the first action direction, retain the first sampling value at the previous moment used to determine the action direction at the current moment and use it as the new peak value; if the previous action direction is the first action direction and the first sampling value at the previous moment used to determine the action direction at the current moment is greater than the peak value, determine that there is a false peak, and retain the first sampling value at the previous moment used to determine the action direction at the current moment and use it as the new peak value; and, after determining that the action direction at the current moment is the second action direction, obtain the previous action direction; if the previous action direction is not the second action direction, retain the first sampling value at the previous moment used to determine the action direction at the current moment and use it as the new trough value; if the previous action direction is the second action direction and the first sampling value at the previous moment used to determine the action direction at the current moment is less than the trough value, determine that there is a false trough, and retain the first sampling value at the previous moment used to determine the action direction at the current moment and use it as the new trough value.
[0142] A direction recognition module 220 is configured to: if the rising state of the sampling point at the current moment is the second rising state, the rising state of the sampling point at the previous moment is the first rising state, the second sampling value at the previous moment is greater than a preset maximum threshold, and the absolute value of the second sampling value at the current moment is greater than the absolute value of the first sampling value at the current moment, determine that the action direction at the current moment is the third action direction; the third action direction represents the positive direction of the Z axis; if the rising state of the sampling point at the current moment is the first rising state, the rising state of the sampling point at the previous moment is the second rising state, the second sampling value at the previous moment is less than a preset minimum threshold, and the absolute value of the second sampling value at the current moment is greater than the absolute value of the first sampling value at the current moment, determine that the action direction at the current moment is the fourth action direction; the fourth action direction represents the negative direction of the Z axis.
[0143] In one embodiment, the direction determination module is configured to, after determining that the action direction at the current moment is the third action direction, obtain the previous action direction; if the previous action direction is not the third action direction, retain the second sampling value at the previous moment used to determine the action direction at the current moment and use it as the new peak value; if the previous action direction is the third action direction and the second sampling value at the previous moment used to determine the action direction at the current moment is greater than the peak value, determine that there is a false peak, and retain the second sampling value at the previous moment used to determine the action direction at the current moment and use it as the new peak value; and, after determining that the action direction at the current moment is the fourth action direction, obtain the previous action direction; if the previous action direction is not the fourth action direction, retain the second sampling value at the previous moment used to determine the action direction at the current moment and use it as the new trough value; if the previous action direction is the fourth action direction and the second sampling value at the previous moment used to determine the action direction at the current moment is less than the trough value, determine that there is a false trough, and retain the second sampling value at the previous moment used to determine the action direction at the current moment and use it as the new trough value.
[0144] In one embodiment, the state recognition module 230 is configured to, when the action direction at the current moment is any one of the preset target directions, obtain the previous action state and the previous action direction; the preset target directions include one of the first action direction, the second action direction, the third action direction, and the fourth action direction; if the previous action state is the preset standby state, determine that the action state at the current moment is the first half of the target action; the target action is the action corresponding to the action direction at the current moment; if the previous action state is the first half of the target action, the previous action direction is different from the action direction at the current moment, and the absolute value of the time difference between the time corresponding to the action state at the current moment and the time corresponding to the previous action state is greater than the preset time threshold, determine that the action state at the current moment is the second half of the target action.
[0145] In one embodiment, the state recognition module 230 is configured to: if the previous action state is the second half of the target action, and if the previous action direction is different from the action direction at the current moment, and the absolute value of the time difference between the time corresponding to the action state at the current moment and the time corresponding to the previous action state is greater than the preset time threshold, determine that the action state at the current moment is a continuous action state.
[0146] In one embodiment, the state recognition module 230 is further configured to: if the previous action state is the first half of the target action, and the action direction at the current moment is the same as the previous action direction, update the action state at the current moment to the first half of the target action and re-recognize the action state.
[0147] In one embodiment, the target action and the direction corresponding to the first half of the action state, the state recognition module 230 is further configured to, if the previous action state is not the first half of the target action or not the second half of the target action, update the action state at the current moment to the first half of the target action and re-recognize the action state; the non-target action is the other action except the target action among the nodding action and the shaking head action.
[0148] In one embodiment, the action determination module 240 is configured to, if the action state at the current moment is the second half of the target action and the previous action state is the first half of the target action, determine that the head action type is the type corresponding to the target action; and / or, if the action state at the current moment is the continuous action state of the target action, determine that the head action type is the type corresponding to the target action.
[0149] In one embodiment, the direction recognition module 220 is configured to determine that the action state at the current moment is the release state if the action direction at the current moment is not any direction corresponding to the nodding action and the shaking action; in response to the action state at the current moment being the release state, re-recognize the action direction and the action state starting from the current moment.
[0150] In one embodiment, the action determination module 240 is configured to start timing in response to the action state at the current moment changing to the release state; if the timing duration reaches a preset duration, determine the type of head action according to the previous action state and the current action state.
[0151] In one embodiment, after determining that the action state at the current moment is the release state, the direction recognition module 220 is configured to obtain the absolute values of a preset number of third sampling values of the gyroscope in the Y-axis direction; calculate the standard deviation of the absolute values of the preset number of third sampling values to obtain a target parameter; calculate a target threshold according to the target parameter, a previously obtained Y-axis threshold, and a preset threshold update formula; use the target threshold as the new Y-axis threshold; if the target threshold meets a preset threshold change requirement, adjust the preset maximum threshold or the preset minimum threshold based on a preset scaling relationship.
[0152] The functions implemented by the head action recognition device 200 are similar to those of the foregoing head action recognition method. The functions implemented by the head action recognition device 200 may refer to the foregoing head action recognition method and will not be elaborated here.
[0153] Based on the same inventive concept, the present application further provides a head-mounted device. The head-mounted device at least includes a gyroscope and a processor. The processor is connected to the gyroscope and is configured to execute the head action recognition method according to any one of the foregoing embodiments.
[0154] Among them, the head-mounted device may be an earphone, smart glasses, a helmet, etc., and is not limited herein.
[0155] Based on the same inventive concept, the embodiment of the present application further provides a readable storage medium. Instructions are stored in the storage medium and can be executed by one or more processors to implement the head action recognition method provided in the above embodiment.
[0156] The computer-readable storage medium can be any available medium accessible by a computer or a data storage device such as a server or a data center integrating one or more available media. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, or a magnetic tape), an optical medium (such as a DVD (Digital Video Disc)), or a semiconductor medium (such as an SSD (Solid State Disk)), etc.
[0157] If the head movement recognition method is implemented in the form of software functional modules and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application. The aforementioned storage medium includes: various media such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a magnetic disk, or an optical disc that can store program codes.
[0158] In the embodiments provided in this application, it should be understood that the disclosed method can also be implemented in other ways. In various embodiments of this application, the functional modules can be integrated together to form an independent part, or each module can exist alone, or two or more modules can be integrated to form an independent part.
[0159] The above embodiments can be freely combined without conflict, and the combined embodiments are covered by the protection scope of this application.
[0160] The detailed description of the embodiments of this application provided in the drawings above is not intended to limit the scope of this application claimed, but merely represents selected embodiments of this application. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the protection scope of this application.
[0161] It should be noted that: Similar reference numerals and letters denote similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.
[0162] In the description of the present application, it should also be noted that unless otherwise clearly defined and limited, the term "connection" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be an electrical connection; it can be directly connected, or indirectly connected through an intermediate medium, and it can be the communication inside two components. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to specific situations.
[0163] The above are only the embodiments of the present application and are not used to limit the protection scope of the present application. For those skilled in the art, the present application can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A head action recognition method, characterized in that: Applied to a head mounted device, the head mounted device includes a gyroscope; the head movement recognition method includes: Acquire sampling values of the gyroscope; the sampling values include a first sampling value at a previous moment and a first sampling value at a current moment in the X-axis direction, and a second sampling value at a previous moment and a second sampling value at a current moment in the Z-axis direction; Compare the first sampling value at the previous moment, the first sampling value at the current moment, the second sampling value at the previous moment, and the second sampling value at the current moment to determine the action direction at the current moment; Determining the current action state based on the current action direction and the previous action state acquired in advance; The head movement type is determined according to the movement state at the current moment.
2. The method according to claim 1, characterized in that The comparing the first sampling value at the previous moment, the first sampling value at the current moment, the second sampling value at the previous moment, and the second sampling value at the current moment to determine the action direction at the current moment includes: Performing a combined comparison on the first sampling value at the previous moment, the first sampling value at the current moment, the second sampling value at the previous moment, and the second sampling value at the current moment to obtain a combined comparison result; the combined comparison includes: comparing the first sampling value at the current moment with the first sampling value at the previous moment, comparing the second sampling value at the current moment with the second sampling value at the previous moment, and comparing the absolute values of the first sampling value at the current moment and the second sampling value at the current moment; Determine the rising state of the sampling point at the current moment according to the combined comparison result; wherein the rising state of the sampling point represents the direction of change of the sampling value of the sampling point; The rising state of the sampling point at the current moment is compared with the rising state of the sampling point at the previous moment acquired in advance to determine the action direction at the current moment.
3. The method according to claim 2, characterized in that The step of determining the corresponding current sampling point rising state according to the combined comparison result includes: If the first sampling value at the current moment is greater than the first sampling value at the previous moment, and the absolute value of the first sampling value at the current moment is greater than the absolute value of the second sampling value at the current moment, then it is determined that the rising state of the sampling point at the current moment is the first rising state; the first rising state indicates that the sampling value of the sampling point changes in the positive direction of the gyroscope coordinate system; If the second sampling value at the current moment is greater than the second sampling value at the previous moment, and the absolute value of the second sampling value at the current moment is greater than the absolute value of the first sampling value at the current moment, then it is determined that the rising state of the sampling point at the current moment is the first rising state; If the first sampling value at the current moment is less than the first sampling value at the previous moment, and the absolute value of the first sampling value at the current moment is greater than the absolute value of the second sampling value at the current moment, then it is determined that the rising state of the sampling point at the current moment is the second rising state; the second rising state indicates that the sampling value of the sampling point changes in the negative direction of the gyroscope coordinate system; If the second sampling value at the current moment is less than the second sampling value at the previous moment, and the absolute value of the second sampling value at the current moment is greater than the absolute value of the first sampling value at the current moment, it is determined that the rising state of the sampling point at the current moment is the second rising state.
4. The method according to claim 3, characterized in that The step of comparing the rising state of the sampling point at the current moment with the rising state of the sampling point at the previous moment acquired in advance to determine the action direction at the current moment includes: If the rising state of the sampling point at the current moment is the second rising state, the rising state of the sampling point at the previous moment is the first rising state, and the first sampling value at the previous moment is greater than the preset maximum threshold, and the absolute value of the first sampling value at the current moment is greater than the absolute value of the second sampling value at the current moment, then it is determined that the action direction at the current moment is the first action direction; the first action direction represents the positive direction of the X-axis; If the rising state of the sampling point at the current moment is the first rising state, the rising state of the sampling point at the previous moment is the second rising state, and the first sampling value at the previous moment is less than the preset minimum threshold, and the absolute value of the first sampling value at the current moment is greater than the absolute value of the second sampling value at the current moment, then it is determined that the action direction at the current moment is the second action direction; the second action direction represents the negative direction of the X-axis.
5. The method according to claim 4, characterized in that After determining that the current action direction is the first action direction, the method further includes: Get the previous action direction; If the previous motion direction is not the first motion direction, retaining the first sampling value at the previous moment used to determine the motion direction at the current moment and serving as a new peak value; If the previous action direction is the first action direction, and the first sampling value at the previous moment used for the action direction at the current moment is greater than the peak value, it is determined that a pseudo peak exists, and the first sampling value at the previous moment used to determine the action direction at the current moment is retained and used as the new peak value; And, after determining that the current action direction is the second action direction, the method further includes: Obtaining the previous action direction; If the previous motion direction is not the second motion direction, retaining the first sampling value at the previous moment used to determine the motion direction at the current moment and serving as a new trough value; If the previous action direction is the second action direction, and the first sampling value at the previous moment used for the action direction at the current moment is less than the trough value, it is determined that a pseudo trough exists, and the first sampling value at the previous moment used to determine the action direction at the current moment is retained and used as the new trough value.
6. The method according to claim 3, characterized in that: The step of comparing the rising state of the sampling point at the current moment with the rising state of the sampling point at the previous moment acquired in advance to determine the action direction at the current moment includes: If the rising state of the sampling point at the current moment is the second rising state, the rising state of the sampling point at the previous moment is the first rising state, and the second sampling value at the previous moment is greater than the preset maximum threshold, and the absolute value of the second sampling value at the current moment is greater than the absolute value of the first sampling value at the current moment, then it is determined that the action direction at the current moment is the third action direction; the third action direction represents the positive direction of the Z axis; If the rising state of the sampling point at the current moment is the first rising state, the rising state of the sampling point at the previous moment is the second rising state, and the second sampling value at the previous moment is less than the preset minimum threshold, and the absolute value of the second sampling value at the current moment is greater than the absolute value of the first sampling value at the current moment, then the action direction at the current moment is determined to be the fourth action direction; the fourth action direction represents the negative direction of the Z axis.
7. The method according to claim 6, characterized in that After determining that the current action direction is the third action direction, the method further includes: Get the previous action direction; If the previous motion direction is not the third motion direction, the second sampling value at the previous moment used to determine the motion direction at the current moment is retained and used as a new peak value; If the previous action direction is the third action direction, and the second sampling value at the previous moment used for the action direction at the current moment is greater than the peak value, it is determined that a pseudo peak exists, and the second sampling value at the previous moment used to determine the action direction at the current moment is retained and used as a new peak value; And, after determining that the current action direction is the fourth action direction, the method further includes: Obtaining the previous action direction; If the previous motion direction is not the fourth motion direction, retaining the second sampling value at the previous moment used to determine the motion direction at the current moment and serving as a new trough value; If the previous action direction is the fourth action direction, and the second sampling value at the previous moment used for the action direction at the current moment is less than the trough value, it is determined that a pseudo trough exists, and the second sampling value at the previous moment used to determine the action direction at the current moment is retained and used as the new trough value.
8. The method according to claim 4 or 6, characterized in that: The determining the current action state based on the current action direction and the previous action state acquired in advance includes: When the current action direction is any preset target direction, obtaining the previous action state and the previous action direction; the preset target direction includes one of the first action direction, the second action direction, the third action direction, and the fourth action direction; If the previous action state is a preset standby state, determining that the current action state is the first half action state of the target action; the target action is the action corresponding to the action direction at the current moment; If the previous action state is the first half action state of the target action, the previous action direction is different from the action direction at the current moment, and the absolute value of the time difference between the moment corresponding to the action state at the current moment and the moment corresponding to the previous action state is greater than a preset time threshold, the action state at the current moment is determined to be the second half action state of the target action.
9. The method according to claim 8, characterized in that After acquiring the previous action state and the previous action direction, the method further includes: If the previous action state is the second half action state of the target action, and if the previous action direction is different from the action direction at the current moment, and the absolute value of the time difference between the moment corresponding to the action state at the current moment and the moment corresponding to the previous action state is greater than the preset time threshold, the action state at the current moment is determined to be a continuous action state.
10. The method according to claim 8, characterized in that After acquiring the previous action state and the previous action direction, the method further includes: If the previous action state is the first half action state of the target action, and the current action direction is the same as the previous action direction, the current action state is updated to the first half action state of the target action, and the action state is re-identified.
11. The method according to claim 8, characterized in that The target action corresponds to the direction corresponding to the first half action state, and after acquiring the previous action state and the previous action direction, the method further includes: If the previous action state is the first half action state of a non-target action or the second half action state of a non-target action, the current action state is updated to the first half action state of the target action, and the action state is re-identified; the non-target action is another action among the nodding action and the shaking action other than the target action.
12. The method according to claim 9, characterized in that The determining the head movement type according to the current movement state includes: If the current action state is the second half of the target action and the previous action state is the first half of the target action, determining that the head action type is the type corresponding to the target action; And / or, if the action state at the current moment is a continuous action state of the target action, then the head action type is determined to be a type corresponding to the target action.
13. The method according to claim 4, characterized in that After determining the current action direction, the method further includes: If the current action direction is not any direction corresponding to the nodding action and the shaking action, then determining that the current action state is a release state; In response to the current action state being the release state, the action direction and action state will be re-identified starting from the current time.
14. The method according to claim 13, characterized in that The determining the head movement type according to the current movement state includes: In response to the current action state being changed to the release state, starting timing; If the timing duration reaches a preset duration, the head movement type is determined according to the previous movement state and the current movement state.
15. The method according to claim 4, characterized in that After determining that the current action state is a release state, the method further includes: Obtaining absolute values of a preset number of third sampling values of the gyroscope in the Y-axis direction; Calculating the standard deviation of the absolute values of the preset number of third sampling values to obtain a target parameter; Calculating a target threshold value according to the target parameter, a pre-acquired Y-axis threshold value and a preset threshold value update formula; Using the target threshold as a new Y-axis threshold; If the target threshold satisfies the preset threshold change requirement, the preset maximum threshold or the preset minimum threshold is adjusted based on a preset scaling relationship.
16. A head action recognition device, characterized in that: Applied to a head-mounted device, the head-mounted device includes a gyroscope; the head action recognition device includes: A sampling module, used to obtain sampling values of the gyroscope; the sampling values include a first sampling value at a previous moment and a first sampling value at a current moment in the X-axis direction, and a second sampling value at a previous moment and a second sampling value at a current moment in the Z-axis direction; A direction identification module, used to compare the first sampling value at the previous moment, the first sampling value at the current moment, the second sampling value at the previous moment and the second sampling value at the current moment, to determine the action direction at the current moment; A state recognition module, used to determine the current action state based on the current action direction and the previous action state acquired in advance; The action determination module is used to determine the head action type according to the current action state.
17. A readable storage medium, characterized in that: The readable storage medium stores a program, and when the program runs on a processor, the processor executes the head action recognition method as described in any one of claims 1-15.
18. A head mounted device, characterized in that: include: A gyroscope; a processor connected to the gyroscope, and used to execute the head movement recognition method as described in any one of claims 1-15.