Sensor abnormality determination method, device, mobile terminal and storage medium
The method and device for determining sensor abnormality in mobile terminals improve user experience by identifying and correcting sensor inconsistencies using gyroscopes and accelerometers, ensuring accurate status information and preventing software abnormalities.
Patent Information
- Application Number
- CN202010520252.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-09
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2040-06-09
AI Technical Summary
Mobile terminals with abnormal gyroscopes or accelerometers produce inaccurate status information, leading to abnormal software behaviors and poor user experience.
A method and device for determining sensor abnormality by obtaining status information from both gyroscopes and accelerometers, calculating a focus value when inconsistencies are detected, and using this value to determine which sensor is abnormal, thereby preventing software abnormalities and improving user experience.
Effectively prevents abnormal software behaviors by identifying and addressing sensor issues, ensuring accurate status information determination and enhancing user experience.
Smart Images

Figure CN111752738B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of mobile terminals, and more specifically, to a method and device for determining abnormality of a sensor, a mobile terminal, and a storage medium. Background Art
[0002] With the development of science and technology, mobile terminals are used more and more widely and have more and more functions. They have become one of the necessities in people's daily life. At present, mobile terminals generally include acceleration sensors and gyroscope sensors, and detect the status information of mobile terminals through acceleration sensors and gyroscope sensors. However, when the acceleration sensor or gyroscope sensor is abnormal, the detection of the status information of the mobile terminal will be inaccurate, which will lead to some abnormal behaviors of the software and poor user experience. Summary of the invention
[0003] In view of the above problems, the present application proposes a sensor abnormality determination method, device, mobile terminal and storage medium to solve the above problems.
[0004] In a first aspect, an embodiment of the present application provides a method for determining an abnormality of a sensor, which is applied to a mobile terminal, wherein the mobile terminal includes a gyroscope sensor and an acceleration sensor, and the method includes: obtaining status information of the mobile terminal as first status information based on the gyroscope sensor, and obtaining status information of the mobile terminal as second status information based on the acceleration sensor; when the first status information and the second status information are inconsistent, obtaining a focus value of the mobile terminal; obtaining status information of the mobile terminal as third status information based on the focus value; and determining an abnormal sensor from the gyroscope sensor and the acceleration sensor based on the first status information, the second status information, and the third status information.
[0005] In a second aspect, an embodiment of the present application provides a sensor abnormality determination device, which is applied to a mobile terminal, wherein the mobile terminal includes a gyroscope sensor and an acceleration sensor, and the device includes: a first status information acquisition module, used to acquire status information of the mobile terminal based on the gyroscope sensor as first status information, and to acquire status information of the mobile terminal based on the acceleration sensor as second status information; a focus value acquisition module, used to acquire a focus value of the mobile terminal when the first status information and the second status information are inconsistent; a second status information acquisition module, used to acquire status information of the mobile terminal based on the focus value as third status information; a sensor abnormality determination module, used to determine an abnormal sensor from the gyroscope sensor and the acceleration sensor based on the first status information, the second status information and the third status information.
[0006] In a third aspect, an embodiment of the present application provides a mobile terminal, comprising a memory and a processor, wherein the memory is coupled to the processor, the memory stores instructions, and when the instructions are executed by the processor, the processor executes the above method.
[0007] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a program code is stored, and the program code can be called by a processor to execute the above method.
[0008] The sensor abnormality determination method, device, mobile terminal and storage medium provided in the embodiments of the present application obtain status information of the mobile terminal as first status information based on the gyroscope sensor, and obtain status information of the mobile terminal as second status information based on the acceleration sensor. When the first status information and the second status information are inconsistent, the focus value of the mobile terminal is obtained, and the status information of the mobile terminal is obtained as third status information based on the focus value. Based on the first status information, the second status information and the third status information, an abnormal sensor is determined from the gyroscope sensor and the acceleration sensor, so as to participate in the status information determination of the mobile terminal by obtaining the focus value of the mobile terminal, and the abnormal sensor is determined from the gyroscope sensor and the acceleration sensor, thereby effectively preventing abnormal software behavior caused by sensor abnormality and improving user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0010] Figure 1 A schematic diagram showing a flow chart of a method for determining an abnormality of a sensor provided by an embodiment of the present application;
[0011] Figure 2 A schematic diagram showing a flow chart of a method for determining an abnormality of a sensor provided by yet another embodiment of the present application;
[0012] Figure 3 A schematic diagram showing a flow chart of a method for determining an abnormality of a sensor provided in yet another embodiment of the present application;
[0013] Figure 4 A schematic diagram showing a flow chart of a method for determining an abnormality of a sensor provided by another embodiment of the present application is shown;
[0014] Figure 5 This application shows Figure 4A schematic flow chart of a method for determining an abnormality of a sensor shown;
[0015] Figure 6 A schematic diagram showing a flow chart of a method for determining an abnormality of a sensor provided by yet another embodiment of the present application;
[0016] Figure 7 A module block diagram of a sensor abnormality determination device provided in an embodiment of the present application is shown;
[0017] Figure 8 A block diagram of a mobile terminal according to an embodiment of the present application for executing a method for determining an abnormality of a sensor according to an embodiment of the present application is shown;
[0018] Fig. 9 A storage unit for storing or carrying a program code for implementing a method for determining an abnormality of a sensor according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0019] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0020] At present, most mobile terminals on the market are equipped with gyro sensors and accelerometers, and mobile terminals rely on gyro sensors and accelerometers to detect and judge the motion state of the mobile terminal. The gyro sensor is also called the angular velocity sensor Gyro Sensor, which is used to detect the angular acceleration of the mobile terminal's X, Y, and Z axes, and the accelerometer G-sensor is used to detect the acceleration of the mobile terminal's X, Y, and Z axes. However, once a problem occurs in one of the gyro sensor and the accelerometer, the mobile terminal will make errors in detecting its own motion state, which will cause some abnormal behaviors of the software, such as not focusing all the time, or not listening to repeated focusing, etc.
[0021] In view of the above problems, the inventors have discovered after long-term research and proposed the sensor abnormality determination method, device, mobile terminal and storage medium provided in the embodiments of the present application, which can effectively prevent software abnormal behavior caused by sensor abnormality and improve user experience by obtaining the focus value of the mobile terminal to participate in the determination of the status information of the mobile terminal and determining the abnormal sensor from the gyroscope sensor and the acceleration sensor. The specific sensor abnormality determination method is described in detail in the subsequent embodiments.
[0022] See also Figure 1 , Figure 1The flowchart of a sensor abnormality determination method provided by an embodiment of the present application is shown. The sensor abnormality determination method is used to participate in determining the state information of the mobile terminal by obtaining the focus value of the mobile terminal, and to determine the abnormal sensor from the gyroscope sensor and the acceleration sensor, thereby effectively preventing software abnormal behavior caused by sensor abnormality and improving user experience. In a specific embodiment, the sensor abnormality determination method is applied to Figure 7 The sensor abnormality determination device 200 and the mobile terminal 100 ( Figure 8 ). The following will take a mobile terminal as an example to illustrate the specific process of this embodiment. Of course, it can be understood that the mobile terminal used in this embodiment can be a smart phone, a tablet computer, a wearable electronic device, etc., which is not limited here. Figure 1 The process shown is described in detail, wherein, in this embodiment, the mobile terminal includes a gyroscope sensor and an acceleration sensor, and the sensor abnormality determination method may specifically include the following steps:
[0023] Step S110: acquiring the state information of the mobile terminal based on the gyro sensor as the first state information, and acquiring the state information of the mobile terminal based on the acceleration sensor as the second state information.
[0024] In this embodiment, the mobile terminal is provided with a gyro sensor and an acceleration sensor.
[0025] In some embodiments, when detecting the status information of the mobile terminal, the detection can be performed through a gyroscope sensor and an acceleration sensor. For example, the gyroscope sensor and the acceleration sensor can be used to detect whether the status information of the mobile terminal is in a stable state (stationary state), and the gyroscope sensor and the acceleration sensor can be used to detect whether the status information of the mobile terminal is in an unstable state (moving state), etc., which is not limited here.
[0026] In some embodiments, when the state information of the mobile terminal is detected by the gyroscope sensor, the state information of the mobile terminal can be obtained based on the gyroscope sensor as the first state information, wherein the angular acceleration of the mobile terminal in the three directions of X, Y, and Z can be obtained based on the gyroscope sensor, and the state information of the mobile terminal is obtained as the first state information based on the angular acceleration of the mobile terminal in the three directions of X, Y, and Z. At the same time, when the state information of the mobile terminal is detected by the acceleration sensor, the state information of the mobile terminal can be obtained based on the acceleration sensor as the second state information, wherein the acceleration of the mobile terminal in the three directions of X, Y, and Z can be obtained based on the acceleration sensor, and the state information of the mobile terminal is obtained as the second state information based on the acceleration of the mobile terminal in the three directions of X, Y, and Z.
[0027] Taking the gyro sensor as an example, based on the axial fixity of the gyro sensor and the known preset posture of the mobile terminal relative to the rotation axis direction of the gyro sensor, when there is a difference between the posture of the mobile terminal and the preset posture, and a movement in a certain direction of pitch, yaw or roll occurs, because the rotation axis of the gyro remains unchanged, it is detected that the angular relationship of the mobile terminal rod relative to the rotation axis and the angular relationship of the preset posture relative to the rotation axis have changed, then the posture change of the mobile terminal can be determined, and thus the state information (stable state, unstable state) of the mobile terminal can be determined.
[0028] Step S120: When the first state information and the second state information are inconsistent, obtaining a focus value of the mobile terminal.
[0029] In this embodiment, after obtaining the first state information and the second state information, the first state information and the second state information can be compared to determine whether the first state information and the second state information are consistent. Among them, when the first state information represents that the state information of the mobile terminal is a stable state, and the second state information represents that the state information of the mobile terminal is a stable state, it can be determined that the first state information and the second state information are consistent; when the first state information represents that the state information of the mobile terminal is a stable state, and the second state information represents that the state information of the mobile terminal is an unstable state, it can be determined that the first state information and the second state information are inconsistent; when the first state information represents that the state information of the mobile terminal is an unstable state, and the second state information represents that the state information of the mobile terminal is an unstable state, it can be determined that the first state information and the second state information are consistent; when the first state information represents that the state information of the mobile terminal is an unstable state, and the second state information represents that the state information of the mobile terminal is a stable state, it can be determined that the first state information and the second state information are inconsistent, etc., which are not limited here.
[0030] In some embodiments, when it is determined that the first state information and the second state information are inconsistent, it is characterized that the determination of the state information of the mobile terminal by the gyroscope sensor is different from the determination of the state information of the mobile terminal by the acceleration sensor, that is, there is an erroneous state information in the first state information of the mobile terminal determined by the gyroscope sensor and the second state information of the mobile terminal determined by the acceleration sensor. Therefore, the focus value of the mobile terminal can be obtained, and the focus value is used to participate in the determination of the state information of the mobile terminal. Among them, the focus value is the FV value (Focus Value), which is a value positively correlated with the image clarity. As long as the image is not moving, the focus value will be very stable. When the image is moving, the focus value will fluctuate greatly. That is, the focus value is a data completely based on image science, and the data is reliable. Therefore, when the first state information and the second state information are inconsistent, the focus value of the mobile terminal can be obtained to participate in the determination of the state information of the mobile terminal.
[0031] Step S130: acquiring the state information of the mobile terminal based on the focus value as third state information.
[0032] In this embodiment, after the focus value of the mobile terminal is obtained, the state information of the mobile terminal can be obtained based on the focus value as the third state information. In some implementations, when the image corresponding to the focus value of the mobile terminal is prohibited from being stationary, the state information of the mobile terminal can be obtained based on the focus value as a stable state, and the stable state is used as the third state information; when the image corresponding to the focus value of the mobile terminal is moving, the state information of the mobile terminal can be obtained based on the focus value as an unstable state, and the unstable state is used as the third state information.
[0033] Step S140: determining an abnormal sensor from among the gyro sensor and the acceleration sensor based on the first state information, the second state information, and the third state information.
[0034] In this embodiment, after obtaining the first state information, the second state information, and the third state information, the abnormal sensor can be determined from the gyroscope sensor and the acceleration sensor based on the first state information, the second state information, and the third state information, that is, the gyroscope sensor can be determined as the abnormal sensor, or the acceleration sensor can be determined as the abnormal sensor.
[0035] In some embodiments, after obtaining the first state information, the second state information, and the third state information, the first state information and the third state information may be compared to determine whether the first state information and the third state information are consistent, and the second state information and the third state information may be compared to determine whether the second state information and the third state information are consistent. When the first state information and the third state information are consistent, and the second state information and the third state information are inconsistent, it indicates that the first state information is accurate, while the second state information is inaccurate, that is, it can be determined that the gyroscope sensor is normal, while the acceleration sensor is abnormal; when the second state information and the third state information are consistent, and the first state information and the third state information are inconsistent, it indicates that the second state information is accurate, while the first state information is inaccurate, that is, it can be determined that the gyroscope sensor is abnormal, while the acceleration sensor is normal.
[0036] In some embodiments, after determining the abnormal sensor from the gyro sensor and the acceleration sensor, a prompt message may be generated and output, and the prompt message is used to indicate that the sensor is abnormal, thereby prompting the user to repair the sensor so as to restore the normal detection function of the sensor as soon as possible. For example, when it is determined that the abnormal sensor from the gyro sensor and the acceleration sensor is the gyro sensor, a prompt message of gyro sensor abnormality may be generated and output to indicate that the gyro sensor is abnormal, thereby prompting the user to repair the gyro sensor so as to restore the normal detection function of the gyro sensor as soon as possible; when it is determined that the abnormal sensor from the gyro sensor and the acceleration sensor is the acceleration sensor, a prompt message of acceleration sensor abnormality may be generated and output to indicate that the acceleration sensor is abnormal, thereby prompting the user to repair the acceleration sensor so as to restore the normal detection function of the acceleration sensor as soon as possible.
[0037] A sensor abnormality determination method provided by an embodiment of the present application obtains status information of a mobile terminal as first status information based on a gyroscope sensor, and obtains status information of the mobile terminal as second status information based on an acceleration sensor. When the first status information and the second status information are inconsistent, a focus value of the mobile terminal is obtained, and the status information of the mobile terminal is obtained as third status information based on the focus value. Based on the first status information, the second status information and the third status information, an abnormal sensor is determined from the gyroscope sensor and the acceleration sensor, so as to participate in the status information determination of the mobile terminal by obtaining the focus value of the mobile terminal, and the abnormal sensor is determined from the gyroscope sensor and the acceleration sensor, thereby effectively preventing abnormal software behavior caused by sensor abnormality and improving user experience.
[0038] See also Figure 2 , Figure 2A schematic diagram of a flow chart of a sensor abnormality determination method provided by another embodiment of the present application is shown. The method is applied to the above-mentioned mobile terminal, which includes a gyroscope sensor and an acceleration sensor. Figure 2 The process shown in the figure is described in detail, and the method for determining the abnormality of the sensor may specifically include the following steps:
[0039] Step S210: acquiring the state information of the mobile terminal based on the gyro sensor as the first state information, and acquiring the state information of the mobile terminal based on the acceleration sensor as the second state information.
[0040] Step S220: When the first state information and the second state information are inconsistent, obtaining a focus value of the mobile terminal.
[0041] Step S230: Acquire the state information of the mobile terminal as third state information based on the focus value.
[0042] For the detailed description of step S210 to step S230 , please refer to step S110 to step S130 , which will not be repeated here.
[0043] Step S240: When the first state information and the third state information are consistent, determining that the abnormal sensor among the gyro sensor and the acceleration sensor is the acceleration sensor.
[0044] In this embodiment, after obtaining the first state information, the second state information and the third state information, the first state information and the third state information can be compared to determine whether the first state information and the third state information are consistent. When the first state information and the third state information are consistent, it can be determined that the second state information and the third state information are inconsistent, that is, it can be determined that the second state information is wrong, and the acceleration sensor corresponding to the second state information is an abnormal sensor.
[0045] For example, the first state information and the third state information both indicate that the mobile terminal is in a stable state, while the second state information indicates that the mobile terminal is in an unstable state; or, the first state information and the third state information both indicate that the mobile terminal is in an unstable state, while the second state information indicates that the mobile terminal is in a stable state. In this case, it can be determined that the first state information is consistent with the third state information, and the second state information is inconsistent with the third state information. Therefore, it can be determined that the second state information is wrong, and the acceleration sensor corresponding to the second state information is an abnormal sensor.
[0046] Step S250: when the second state information is consistent with the third state information, determining that the abnormal sensor among the gyro sensor and the acceleration sensor is the gyro sensor.
[0047] In this embodiment, after obtaining the first state information, the second state information and the third state information, the second state information and the third state information can be compared to determine whether the second state information and the third state information are consistent. When the second state information and the third state information are consistent, it can be determined that the first state information and the third state information are inconsistent, that is, it can be determined that the first state information is wrong, and the gyroscope sensor corresponding to the first state information is an abnormal sensor.
[0048] For example, the second state information and the third state information both indicate that the mobile terminal is in a stable state, while the first state information indicates that the mobile terminal is in an unstable state; or, the second state information and the third state information both indicate that the mobile terminal is in an unstable state, while the first state information indicates that the mobile terminal is in a stable state. In this case, it can be determined that the second state information is consistent with the third state information, and the first state information is inconsistent with the third state information. Therefore, it can be determined that the first state information is wrong, and the gyroscope sensor corresponding to the second state information is an abnormal sensor.
[0049] Another embodiment of the present application provides a method for determining sensor abnormality, which obtains the status information of the mobile terminal as the first status information based on the gyroscope sensor, and obtains the status information of the mobile terminal as the second status information based on the acceleration sensor. When the first status information and the second status information are inconsistent, the focus value of the mobile terminal is obtained, and the status information of the mobile terminal is obtained as the third status information based on the focus value. When the first status information and the third status information are consistent, the abnormal sensor is determined to be the acceleration sensor from the gyroscope sensor and the acceleration sensor. When the second status information and the third status information are consistent, the abnormal sensor is determined to be the gyroscope sensor from the gyroscope sensor and the acceleration sensor. Compared with Figure 1 The sensor abnormality determination method shown in the figure, this embodiment further determines the abnormal sensor according to the consistency of the first state information and the second state information with the third state information, thereby improving the accuracy of determining the abnormal sensor.
[0050] See also Figure 3 , Figure 3 A schematic diagram of a method for determining an abnormality of a sensor provided by another embodiment of the present application is shown. The method is applied to the above-mentioned mobile terminal, which includes a gyroscope sensor and an acceleration sensor. Figure 3 The process shown in the figure is described in detail, and the method for determining the abnormality of the sensor may specifically include the following steps:
[0051] Step S310: acquiring the state information of the mobile terminal based on the gyro sensor as the first state information, and acquiring the state information of the mobile terminal based on the acceleration sensor as the second state information.
[0052] Step S320: When the first state information and the second state information are inconsistent, obtaining a focus value of the mobile terminal.
[0053] Step S330: Acquire the state information of the mobile terminal as third state information based on the focus value.
[0054] Step S340: determining an abnormal sensor from among the gyro sensor and the acceleration sensor based on the first state information, the second state information, and the third state information.
[0055] For the detailed description of step S310 to step S340, please refer to step S110 to step S140, which will not be repeated here.
[0056] Step S350: When it is determined that the abnormal sensor is an acceleration sensor, the acceleration sensor is marked as unavailable, and the first state information is determined as the current state information of the mobile terminal.
[0057] In this embodiment, when it is determined that the abnormal sensor is an acceleration sensor, the acceleration sensor may be marked as unavailable, and the first state information obtained through the gyroscope sensor may be determined as the current state information of the mobile terminal. That is, after it is determined that the abnormal sensor is an acceleration sensor, in the process of obtaining the state information of the mobile terminal, the state information of the mobile terminal may no longer be obtained through the acceleration sensor, or the state information of the mobile terminal obtained through the acceleration sensor may be marked as unavailable, and the state information of the mobile terminal may only be obtained through the gyroscope sensor as the current state information of the mobile terminal, so as to improve the accuracy of the obtained state information of the mobile terminal.
[0058] In some implementations, when it is determined that the abnormal sensor is an acceleration sensor, the acceleration sensor may be marked as unavailable, and a first Flag may be generated and reported, where the first Flag is used to indicate that the acceleration sensor is unavailable.
[0059] Step S360: When it is determined that the abnormal sensor is a gyroscope sensor, the gyroscope sensor is marked as unavailable, and the second state information is determined as the current state information of the mobile terminal.
[0060] In this embodiment, when it is determined that the abnormal sensor is a gyroscope sensor, the gyroscope sensor may be marked as unavailable, and the second state information obtained through the acceleration sensor may be determined as the current state information of the mobile terminal. That is, after it is determined that the abnormal sensor is a gyroscope sensor, in the process of obtaining the state information of the mobile terminal, the state information of the mobile terminal may no longer be obtained through the gyroscope sensor, or the state information of the mobile terminal obtained through the gyroscope sensor may be marked as unavailable, and the state information of the mobile terminal may only be obtained through the acceleration sensor as the current state information of the mobile terminal, so as to improve the accuracy of the obtained state information of the mobile terminal.
[0061] In some implementations, when it is determined that the abnormal sensor is a gyroscope sensor, the gyroscope sensor may be marked as unavailable, and a second Flag may be generated and reported, where the second Flag is used to indicate that the gyroscope sensor is unavailable.
[0062] Another embodiment of the present application provides a method for determining sensor abnormality, which obtains status information of a mobile terminal as first status information based on a gyroscope sensor, and obtains status information of the mobile terminal as second status information based on an acceleration sensor. When the first status information and the second status information are inconsistent, the focus value of the mobile terminal is obtained, and the status information of the mobile terminal is obtained as third status information based on the focus value. Based on the first status information, the second status information and the third status information, an abnormal sensor is determined from the gyroscope sensor and the acceleration sensor. When the abnormal sensor is determined to be an acceleration sensor, the acceleration sensor is marked as unavailable, and the first status information is determined as the current status information of the mobile terminal. When the abnormal sensor is determined to be a gyroscope sensor, the gyroscope sensor is marked as unavailable, and the second status information is determined as the current status information of the mobile terminal. Compared to Figure 1 The sensor abnormality determination method shown in the embodiment also marks the abnormal sensor as unavailable, and determines the current state information of the mobile terminal based on the normal sensor, thereby improving the accuracy of determining the current state information of the mobile terminal.
[0063] See also Figure 4 , Figure 4 A schematic diagram of a method for determining an abnormality of a sensor provided by another embodiment of the present application is shown. The method is applied to the above-mentioned mobile terminal, which includes a gyroscope sensor and an acceleration sensor. Figure 4 The process shown in the figure is described in detail, and the method for determining the abnormality of the sensor may specifically include the following steps:
[0064] Step S410: acquiring the state information of the mobile terminal based on the gyro sensor as the first state information, and acquiring the state information of the mobile terminal based on the acceleration sensor as the second state information.
[0065] For the detailed description of step S410, please refer to step S110, which will not be repeated here.
[0066] Step S420: When the first state information and the second state information are inconsistent, continuously acquiring multiple focus values of the mobile terminal within a specified time period.
[0067] In some embodiments, when it is determined that the first state information and the second state information are inconsistent, it indicates that the determination of the state information of the mobile terminal by the gyroscope sensor is different from the determination of the state information of the mobile terminal by the acceleration sensor, that is, there is an erroneous state information in the first state information of the mobile terminal determined by the gyroscope sensor and the second state information of the mobile terminal determined by the acceleration sensor. Therefore, multiple focus values of the mobile terminal can be continuously obtained within a specified time, and the multiple focus values are used to participate in the determination of the state information of the mobile terminal. In some embodiments, the specified time period can be pre-set and stored in the mobile terminal, or it can be temporarily determined when multiple focus values need to be obtained, which is not limited here.
[0068] Step S430: Acquire the state information of the mobile terminal as the third state information based on the multiple focus values.
[0069] In this embodiment, after obtaining multiple focus values of the mobile terminal within a specified time period, the state information of the mobile terminal can be obtained based on the multiple focus values as the third state information. In some implementations, when the images corresponding to the multiple focus values of the mobile terminal are prohibited from being stationary, the state information of the mobile terminal can be obtained based on the multiple focus values as a stable state, and the stable state is used as the third state information; when the images corresponding to the multiple focus values of the mobile terminal are moving, the state information of the mobile terminal can be obtained based on the multiple focus values as an unstable state, and the unstable state is used as the third state information.
[0070] See also Figure 5 , Figure 5 This application shows Figure 4 The following is a flow chart of the method for determining an abnormality of a sensor. Figure 5 The process shown is described in detail, and the method may specifically include the following steps:
[0071] Step S431: Obtain the difference between the maximum value and the minimum value of the multiple focus values within the specified time period.
[0072] In this embodiment, after obtaining multiple focus values of the mobile terminal within a specified time period, a maximum value (maximum focus value) and a minimum value (minimum focus value) can be obtained from the multiple focus values, and the difference between the maximum value and the minimum value can be calculated. In some implementations, after obtaining multiple focus values of the mobile terminal within a specified time period, the multiple focus values can be compared to obtain a comparison result, and the maximum value and the minimum value can be obtained from the multiple focus values according to the comparison result, and the difference between the maximum value and the minimum value can be calculated.
[0073] Step S432: When the difference is greater than a specified difference, determining that the state information of the mobile terminal is an unstable state, and using the unstable state as the third state information.
[0074] In some embodiments, the specified difference value can be pre-set and stored in the mobile terminal, or it can be temporarily determined when the difference judgment is performed, which is not limited here. The specified difference value is used as a basis for judging the difference between the maximum value and the minimum value. Therefore, in this embodiment, after obtaining the difference between the maximum value and the minimum value, the difference value can be compared with the specified difference value to determine whether the difference value is greater than the specified difference value. When the judgment result indicates that the difference value is greater than the specified difference value, it indicates that the image has a large shake within a specified time period, and the state information of the mobile terminal can be determined to be an unstable state, and the unstable state is used as the third state information.
[0075] Step S433: When the difference is not greater than the specified difference, determine that the state information of the mobile terminal is a stable state, and use the stable state as the third state information.
[0076] When the judgment result indicates that the difference is not greater than the specified difference, it indicates that the image does not shake significantly within the specified time period, and the state information of the mobile terminal can be determined to be a stable state, and the stable state is used as the third state information.
[0077] Step S440: determining an abnormal sensor from among the gyro sensor and the acceleration sensor based on the first state information, the second state information, and the third state information.
[0078] For the detailed description of step S440, please refer to step S140, which will not be repeated here.
[0079] Another embodiment of the present application provides a method for determining sensor abnormality, which obtains the status information of the mobile terminal as the first status information based on the gyroscope sensor, and obtains the status information of the mobile terminal as the second status information based on the acceleration sensor. When the first status information and the second status information are inconsistent, multiple focus values of the mobile terminal are continuously obtained within a specified time period, and the status information of the mobile terminal is obtained as the third status information based on the multiple focus values. Based on the first status information, the second status information and the third status information, the abnormal sensor is determined from the gyroscope sensor and the acceleration sensor. Compared with Figure 1 The sensor abnormality determination method shown in the present embodiment also continuously obtains multiple focus values within a specified time period, and obtains the status information of the mobile terminal based on the changes in the multiple focus values, so as to improve the accuracy of obtaining the status information of the mobile terminal through the focus values.
[0080] See also Figure 6 , Figure 6 A schematic diagram of a method for determining an abnormality of a sensor provided by another embodiment of the present application is shown. The method is applied to the above-mentioned mobile terminal, which includes a gyroscope sensor and an acceleration sensor. Figure 6 The process shown in the figure is described in detail, and the method for determining the abnormality of the sensor may specifically include the following steps:
[0081] Step S510: acquiring the state information of the mobile terminal based on the gyro sensor as the first state information, and acquiring the state information of the mobile terminal based on the acceleration sensor as the second state information.
[0082] For the detailed description of representation S510 , please refer to step S110 , which will not be repeated here.
[0083] Step S520: When the first state information and the second state information are inconsistent, obtaining the state information of the mobile terminal based on the gyro sensor as fourth state information, and obtaining the state information of the mobile terminal based on the acceleration sensor as fifth state information.
[0084] In some embodiments, when the first state information and the second state information are inconsistent, the state information of the mobile terminal can be obtained based on the gyroscope sensor as the fourth state information, and the state information of the mobile terminal can be obtained based on the acceleration sensor as the fifth state information, and the consistency of the fourth state information and the fifth state information can be re-judged to reduce the probability of misjudgment.
[0085] Step S530: When the fourth state information and the fifth state information are inconsistent, obtaining a focus value of the mobile terminal.
[0086] In this embodiment, after obtaining the fourth state information and the fifth state information, the fourth state information and the fifth state information can be compared to determine whether the fourth state information and the fifth state information are consistent. Among them, when the fourth state information represents that the state information of the mobile terminal is in a stable state, and the fifth state information represents that the state information of the mobile terminal is in a stable state, it can be determined that the fourth state information and the fifth state information are consistent; when the fourth state information represents that the state information of the mobile terminal is in a stable state, and the fifth state information represents that the state information of the mobile terminal is in an unstable state, it can be determined that the fourth state information and the fifth state information are inconsistent; when the fourth state information represents that the state information of the mobile terminal is in an unstable state, and the fifth state information represents that the state information of the mobile terminal is in an unstable state, it can be determined that the fourth state information and the fifth state information are consistent; when the fourth state information represents that the state information of the mobile terminal is in an unstable state, and the fifth state information represents that the state information of the mobile terminal is in an unstable state, it can be determined that the fourth state information and the fifth state information are inconsistent, etc., which are not limited here.
[0087] In some implementations, when it is determined that the fourth state information and the fifth state information are inconsistent, indicating that the results after multiple verifications still indicate that one of the gyroscope sensor and the acceleration sensor is abnormal, the focus value of the mobile terminal can be obtained to determine the specific abnormal sensor.
[0088] Step S540: Acquire the state information of the mobile terminal as third state information based on the focus value.
[0089] Step S550: determining an abnormal sensor from among the gyro sensor and the acceleration sensor based on the first state information, the second state information, and the third state information.
[0090] For the detailed description of step S540 to step S550, please refer to step S130 to step S140, which will not be repeated here.
[0091] The present application provides a method for determining sensor abnormality in another embodiment, which obtains status information of a mobile terminal as first status information based on a gyro sensor, and obtains status information of the mobile terminal as second status information based on an acceleration sensor. When the first status information and the second status information are inconsistent, the status information of the mobile terminal is obtained as fourth status information based on the gyro sensor, and the status information of the mobile terminal is obtained as fifth status information based on the acceleration sensor. When the fourth status information and the fifth status information are inconsistent, the focus value of the mobile terminal is obtained, and the status information of the mobile terminal is obtained as third status information based on the focus value. Based on the first status information, the second status information and the third status information, an abnormal sensor is determined from the gyro sensor and the acceleration sensor. Compared to Figure 1 The sensor abnormality determination method shown in the embodiment further obtains the status information of the mobile terminal through the gyroscope sensor and the acceleration sensor respectively for verification when the first status information and the second status information are inconsistent, so as to reduce the probability of misjudgment.
[0092] See also Figure 7 , Figure 7 The module block diagram of the sensor abnormality determination device 200 provided in the embodiment of the present application is shown. The sensor abnormality determination device 200 is applied to the above mobile terminal. Figure 7 , wherein in this embodiment, the mobile terminal includes a gyroscope sensor and an acceleration sensor, and the sensor abnormality determination device 200 includes: a first state information acquisition module 210, a focus value acquisition module 220, a second state information acquisition module 230 and a sensor abnormality determination module 240, wherein:
[0093] The first state information acquisition module 210 is configured to acquire the state information of the mobile terminal based on the gyro sensor as the first state information, and acquire the state information of the mobile terminal based on the acceleration sensor as the second state information.
[0094] The focus value acquisition module 220 is used to acquire the focus value of the mobile terminal when the first state information and the second state information are inconsistent.
[0095] Furthermore, the focus value acquisition module 220 includes: a first focus value acquisition submodule, wherein:
[0096] The first focus value acquisition submodule is used to continuously acquire multiple focus values of the mobile terminal within a specified time period when the first state information and the second state information are inconsistent.
[0097] Furthermore, the focus value acquisition module 220 includes: a third state information acquisition submodule and a second focus value acquisition submodule, wherein:
[0098] a third state information acquisition submodule, configured to, when the first state information and the second state information are inconsistent, acquire the state information of the mobile terminal based on the gyroscope sensor as fourth state information, and acquire the state information of the mobile terminal based on the acceleration sensor as fifth state information;
[0099] The second focus value acquisition submodule is used to acquire the focus value of the mobile terminal when the fourth state information and the fifth state information are inconsistent.
[0100] The second state information acquisition module 230 is configured to acquire the state information of the mobile terminal based on the focus value as the third state information.
[0101] Furthermore, the second state information acquisition module 230 includes: a second state information acquisition submodule, wherein:
[0102] The second state information acquisition submodule is used to acquire the state information of the mobile terminal as the third state information based on the multiple focus values.
[0103] Furthermore, the second state information acquisition submodule includes: a difference acquisition unit, a first state information acquisition unit and a second state information acquisition unit, wherein:
[0104] The difference acquisition unit is used to acquire the difference between the maximum value and the minimum value of the multiple focus values within the specified time period.
[0105] The first state information acquiring unit is configured to determine that the state information of the mobile terminal is an unstable state when the difference is greater than a specified difference, and use the unstable state as the third state information.
[0106] The second state information acquiring unit is configured to determine that the state information of the mobile terminal is a stable state when the difference is not greater than a specified difference, and use the stable state as the third state information.
[0107] The sensor abnormality determination module 240 is configured to determine an abnormal sensor from among the gyro sensor and the acceleration sensor based on the first state information, the second state information, and the third state information.
[0108] Further, the sensor abnormality determination module 240 includes: a first sensor abnormality determination submodule and a second sensor abnormality determination submodule, wherein:
[0109] The first sensor abnormality determination submodule is used to determine that the abnormal sensor from among the gyro sensor and the acceleration sensor is the acceleration sensor when the first state information and the third state information are consistent.
[0110] The second sensor abnormality determination submodule is used to determine that the abnormal sensor from among the gyro sensor and the acceleration sensor is the gyro sensor when the second state information is consistent with the third state information.
[0111] Furthermore, the sensor abnormality determination device 200 further includes: a first current state information determination module and a second current state information determination module, wherein:
[0112] The first current state information determining module is used to mark the acceleration sensor as unavailable when it is determined that the abnormal sensor is an acceleration sensor, and to determine the first state information as the current state information of the mobile terminal.
[0113] The second current state information determining module is configured to mark the gyroscope sensor as unavailable when it is determined that the abnormal sensor is a gyroscope sensor, and determine the second state information as the current state information of the mobile terminal.
[0114] Furthermore, the sensor abnormality determination device 200 further includes: a prompt information output module, wherein:
[0115] The prompt information output module is used to output prompt information, where the prompt information is used to indicate sensor abnormality.
[0116] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0117] In several embodiments provided in the present application, the coupling between modules may be electrical, mechanical or other forms of coupling.
[0118] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.
[0119] See also Figure 8 , which shows a structural block diagram of a mobile terminal 100 provided in an embodiment of the present application. The mobile terminal 100 may be a mobile terminal such as a smart phone, a tablet computer, an e-book, etc. that can run applications. The mobile terminal 100 in the present application may include one or more of the following components: a processor 110, a memory 120, a gyroscope sensor 130, an acceleration sensor 140, and one or more applications, wherein one or more applications may be stored in the memory 120 and configured to be executed by one or more processors 110, and one or more programs are configured to execute the method described in the aforementioned method embodiment.
[0120] Among them, the processor 110 may include one or more processing cores. The processor 110 uses various interfaces and lines to connect various parts of the entire mobile terminal 100, and executes various functions and processes data of the mobile terminal 100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 120, and calling data stored in the memory 120. Optionally, the processor 110 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 110 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 110, but may be implemented separately through a communication chip.
[0121] The memory 120 may include a random access memory (RAM) or a read-only memory (ROM). The memory 120 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as a phone book, audio and video data, chat record data) created by the mobile terminal 100 during use.
[0122] See also Fig. 9 , which shows a structural block diagram of a computer-readable storage medium provided in an embodiment of the present application. The computer-readable medium 300 stores program codes, which can be called by a processor to execute the method described in the above method embodiment.
[0123] The computer readable storage medium 300 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 300 includes a non-transitory computer-readable storage medium. The computer readable storage medium 300 has storage space for program code 310 that performs any method steps in the above method. These program codes can be read from or written to one or more computer program products. The program code 310 can be compressed, for example, in an appropriate form.
[0124] In summary, the sensor abnormality determination method, device, mobile terminal and storage medium provided in the embodiments of the present application obtain the status information of the mobile terminal as the first status information based on the gyroscope sensor, and obtain the status information of the mobile terminal as the second status information based on the acceleration sensor. When the first status information and the second status information are inconsistent, the focus value of the mobile terminal is obtained, and the status information of the mobile terminal is obtained as the third status information based on the focus value. Based on the first status information, the second status information and the third status information, the abnormal sensor is determined from the gyroscope sensor and the acceleration sensor, so as to participate in the status information determination of the mobile terminal by obtaining the focus value of the mobile terminal, and the abnormal sensor is determined from the gyroscope sensor and the acceleration sensor, thereby effectively preventing the abnormal software behavior caused by the sensor abnormality and improving the user experience.
[0125] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for determining an abnormality of a sensor, characterized in that: Applied to a mobile terminal, the mobile terminal includes a gyroscope sensor and an acceleration sensor, and the method includes: Acquire the state information of the mobile terminal based on the gyro sensor as first state information, and acquire the state information of the mobile terminal based on the acceleration sensor as second state information; When the first state information and the second state information are inconsistent, acquiring a focus value of the mobile terminal; acquiring the state information of the mobile terminal as third state information based on the focus value; determining an abnormal sensor from among the gyro sensor and the acceleration sensor based on the first state information, the second state information, and the third state information; Wherein, determining an abnormal sensor from among the gyro sensor and the acceleration sensor based on the first state information, the second state information, and the third state information includes: When the first state information and the third state information are consistent, determining that the abnormal sensor among the gyro sensor and the acceleration sensor is the acceleration sensor; When the second state information and the third state information are consistent, it is determined that the abnormal sensor among the gyro sensor and the acceleration sensor is the gyro sensor.
2. The method according to claim 1, characterized in that After determining an abnormal sensor from among the gyro sensor and the acceleration sensor based on the first state information, the second state information, and the third state information, the method further includes: When it is determined that the abnormal sensor is an acceleration sensor, marking the acceleration sensor as unavailable, and determining the first state information as the current state information of the mobile terminal; When it is determined that the abnormal sensor is a gyro sensor, the gyro sensor is marked as unavailable, and the second state information is determined as the current state information of the mobile terminal.
3. The method according to claim 1, characterized in that After determining an abnormal sensor from among the gyro sensor and the acceleration sensor based on the first state information, the second state information, and the third state information, the method further includes: Outputting a prompt message, wherein the prompt message is used to indicate that the sensor is abnormal.
4. The method according to any one of claims 1 to 3, characterized in that: When the first state information and the second state information are inconsistent, acquiring the focus value of the mobile terminal includes: When the first state information and the second state information are inconsistent, continuously acquiring a plurality of focus values of the mobile terminal within a specified time period; The acquiring the state information of the mobile terminal based on the focus value as the third state information includes: The state information of the mobile terminal is acquired based on the multiple focus values as the third state information.
5. The method according to claim 4, characterized in that The acquiring the state information of the mobile terminal based on the multiple focus values as the third state information includes: Obtaining a difference between a maximum value and a minimum value of the plurality of focus values within the specified time period; When the difference is greater than a specified difference, determining that the state information of the mobile terminal is an unstable state, and using the unstable state as the third state information; When the difference is not greater than a specified difference, it is determined that the state information of the mobile terminal is a stable state, and the stable state is used as the third state information.
6. The method according to any one of claims 1 to 3, characterized in that: When the first state information and the second state information are inconsistent, acquiring the focus value of the mobile terminal includes: When the first state information and the second state information are inconsistent, acquiring the state information of the mobile terminal based on the gyro sensor as fourth state information, and acquiring the state information of the mobile terminal based on the acceleration sensor as fifth state information; When the fourth state information and the fifth state information are inconsistent, a focus value of the mobile terminal is acquired.
7. A sensor abnormality determination device, characterized in that: Applied to a mobile terminal, the mobile terminal includes a gyroscope sensor and an acceleration sensor, and the device includes: a first state information acquisition module, configured to acquire state information of the mobile terminal based on the gyroscope sensor as first state information, and acquire state information of the mobile terminal based on the acceleration sensor as second state information; A focus value acquisition module, configured to acquire a focus value of the mobile terminal when the first state information and the second state information are inconsistent; A second state information acquisition module, configured to acquire state information of the mobile terminal based on the focus value as third state information; a sensor abnormality determination module, configured to determine an abnormal sensor from among the gyro sensor and the acceleration sensor based on the first state information, the second state information, and the third state information; Wherein, the sensor abnormality determination module includes: a first sensor abnormality determination submodule, configured to determine that the abnormal sensor among the gyro sensor and the acceleration sensor is the acceleration sensor when the first state information and the third state information are consistent; The second sensor abnormality determination submodule is used to determine that the abnormal sensor from among the gyro sensor and the acceleration sensor is the gyro sensor when the second state information is consistent with the third state information.
8. A mobile terminal, characterized in that: The method comprises a memory and a processor, wherein the memory is coupled to the processor, and the memory stores instructions. When the instructions are executed by the processor, the processor executes the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, which can be called by a processor to execute the method according to any one of claims 1 to 6.
