Control method and electronic device
A control method and an electronic device are provided. The electronic device generates vibration when performing at least one function. The electronic device includes an acceleration sensor and a feedback circuit. The acceleration sensor is configured to output acceleration data, and the feedback circuit is configured to collect and feed back data related to the vibration. The electronic device obtains, based on a variation of a magnitude of the obtained acceleration data and interference data, a variation obtained after data processing, and performs action recognition. The electronic device performs a corresponding function based on a recognition result, or controls a second electronic device to perform a corresponding function.
1 . A control method, applied to a first electronic device, wherein the first electronic device generates a vibration when performing at least one function, the first electronic device comprises an acceleration sensor and a feedback circuit, the acceleration sensor is configured to output acceleration data related to one or more vibrations of the first electronic device, the feedback circuit is configured to collect and feed back data related to the at least one function, and the method comprises:
obtaining, by the first electronic device, a variation of a magnitude of the acceleration data and interference data based on the acceleration data and the feed back data related to the least one function, the interference data being related to the at least one function;
obtaining, by the first electronic device based on the variation of the magnitude of the acceleration data and the interference data, a variation obtained after data processing;
performing, by the first electronic device in response to a prerequisite that the variation obtained after data processing meets a preset condition, action recognition based on the variation obtained after data processing; and
performing, by the first electronic device, a corresponding function based on a recognition result;
or controlling, by the first electronic device based on a recognition result, a second electronic device to perform a corresponding function,
wherein the preset condition comprises at least one of:
at a moment t, a first variation, that is of a magnitude of an acceleration of the first electronic device on an XOY plane of a preset coordinate system and that is obtained after the first electronic device performs data processing, is greater than a first preset threshold; or
at a moment t, a second variation, that is of a magnitude of an acceleration of the first electronic device on a Z-axis of a preset coordinate system and that is obtained after the first electronic device performs data processing, is greater than a second preset threshold; wherein
the moment t is a moment that meets a preset requirement after a timing start point starts.
2 . The method of claim 1 , wherein that the first electronic device obtains the variation of the magnitude of the acceleration data and the interference data is performed in response to receiving an input by the first electronic device, or in response to performing the at least one function by the first electronic device.
3 . The method of claim 1 , wherein the at least one function comprises an audio play function, and the data related to the at least one function comprise audio data.
4 . The method of claim 3 , wherein the audio data are obtained based on audio energy in a period of time.
5 . The method of claim 1 , wherein
the moment t that meets the preset requirement is greater than or equal to t1, wherein t1 is a corresponding moment at which M is equal to preset M1, M is a quantity of pieces of acceleration data that are output by the acceleration sensor starting from the timing start point, and one piece of the acceleration data may be represented as [a x , a y , a z ] (t) ; and
the timing start point is a moment at which the first electronic device is powered on.
6 . A first electronic device, comprising:
a feedback circuit configured to collect and feed back data related to at least one function of the first electronic device;
an acceleration sensor configured to output acceleration data related to one or more vibrations of the first electronic device, the one or more vibrations including a vibration generated by the at least one function when running the at least one function;
one or more processor; and
a memory storing a computer program that, when executed by the one or more processor, cause the first electronic device to perform the operations:
obtaining a variation of a magnitude of the acceleration data and interference data based on the acceleration data and the feed back data related to at least one function, the interference data being related to the at least one function;
obtaining based on the variation of the magnitude of the acceleration data and the interference data, a variation obtained after data processing;
performing action recognition based on the variation obtained after data processing in response to a prerequisite that the variation obtained after data processing meets a preset condition; and
performing a corresponding function based on a recognition result; or controlling, based on a recognition result, a second electronic device to perform a corresponding function,
wherein the preset condition comprises at least one of:
at a moment t, a first variation, that is of a magnitude of an acceleration of the first electronic device on an XOY plane of a preset coordinate system and that is obtained after the first electronic device performs data processing, is greater than a first preset threshold; or
at a moment t, a second variation, that is of a magnitude of an acceleration of the first electronic device on a Z-axis of a preset coordinate system and that is obtained after the first electronic device performs data processing, is greater than a second preset threshold; wherein
the moment t is a moment that meets a preset requirement after a timing start point starts.
7 . The first electronic device of claim 6 , wherein the variation of the magnitude of the acceleration data and the interference data are obtained in response to receiving an input by the first electronic device, or in response to performing the at least one function by the first electronic device.
8 . The first electronic device of claim 6 , wherein the at least one function comprises an audio play function, and the data related to the at least one function comprise audio data.
9 . The first electronic device of claim 8 , wherein the audio data are obtained based on audio energy in a period of time.
10 . The first electronic device of claim 6 , wherein
the moment t that meets the preset requirement is greater than or equal to t1, wherein t1 is a corresponding moment at which M is equal to preset M1, M is a quantity of pieces of acceleration data that are output by the acceleration sensor starting from the timing start point, and one piece of the acceleration data may be represented as [a x , a y , a z ] (t) ; and
the timing start point is a moment at which the first electronic device is powered on.
11 . A non-transitory computer-readable storage medium, wherein the computer-readable storage medium comprises a computer program, and when the computer program is run on a first electronic device, the first electronic device comprises a feedback circuit and an acceleration sensor, the feedback circuit is configured to collect and feed back data related to the at least one function, the acceleration sensor is configured to output acceleration data related to one or more vibrations of the first electronic device, the one or more vibration including a vibration generated by the at least one function, the first electronic device to perform the operations:
obtaining a variation of a magnitude of the acceleration data and interference data based on the acceleration data and the feed back data related to at least one function, the interference data being related to the at least one function;
obtaining based on the variation of the magnitude of the acceleration data and the interference data, a variation obtained after data processing;
performing action recognition based on the variation obtained after data processing in response to a prerequisite that the variation obtained after data processing meets a preset condition; and
performing a corresponding function based on a recognition result; or controlling, based on a recognition result, a second electronic device to perform a corresponding function,
wherein the preset condition comprises at least one of:
at a moment t, a first variation, that is of a magnitude of an acceleration of the first electronic device on an XOY plane of a preset coordinate system and that is obtained after the first electronic device performs data processing, is greater than a first preset threshold; or
at a moment t, a second variation, that is of a magnitude of an acceleration of the first electronic device on a Z-axis of a preset coordinate system and that is obtained after the first electronic device performs data processing, is greater than a second preset threshold; wherein
the moment t is a moment that meets a preset requirement after a timing start point starts.
12 . The non-transitory computer-readable storage medium of claim 11 , wherein the variation of the magnitude of the acceleration data and the interference data are obtained in response to receiving an input by the first electronic device, or in response to performing the at least one function by the first electronic device.
13 . The non-transitory computer-readable storage medium of claim 11 , wherein the at least one function comprises an audio play function, and the data related to the at least one function comprise audio data.
14 . The non-transitory computer-readable storage medium of claim 13 , wherein the audio data are obtained based on audio energy in a period of time.