Tilt angle acquisition method, device and electronic equipment
By obtaining the gravity data of the terminal and the stylus, establishing a spatial coordinate system and calculating the relative inclination angle, the problem in the existing technology of being unable to identify the inclination angle of the stylus and the terminal is solved, achieving rapid and automatic identification and interface adaptation, and expanding The scope of application of the stylus.
Patent Information
- Application Number
- CN202011328374.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-24
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2040-11-24
AI Technical Summary
The relative inclination angle of the stylus pen and the terminal cannot be effectively identified in the prior art, which limits the use range of the stylus pen.
By acquiring the gravity data of the terminal and the stylus, establishing its spatial coordinate system, and calculating the relative inclination angle based on the coordinate system, rapid, automatic, and long-distance recognition can be achieved.
It expands the application range of the stylus and improves the user experience. It can automatically recognize the left and right hand holding and adjust the interface display state without direct contact.
Smart Images

Figure CN112433624B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of electronic equipment, and specifically relates to a tilt angle acquisition method, device and electronic equipment. Background Art
[0002] With the popularization of terminal (such as smart phones and tablet computers) technology, more and more terminal applications (APPs) need to use styluses to achieve convenient operations, and accordingly, the performance requirements for styluses are getting higher and higher. In the process of implementing this application, the inventor found that there are at least the following problems in the prior art: in some stylus usage scenarios, it is necessary to identify the relative inclination angle between the stylus and the terminal, but the relevant technology does not provide an effective solution, which is not conducive to expanding the scope of use of the stylus. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a method, device and electronic device for obtaining an inclination angle, which can solve the problem in the related art that the relative inclination angle between the stylus pen and the terminal cannot be identified.
[0004] In order to solve the above technical problems, this application is implemented as follows:
[0005] In a first aspect, an embodiment of the present application provides a method for obtaining an inclination angle, comprising: obtaining gravity data of a terminal and a stylus; establishing spatial coordinate systems for the terminal and the stylus according to the gravity data; and obtaining a relative inclination angle between the stylus and the terminal according to the spatial coordinate system.
[0006] In a second aspect, an embodiment of the present application provides an inclination acquisition device, comprising: an acquisition module, used to acquire gravity data of a terminal and a stylus; a coordinate system establishment module, used to establish spatial coordinate systems for the terminal and the stylus according to the gravity data; and an inclination acquisition module, used to obtain the relative inclination angle between the stylus and the terminal according to the spatial coordinate system.
[0007] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.
[0008] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0009] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0010] In a sixth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the method described in the first aspect is implemented.
[0011] In the embodiment of the present application, by acquiring the gravity data of the terminal and the stylus, establishing the spatial coordinate system of the terminal and the stylus according to the gravity data, and obtaining the relative inclination angle of the stylus and the terminal according to the spatial coordinate system, the embodiment of the present application provides an effective solution for how to obtain the relative inclination angle of the stylus and the terminal, which is convenient for expanding the application scope of the stylus. At the same time, since the embodiment of the present application integrates the gravity data of the stylus and the gravity data of the terminal, the relative inclination angle of the stylus and the terminal can be quickly, automatically, and automatically identified over a long distance without the stylus and the terminal being in direct contact. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 is a schematic diagram of the process of obtaining the inclination angle provided in an embodiment of the present application;
[0013] Figure 2 It is a schematic diagram of the terminal interface display state matching the right-hand grip in the implementation of this application;
[0014] Figure 3 It is a schematic diagram of the terminal interface display state matching the left hand holding in the implementation of this application;
[0015] Figure 4 It is the interactive operation when the user holds it with his right hand in the implementation of this application;
[0016] Figure 5 It is the interactive operation when the user holds it with his left hand in the implementation of this application;
[0017] Figure 6 is a schematic diagram of the inclination relationship between the stylus pen and the space coordinate system where the terminal is located in the implementation of this application;
[0018] Figure 7 is a schematic diagram of the structure of the stylus pen in the implementation of this application;
[0019] Figure 8 is a schematic flow chart of a method for obtaining an inclination angle provided by another embodiment of the present application;
[0020] Fig. 9 is a flowchart of a method for obtaining an inclination angle provided in yet another embodiment of the present application;
[0021] Fig.10 is a flowchart of a method for obtaining an inclination angle provided by another embodiment of the present application;
[0022] Fig.11 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0023] Fig.12 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application. DETAILED DESCRIPTION
[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0025] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here. In addition, the "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally represents that the objects associated with each other are in an "or" relationship.
[0026] The following describes in detail the tilt angle acquisition method, device and electronic device provided in the embodiments of the present application through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0027] like Figure 1 As shown, an embodiment of the present application provides a method for obtaining an inclination angle, which can be executed by a terminal (such as a control module in the terminal); it can also be executed by a stylus (such as a control module in the stylus); it can also be executed by other modules outside the terminal and the stylus, and the embodiment includes the following steps.
[0028] S102: Obtaining gravity data of the terminal and the stylus.
[0029] In one example, gravity sensors (such as gyroscopes, acceleration sensors, etc.) are provided in both the terminal and the stylus, and gravity data of the terminal and gravity data of the stylus can be obtained respectively through the gravity sensors.
[0030] In another example, the terminal and the stylus can share a gravity sensor, which can be located inside the stylus. This embodiment can be executed by the terminal, and the step of obtaining the gravity data of the terminal and the stylus includes: when the stylus is separated from the terminal, the terminal obtains (such as through near field communication technology) the gravity data of the gravity sensor as the gravity data of the stylus; and the terminal uses the gravity data of the gravity sensor obtained before the stylus is separated from the terminal as the gravity data of the terminal. In this example, for example, the terminal uses the gravity data of the gravity sensor collected most recently or several times before the stylus is separated from the terminal as the gravity data of the terminal. In this embodiment, by sharing the gravity sensor and gravity data, it is convenient to save the hardware cost of the terminal.
[0031] Optionally, the following steps may be included before S102: detecting the separation state of the stylus pen from the terminal, and executing step S102 when it is detected that the stylus pen is separated from the terminal, such as when the stylus pen is pulled out; when it is detected that the stylus pen is not separated from the terminal, the process may be terminated to save data processing overhead.
[0032] S104: Establishing spatial coordinate systems of the terminal and the stylus pen respectively according to the gravity data.
[0033] This step can establish a first spatial coordinate system for the terminal based on the gravity data of the terminal, and the first spatial coordinate system can be a three-dimensional spatial coordinate system including an x-axis, a y-axis, and a z-axis; at the same time, according to the gravity data of the stylus, establish a second spatial coordinate system for the stylus, and the second spatial coordinate system can be a three-dimensional spatial coordinate system including an x-axis, a y-axis, and a z-axis; the second coordinate system can also be a linear coordinate system along the axis direction of the stylus.
[0034] S106: Obtaining a relative inclination angle between the stylus pen and the terminal according to the spatial coordinate system.
[0035] As mentioned above, the spatial coordinate system established in S104 may include a first spatial coordinate system in which the terminal is located and a second spatial coordinate system in which the stylus is located. In this step, obtaining the relative inclination angle between the stylus and the terminal based on the spatial coordinate system may include: determining the angle between the coordinate axes of the first coordinate system and the coordinate axes of the second coordinate system; and obtaining the relative inclination angle between the stylus and the terminal based on the angle.
[0036] For example, when both the first coordinate system and the second coordinate system are three-dimensional coordinate systems, the angle between the x-axis of the first coordinate system and the x-axis of the second coordinate system is determined respectively; the angle between the y-axis of the first coordinate system and the y-axis of the second coordinate system; the angle between the z-axis of the first coordinate system and the z-axis of the second coordinate system are determined respectively, and the relative inclination angle between the stylus and the terminal is obtained based on the above angles.
[0037] For another example, when the first coordinate system is a three-dimensional coordinate system and the second coordinate system is a linear coordinate system, determine the angle between the second coordinate system and the yoz plane of the first coordinate system; determine the angle between the second coordinate system and the xoz plane of the first coordinate system, and obtain the relative inclination angle between the stylus and the terminal based on the above two angles.
[0038] The tilt angle acquisition method provided in the embodiment of the present application acquires the gravity data of the terminal and the stylus, respectively establishes the spatial coordinate system of the terminal and the stylus according to the gravity data, and obtains the relative tilt angle of the stylus and the terminal according to the spatial coordinate system. The embodiment of the present application provides an effective solution for how to acquire the relative tilt angle of the stylus and the terminal, which is convenient for expanding the application scope of the stylus. At the same time, since the embodiment of the present application integrates the gravity data of the stylus and the gravity data of the terminal, the relative tilt angle of the stylus and the terminal can be quickly, automatically, and automatically identified over a long distance without the stylus and the terminal being in direct contact.
[0039] Optionally, after obtaining the relative inclination angle between the stylus pen and the terminal according to the spatial coordinate system in Example 100, the method further includes the following steps: identifying the user's holding state of the stylus pen according to the relative inclination angle, the holding state including left-hand holding or right-hand holding; adjusting the interface display state of the terminal so that the interface display state matches the holding state.
[0040] It should be noted that the "adjustment" mentioned in this embodiment can be expressed as a dynamic response action, and can also be expressed as a static non-response. For example, when it is identified that the user is holding the stylus pen with the right hand, and the interface display state at this time (such as the default interface display state) is already an interface display state that matches the right hand holding, then the "adjustment" in this embodiment can be expressed as a static non-response; for another example, when it is identified that the user is holding the stylus pen with the left hand, and the interface display state at this time is not an interface display state that matches the left hand holding, then the "adjustment" in this embodiment can be expressed as a dynamic response action, that is, executing a terminal interface switching action to switch the terminal interface to an interface display state that matches the left hand holding.
[0041] For more information about the terminal interface display status, see Figures 2 to 5 As shown, Figure 2The interface display state (or UI layout) that matches the right hand holding is shown. Figure 3 What is shown is the interface display state matching the left hand holding. Figure 4 It shows the interactive operation when the user holds it with his right hand. Figure 5 Shown is the interaction when the user is holding with their left hand.
[0042] exist Figures 2 to 5 In the example shown, when it is detected that the user is holding the device with the right hand, the toolbar of the interface is placed on the same side as the user's hand. In addition, the system UI icons or the interaction method of the stylus can be adapted to the corresponding right-hand actions. When it is detected that the user is holding the device with the left hand, the toolbar of the interface is placed on the same side as the user's hand. In addition, the system UI icons or the interaction method of the stylus can be adapted to the corresponding left-hand actions.
[0043] The system UI icons mentioned above include but are not limited to toolbars, menu bars, etc. The interaction methods mentioned above: For example, if a command operation is held with the right hand, swiping right will trigger it; if held with the left hand, swiping left will trigger it.
[0044] This embodiment integrates the gravity data of the stylus pen with the gravity data of the terminal, and can quickly, automatically and over a long distance realize automatic recognition of left and right hand holding, and adjust the interface display status and interaction mode on the terminal (such as a mobile phone), thereby improving the user experience.
[0045] Optionally, before identifying the user's holding state of the stylus according to the relative inclination angle in the above embodiment, the method also includes: detecting whether the stylus is within the operating area of the terminal according to the gravity data; wherein, identifying the user's holding state of the stylus according to the relative inclination angle includes: when it is detected that the stylus is within the operating area of the terminal, identifying the user's holding state of the stylus according to the relative inclination angle.
[0046] For example, in this embodiment, when the stylus is detected to be moved to the upper surface of the terminal (i.e., located in the operating area), the user's holding state of the stylus can be identified according to the relative inclination angle (such as the relative inclination angle), and the terminal UI display can be adapted to the left and right hand holding. In another example of this embodiment, when the stylus is detected to be moved to the lower surface of the terminal (i.e., located outside the operating area), the process can be terminated and the anti-mistouch mechanism can be triggered.
[0047] The identifying the holding state of the stylus pen by the user according to the relative inclination angle mentioned in the above embodiments may include at least one of the following:
[0048] 1) The terminal is operated in portrait mode, and 90°>θ2>Δθ y>θ1>0, if 90°>θ3>Δθ x >θ4>0, it is recognized that the user is holding the stylus pen with the right hand. If -90°<-θ3<Δθ x <-θ4<0, it is recognized that the user is holding the stylus pen with the left hand;
[0049] 2) The terminal is operated in landscape mode, and -90°<-θ2<Δθ x <-θ1<0, if 90°>θ3>Δθ y >θ4>0, it is recognized that the user is holding the stylus pen with the right hand. If -90°<-θ3<Δθ y <-θ4<0, it is recognized that the user is holding the stylus pen with the left hand;
[0050] 3) The terminal is operated in landscape mode, and 90°>θ2>Δθ x >θ1>0, if 90°>θ3>Δθ y >θ4>0, it is recognized that the user is holding the stylus pen with the left hand. If -90°<-θ3<Δθ y <-θ4<0, it is recognized that the user is holding the stylus pen with the right hand;
[0051] Among them, Figure 6 As shown, Δθ x is the angle between the axial direction of the stylus and the yoz plane of the spatial coordinate system where the terminal is located, Δθ y is the angle between the axial direction of the stylus pen and the xoz plane of the control coordinate system where the terminal is located. θ1, θ2, θ3, and θ4 are predefined values and can be set according to the user's habit of holding and using the stylus pen.
[0052] Generally, the display interface of the terminal has a certain aspect ratio (or height-to-width ratio), such as an aspect ratio of 16:9, an aspect ratio of 20:9, etc. The vertical screen operation mentioned in the above embodiment can be Figures 2 to 5 The interface display state shown, that is, the vertical direction of the interface display is parallel to the length direction of the terminal. The horizontal screen operation can be the display state after the vertical screen operation is rotated 90 degrees to the right or left. At this time, the vertical direction of the interface display is parallel to the width direction of the terminal. Among them, the detection of vertical screen operation and horizontal screen operation can be realized based on the gravity sensor in the terminal and the matching function chip.
[0053] for Figure 6The terminal is shown in a spatial coordinate system in which the x-axis is parallel to the short side of the terminal, the y-axis is parallel to the long side of the terminal, and the z-axis is perpendicular to the plane of the terminal and toward the upper surface of the terminal.
[0054] This embodiment provides an effective solution for how to identify the holding state of the stylus pen (left hand holding or right hand holding), thereby improving the accuracy of recognition.
[0055] To illustrate the tilt angle acquisition method provided in the embodiments of the present application in detail, several specific embodiments will be described below.
[0056] Embodiment 1
[0057] This embodiment uses a gravity sensor built into a terminal (such as a mobile phone) and a gravity sensor in a stylus to calculate the relative inclination angle between the stylus and the terminal plane, and then identifies the user's holding state of the stylus based on the relative inclination angle, the holding state including left hand holding or right hand holding; and adjusts the interface display state of the terminal so that the interface display state matches the holding state.
[0058] This embodiment uses the gravity sensor in the terminal to obtain the gravity components of the X, Y, and Z axes of the gravity sensor. The three axes of gravity data are G X , G Y , G Z .
[0059] The inclination angle θ between the terminal X axis and the horizontal plane X1 , the inclination angle θ between the terminal Y axis and the horizontal plane Y1 , the inclination angle θ between the terminal plane and the horizontal plane Z1 ,in:
[0060]
[0061]
[0062]
[0063] It should be noted that the calculation method for calculating the inclination angle between the terminal coordinate system and the horizontal plane can use inverse trigonometric functions, which are not limited to arc tangent, arc sine, and arc sine functions.
[0064] As above, the inclination angle θ between the X-axis of the stylus and the horizontal plane can be calculated through the gravity sensor in the stylus X2 , calculate the inclination angle θ between the stylus Y axis and the horizontal plane Y2 , calculate the inclination angle θ between the stylus Z axis and the horizontal plane Z2 .
[0065] Through the gravity and inclination information, the inclination information of the stylus pen can be mapped to a plane with the terminal as a reference plane, and then the relative inclination between the stylus pen and the terminal can be obtained, where:
[0066] Δθ x =θ X2 -θ X1 ;
[0067] Δθ Y =θ Y2 -θ Y1 ;
[0068] Δθ Z =θ Z2 -θ Z1 .
[0069] Δθ x is the angle between the axial direction of the stylus and the yoz plane of the spatial coordinate system where the terminal is located, Δθ y is the angle between the axial direction of the stylus and the xoz plane of the spatial coordinate system where the terminal is located, Δθ Z is the angle between the axial direction of the stylus and the xoy plane of the spatial coordinate system where the terminal is located, Δθ Z is an optional value that can be matched with Δθ x and Δθ y Auxiliary use.
[0070] In this embodiment, identifying the holding state of the stylus pen by the user according to the relative inclination angle includes at least one of the following:
[0071] 1) The terminal is operated in portrait mode, and 90°>θ2>Δθ y >θ1>0, if 90°>θ3>Δθ x >θ4>0, it is recognized that the user is holding the stylus pen with the right hand. If -90°<-θ3<Δθ x <-θ4<0, it is recognized that the user is holding the stylus pen with the left hand;
[0072] 2) The terminal is operated in landscape mode, and -90°<-θ2<Δθ x <-θ1<0, if 90°>θ3>Δθ y >θ4>0, it is recognized that the user is holding the stylus pen with the right hand. If -90°<-θ3<Δθ y <-θ4<0, it is recognized that the user is holding the stylus pen with the left hand;
[0073] 3) The terminal is operated in landscape mode, and 90°>θ2>Δθ x>θ1>0, if 90°>θ3>Δθ y >θ4>0, it is recognized that the user is holding the stylus pen with the left hand. If -90°<-θ3<Δθ y <-θ4<0, it is recognized that the user is holding the stylus pen with the right hand;
[0074] Among them, θ1, θ2, θ3, and θ4 are predefined values and can be set according to actual application conditions.
[0075] This embodiment can also identify whether the position of the stylus pen is in the effective identification area, as described in detail in Embodiment 3 below.
[0076] The hardware system in this embodiment may include: a stylus; a terminal, such as a mobile phone / tablet computer; an electronic module of the terminal, which may include a gravity sensor / communication module, etc.
[0077] like Figure 7 As shown, Figure 7 This is a schematic diagram of the internal modules of the stylus, which mainly include:
[0078] Gravity sensor, used to obtain the inclination information of the touch pen;
[0079] A controller, used for data (such as gravity data) processing;
[0080] A power supply for supplying power to the stylus system;
[0081] A storage module, used to store data related to the stylus (such as gravity data, etc.);
[0082] Communication module, used to realize data interaction with the terminal;
[0083] A power module, used to supply power to the stylus;
[0084] Terminals, including but not limited to mobile phones / tablets;
[0085] Stylus housing.
[0086] The implementation process of this embodiment is as follows Figure 8 As shown, the following steps are included:
[0087] S802: Detect whether the stylus is enabled;
[0088] If yes, execute S804;
[0089] If not, return to S802.
[0090] S804: Acquire gravity data of the stylus.
[0091] S806: Integrate the gravity data of the terminal and the stylus.
[0092] S808: Calculate the relative inclination angle between the stylus pen and the terminal.
[0093] S810: Identify the user's holding state.
[0094] If it is identified as left-hand holding, execute S812;
[0095] If it is recognized as right-hand holding, execute S814.
[0096] S812: The terminal is configured in left-hand mode, that is, the terminal interface display state is configured in left-hand mode, see Figure 3 ;
[0097] S814: The terminal is configured to right-hand mode, that is, the terminal interface display state is configured to right-hand mode, see Figure 2 ;
[0098] S816: Detecting whether the use of the stylus pen is completed;
[0099] If yes, then end the process;
[0100] If not, return to S804.
[0101] This embodiment can adapt the system UI or interaction of the terminal to the left and right hands by distinguishing the holding state of the stylus. The application examples are as follows:
[0102] When it is detected that the user is holding the device with the right hand, the toolbar is placed on the same side as the user's hand. In addition, the system UI icons or the interaction method of the stylus can be adapted to the corresponding right-hand actions.
[0103] When it is detected that the user is holding the device with the left hand, the toolbar is placed on the same side as the user's hand. In addition, the system UI icons or the interaction method of the stylus can be adapted to the corresponding left-hand actions.
[0104] The above system UI icons: including toolbars, menu bars, etc. The above interaction methods: such as a certain command operation, when holding with the right hand, swiping right will trigger it; if holding with the left hand, swiping left will trigger it.
[0105] The above application examples will be more in line with user interaction habits and improve user experience.
[0106] Embodiment 2
[0107] The terminal (mobile phone) and the stylus in this embodiment share a gravity sensor, and when the stylus is in the terminal, gravity data is shared with the terminal system for use. When the stylus is pulled out for use, the gravity data of the stylus can be used to interact with the terminal.
[0108] This embodiment can save a gravity sensor, and the terminal and the stylus pen share one, which can identify left and right hand holding detection in normal postures, etc.
[0109] Since the gravity sensor will be taken out with the stylus, the gravity data is sent back to the terminal system when or before the stylus is taken out to define the initial tilt angle of the terminal:
[0110] The inclination angle θ between the terminal X axis and the horizontal plane X1 , the inclination angle θ between the terminal Y axis and the horizontal plane Y1 , the inclination angle θ between the terminal plane and the horizontal plane Z1 ; The inclination angle θ between the stylus X axis and the horizontal plane X2 , the inclination angle θ between the stylus Y axis and the horizontal plane Y2 , the inclination angle θ between the stylus Z axis and the horizontal plane Z2 .
[0111] The relative inclination angles are:
[0112] Δθ x =θ X2 -θ X1 ;
[0113] Δθ Y =θ Y2 -θ Y1 ;
[0114] Δθ Z =θ Z2 -θ Z1 .
[0115] According to the relative inclination angle and the usage habits of the stylus, the user's left and right hand information can be obtained.
[0116] The implementation process of this embodiment is as follows Fig. 9 As shown, the following steps are included:
[0117] S902: Detect whether the stylus is enabled;
[0118] If yes, execute S904;
[0119] If not, return to S902.
[0120] S904: Acquire terminal gravity data.
[0121] S906: Acquire the stylus gravity data.
[0122] S908: Calculate the relative inclination angle between the stylus pen and the terminal.
[0123] S910: Identify the user's holding state;
[0124] If it is identified as left-hand holding, execute S912;
[0125] If it is recognized as right-hand holding, execute S914.
[0126] S912: The terminal is configured in left-hand mode, that is, the terminal interface display state is configured in left-hand mode, see Figure 3 ;
[0127] S914: The terminal is configured to right-hand mode, that is, the terminal interface display state is configured to right-hand mode, see Figure 2 .
[0128] S916: Detecting whether the use of the stylus pen is completed;
[0129] If yes, then end the process;
[0130] If not, return to S904.
[0131] Embodiment 3
[0132] The foregoing embodiments may have certain misjudgments. For example, when the stylus is on the back (lower surface) of the terminal, that is, when it is detected that the stylus is not in the operating area, the left and right hand recognition function can be turned off to prevent misrecognition and improve recognition accuracy.
[0133] The solution is as follows: The acceleration of the three axes of the gravity sensor can simulate the displacement of the stylus through quadratic integration. The calculation method is as follows:
[0134] When the relative acceleration of the Z axis (G Z - gravity constant G) is positive, it can be explained that the stylus is moved to the upper surface of the terminal, and the UI display can be adapted to the left and right hands.
[0135] If the relative acceleration of the Z axis (G Z - gravity constant G) is negative, it can be explained that the stylus has moved to the lower surface of the terminal, triggering the anti-mistouch mechanism.
[0136] The implementation process of this embodiment is as follows Fig.10 As shown, the following steps are included:
[0137] S1002: Detect whether the stylus is enabled;
[0138] If yes, execute S1004;
[0139] If not, return to S1002.
[0140] S1004: Acquire the stylus gravity data.
[0141] S1006: Calculate the stylus position information.
[0142] S1008: Determine whether the stylus pen is in a valid working area;
[0143] If yes, execute S1010;
[0144] If not, return to S1004.
[0145] S1010: Integrate gravity data of the terminal and the stylus.
[0146] S1012: Calculate the relative inclination angle between the stylus pen and the terminal.
[0147] S1014: Identify the user's holding state;
[0148] If it is identified as left-hand holding, execute S1016;
[0149] If it is recognized as right-hand holding, execute S1018.
[0150] S1016: The terminal is configured to left-hand mode, that is, the terminal interface display state is configured to left-hand mode, see Figure 3 ;
[0151] S1018: The terminal is configured in right-hand mode, that is, the terminal interface display state is configured in right-hand mode, see Figure 2 .
[0152] S1020: Detecting whether the use of the stylus pen is completed;
[0153] If yes, then end the process;
[0154] If not, return to S1004.
[0155] It should be noted that the inclination angle acquisition method provided in the embodiment of the present application can be executed by the inclination angle acquisition device, or, or, a control module in the inclination angle acquisition device for executing the loading inclination angle acquisition method. In the embodiment of the present application, the inclination angle acquisition device executing the loading inclination angle acquisition method is taken as an example to illustrate the inclination angle acquisition device provided in the embodiment of the present application.
[0156] Fig.11 Schematic diagram of the structure of the tilt angle acquisition device according to an embodiment of the present application. Fig.11 As shown, the device 1100 includes:
[0157] An acquisition module 1102 may be used to acquire gravity data of the terminal and the stylus;
[0158] A coordinate system establishing module 1104 may be used to establish spatial coordinate systems of the terminal and the stylus pen according to the gravity data;
[0159] The inclination angle obtaining module 1106 may be configured to obtain a relative inclination angle between the stylus pen and the terminal according to the spatial coordinate system.
[0160] In the embodiment of the present application, by acquiring the gravity data of the terminal and the stylus, establishing the spatial coordinate system of the terminal and the stylus according to the gravity data, and obtaining the relative inclination angle of the stylus and the terminal according to the spatial coordinate system, the embodiment of the present application provides an effective solution for how to obtain the relative inclination angle of the stylus and the terminal, which is convenient for expanding the application scope of the stylus. At the same time, since the embodiment of the present application integrates the gravity data of the stylus and the gravity data of the terminal, the relative inclination angle of the stylus and the terminal can be quickly, automatically, and automatically identified over a long distance without the stylus and the terminal being in direct contact.
[0161] Optionally, as an embodiment, the apparatus 1100 further includes:
[0162] an identification module, configured to identify a user's holding state of the stylus according to the relative inclination angle, wherein the holding state includes left-hand holding or right-hand holding;
[0163] The interface adjustment module is used to adjust the interface display state of the terminal so that the interface display state matches the holding state.
[0164] Optionally, as an embodiment, the identification module is used for at least one of the following:
[0165] The terminal is operated in portrait mode, and 90°>θ2>Δθ y >θ1>0, if 90°>θ3>Δθ x >θ4>0, it is recognized that the user is holding the stylus pen with the right hand. If -90°<-θ3<Δθ x <-θ4<0, it is recognized that the user is holding the stylus pen with the left hand;
[0166] The terminal is operated in horizontal mode, and -90°<-θ2<Δθ x <-θ1<0, if 90°>θ3>Δθ y >θ4>0, it is recognized that the user is holding the stylus pen with the right hand. If -90°<-θ3<Δθ y <-θ4<0, it is recognized that the user is holding the stylus pen with the left hand;
[0167] The terminal is operated in horizontal mode, and 90°>θ2>Δθ x >θ1>0, if 90°>θ3>Δθ y>θ4>0, it is recognized that the user is holding the stylus pen with the left hand. If -90°<-θ3<Δθ y <-θ4<0, it is recognized that the user is holding the stylus pen with the right hand;
[0168] Among them, Δθ x is the angle between the axial direction of the stylus and the yoz plane of the spatial coordinate system where the terminal is located, Δθ y is the angle between the axial direction of the stylus pen and the xoz plane of the space coordinate system where the terminal is located, and θ1, θ2, θ3, and θ4 are predefined values.
[0169] Optionally, as an embodiment, the apparatus 1100 further includes:
[0170] A detection module, configured to detect whether the stylus is within an operating area of the terminal according to the gravity data;
[0171] The identification module is configured to: identify the user's holding state of the stylus pen according to the relative inclination angle when the detection module detects that the stylus pen is within the operating area of the terminal.
[0172] Optionally, as an embodiment, the spatial coordinate system includes a first coordinate system where the terminal is located and a second coordinate system where the stylus is located, and the inclination angle acquisition module 1106 may be used to:
[0173] Determining an angle between a coordinate axis of the first coordinate system and a coordinate axis of the second coordinate system;
[0174] The relative inclination angle between the stylus pen and the terminal is obtained according to the included angle.
[0175] Optionally, as an embodiment, the stylus pen includes a gravity sensor, and the acquisition module 1102 is used to:
[0176] When the stylus pen is separated from the terminal, acquiring gravity data of the gravity sensor as gravity data of the stylus pen; and
[0177] The gravity data of the gravity sensor obtained before the stylus pen is separated from the terminal is used as the gravity data of the terminal.
[0178] The tilt angle acquisition device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and the non-mobile electronic device can be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0179] The tilt angle acquisition device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0180] The tilt angle acquisition device provided in the embodiment of the present application can achieve Figures 1 to 10 In order to avoid repetition, the various processes implemented by the tilt angle acquisition device in the method embodiment will not be described here.
[0181] Optionally, an embodiment of the present application also provides an electronic device, including a processor, a memory, and a program or instruction stored in the memory and executable on the processor. When the program or instruction is executed by the processor, each process of the above-mentioned inclination angle acquisition method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0182] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0183] Fig.12 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0184] The electronic device 1200 includes but is not limited to: a radio frequency unit 1201, a network module 1202, an audio output unit 1203, an input unit 1204, a sensor 1205, a display unit 1206, a user input unit 1207, an interface unit 1208, a memory 1209, and a processor 1210 and other components.
[0185] Those skilled in the art will appreciate that the electronic device 1200 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 1210 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Fig.12 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0186] The processor 1210 is used to obtain gravity data of the terminal and the stylus; establish spatial coordinate systems of the terminal and the stylus respectively according to the gravity data; and obtain a relative inclination angle between the stylus and the terminal according to the spatial coordinate system.
[0187] In the embodiment of the present application, by acquiring the gravity data of the terminal and the stylus, establishing the spatial coordinate system of the terminal and the stylus according to the gravity data, and obtaining the relative inclination angle of the stylus and the terminal according to the spatial coordinate system, the embodiment of the present application provides an effective solution for how to obtain the relative inclination angle of the stylus and the terminal, which is convenient for expanding the application scope of the stylus. At the same time, since the embodiment of the present application integrates the gravity data of the stylus and the gravity data of the terminal, the relative inclination angle of the stylus and the terminal can be quickly, automatically, and automatically identified over a long distance without the stylus and the terminal being in direct contact.
[0188] The electronic device 1200 provided in the embodiment of the present application can also implement each process of the above-mentioned tilt angle acquisition method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described here.
[0189] It should be understood that in the embodiment of the present application, the input unit 1204 may include a graphics processor (Graphics Processing Unit, GPU) 12041 and a microphone 12042, and the graphics processor 12041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 1206 may include a display panel 12061, and the display panel 12061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 1207 includes a touch panel 12071 and other input devices 12072. The touch panel 12071 is also called a touch screen. The touch panel 12071 may include two parts: a touch detection device and a touch controller. Other input devices 12072 may include, but are not limited to, a physical keyboard, a function key (such as a volume control button, a switch button, etc.), a trackball, a mouse, and a joystick, which will not be repeated here. The memory 1209 can be used to store software programs and various data, including but not limited to applications and operating systems. The processor 1210 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 1210.
[0190] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned inclination angle acquisition method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0191] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0192] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned tilt angle acquisition method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0193] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0194] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0195] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0196] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A method for obtaining an inclination angle, characterized in that: include: Get the gravity data of the terminal and stylus; Establishing spatial coordinate systems of the terminal and the stylus pen respectively according to the gravity data; Obtaining a relative inclination angle between the stylus pen and the terminal according to the spatial coordinate system; The stylus includes a gravity sensor, the terminal and the stylus share the gravity sensor, and the gravity sensor is located inside the stylus; and acquiring gravity data of the terminal and the stylus includes: When the stylus pen is separated from the terminal, the terminal acquires gravity data of the gravity sensor as gravity data of the stylus pen; and The terminal uses the gravity data of the gravity sensor obtained before the stylus pen is separated from the terminal as the gravity data of the terminal.
2. The method according to claim 1, characterized in that: After obtaining the relative inclination angle between the stylus pen and the terminal according to the spatial coordinate system, the method further includes: Identifying a user's holding state of the stylus according to the relative inclination angle, wherein the holding state includes left-hand holding or right-hand holding; The interface display state of the terminal is adjusted so that the interface display state matches the holding state.
3. The method according to claim 2, characterized in that The identifying the holding state of the stylus pen by the user according to the relative inclination angle comprises at least one of the following: The terminal is operated in portrait mode, and 90°>θ2>Δθ y >θ1>0, if 90°>θ3>Δθ x >θ4>0, it is recognized that the user is holding the stylus pen with the right hand. If -90°<-θ3<Δθ x <-θ4<0, it is recognized that the user is holding the stylus pen with the left hand; The terminal is operated in horizontal mode, and -90°<-θ2<Δθ x <-θ1<0, if 90°>θ3>Δθ y >θ4>0, it is recognized that the user is holding the stylus pen with the right hand. If -90°<-θ3<Δθ y <-θ4<0, it is recognized that the user is holding the stylus pen with the left hand; The terminal is operated in horizontal mode, and 90°>θ2>Δθ x >θ1>0, if 90°>θ3>Δθ y >θ4>0, it is recognized that the user is holding the stylus pen with the left hand. If -90°<-θ3<Δθ y <-θ4<0, it is recognized that the user is holding the stylus pen with the right hand; Among them, Δθ x is the angle between the axial direction of the stylus and the yoz plane of the spatial coordinate system where the terminal is located, Δθ y is the angle between the axial direction of the stylus pen and the xoz plane of the space coordinate system where the terminal is located, and θ1, θ2, θ3, and θ4 are predefined values.
4. The method according to claim 2, characterized in that: Before identifying the user's holding state of the stylus pen according to the relative inclination angle, the method further includes: Detecting whether the stylus is within an operating area of the terminal according to the gravity data; The identifying the holding state of the stylus pen by the user according to the relative inclination angle includes: when it is detected that the stylus pen is within the operation area of the terminal, identifying the holding state of the stylus pen by the user according to the relative inclination angle.
5. The method according to any one of claims 1 to 4, characterized in that: The spatial coordinate system includes a first coordinate system where the terminal is located and a second coordinate system where the stylus is located, and obtaining the relative inclination angle between the stylus and the terminal according to the spatial coordinate system includes: Determining an angle between a coordinate axis of the first coordinate system and a coordinate axis of the second coordinate system; The relative inclination angle between the stylus pen and the terminal is obtained according to the included angle.
6. A device for obtaining an inclination angle, characterized in that: include: An acquisition module, used to acquire gravity data of the terminal and the stylus; A coordinate system establishment module, used to establish the spatial coordinate systems of the terminal and the stylus pen according to the gravity data; An inclination acquisition module, used to obtain the relative inclination angle between the stylus pen and the terminal according to the spatial coordinate system; The stylus pen includes a gravity sensor, the terminal and the stylus pen share the gravity sensor, and the gravity sensor is located inside the stylus pen; the acquisition module is used to: When the stylus pen is separated from the terminal, acquiring gravity data of the gravity sensor as gravity data of the stylus pen; as well as The gravity data of the gravity sensor obtained before the stylus pen is separated from the terminal is used as the gravity data of the terminal.
7. The device according to claim 6, characterized in that The device also includes: an identification module, configured to identify a user's holding state of the stylus according to the relative inclination angle, wherein the holding state includes left-hand holding or right-hand holding; The interface adjustment module is used to adjust the interface display state of the terminal so that the interface display state matches the holding state.
8. The device according to claim 7, characterized in that The identification module is used for at least one of the following: The terminal is operated in portrait mode, and 90°>θ2>Δθ y >θ1>0, if 90°>θ3>Δθ x >θ4>0, it is recognized that the user is holding the stylus pen with the right hand. If -90°<-θ3<Δθ x <-θ4<0, it is recognized that the user is holding the stylus pen with the left hand; The terminal is operated in horizontal mode, and -90°<-θ2<Δθ x <-θ1<0, if 90°>θ3>Δθ y >θ4>0, it is recognized that the user is holding the stylus pen with the right hand. If -90°<-θ3<Δθ y <-θ4<0, it is recognized that the user is holding the stylus pen with the left hand; The terminal is operated in horizontal mode, and 90°>θ2>Δθ x >θ1>0, if 90°>θ3>Δθ y >θ4>0, it is recognized that the user is holding the stylus pen with the left hand. If -90°<-θ3<Δθ y <-θ4<0, it is recognized that the user is holding the stylus pen with the right hand; Among them, Δθ x is the angle between the axial direction of the stylus and the yoz plane of the spatial coordinate system where the terminal is located, Δθ y is the angle between the axial direction of the stylus pen and the xoz plane of the space coordinate system where the terminal is located, and θ1, θ2, θ3, and θ4 are predefined values.
9. The device according to claim 7, characterized in that Also includes: A detection module, configured to detect whether the stylus is within an operating area of the terminal according to the gravity data; The identification module is configured to: identify the user's holding state of the stylus pen according to the relative inclination angle when the detection module detects that the stylus pen is within the operating area of the terminal.
10. The device according to any one of claims 6 to 9, characterized in that The spatial coordinate system includes a first coordinate system where the terminal is located and a second coordinate system where the stylus is located, and the inclination angle acquisition module is used to: Determining an angle between a coordinate axis of the first coordinate system and a coordinate axis of the second coordinate system; The relative inclination angle between the stylus pen and the terminal is obtained according to the included angle.
11. An electronic device, characterized in that: The invention comprises a processor, a memory and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the inclination acquisition method as claimed in any one of claims 1 to 5.
12. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the inclination acquisition method according to any one of claims 1 to 5 is implemented.
