Stylus and stylus tilt angle detection method
Patent Information
- Application Number
- CN202610626304.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-08
- Publication Date
- 2026-08-18
AI Technical Summary
[0003]基于电容的检测方法需复杂的信号同步和相关性计算,易受时钟抖动和电磁干扰影响,导致倾斜角计算误差大
Smart Images

Figure CN122593638A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic device technology, and in particular to a stylus and a method for detecting the stylus tilt angle. Background Technology
[0002] Styluses, as digital input tools, are widely used in drawing, note-taking, and interaction design. Tilt angle detection can enhance the user experience, for example, by enabling brush thickness variations or shadow effects in drawing software. Current mainstream tilt detection technology is based on the principle of electrostatic coupling: the electrode at the pen tip and the conductor at the screen tip form a capacitor node; the capacitance value changes when the pen is tilted, and the tilt angle is analyzed through signal processing.
[0003] Capacitance-based detection methods require complex signal synchronization and correlation calculations, and are susceptible to clock jitter and electromagnetic interference, resulting in large errors in tilt angle calculation. Summary of the Invention
[0004] Therefore, it is necessary to provide a stylus and a stylus tilt angle detection method that can effectively improve the accuracy of stylus tilt angle detection results in response to the above-mentioned technical problems.
[0005] In a first aspect, this application provides a stylus, which includes:
[0006] Pen body;
[0007] An image acquisition unit, located on the pen body, is used to acquire images of the writing surface where the stylus is located;
[0008] A beam projection unit, located on the pen body, is used to project a beam of light onto the writing surface;
[0009] The controller, located within the pen body, is communicatively connected to the image acquisition unit, and is configured as follows:
[0010] Acquire the target image captured by the image acquisition unit;
[0011] The target image is processed to obtain the parameter information of the light spot in the target image; where the light spot is the projection area generated by the light beam emitted by the beam projection unit projected onto the writing plane;
[0012] Based on the parameter information of the light spot, determine the target tilt angle of the stylus.
[0013] In one embodiment, when the controller processes the target image to obtain parameter information of the light spot in the target image, it is configured to:
[0014] The target image is binarized to obtain a binary image;
[0015] Based on the binarized image, determine the boundary information of the light spot's edge contour; and
[0016] Based on the boundary information, the least squares ellipse fitting algorithm is used to determine the parameter information of the light spot.
[0017] In one embodiment, the parameter information of the light spot includes the length of the major axis and the length of the minor axis of the ellipse corresponding to the edge contour of the light spot;
[0018] When the controller determines the target tilt angle of the stylus based on the parameter information of the light spot, it is configured as follows:
[0019] The target tilt angle of the stylus is determined based on the ratio of the minor axis length to the major axis length.
[0020] In one embodiment, when the controller determines the target tilt angle of the stylus based on the ratio of the minor axis length to the major axis length, it is configured to:
[0021] The first tilt angle is determined based on the ratio of the minor axis length to the major axis length;
[0022] Based on the position information of the light spot on the target image, determine the second tilt angle; and
[0023] The target tilt angle of the stylus is determined based on the first tilt angle and the second tilt angle.
[0024] In one embodiment, when the controller determines the second tilt angle based on the position information of the light spot on the target image, it is configured to:
[0025] Based on the position information of the light spot on the target image and the center position of the target image, determine the offset between the light spot and the center position of the target image; and
[0026] Determine the second tilt angle based on the offset.
[0027] In one embodiment, when the controller determines the first tilt angle based on the ratio of the minor axis length to the major axis length, it is configured to:
[0028] The first tilt angle is obtained by performing an inverse cosine operation on the ratio of the minor axis length to the major axis length.
[0029] In one embodiment, when the controller determines the target tilt angle of the stylus based on the first tilt angle and the second tilt angle, it is configured to:
[0030] The first tilt angle and the second tilt angle are weighted and summed to determine the target tilt angle of the stylus.
[0031] Secondly, this application also provides a method for detecting the tilt angle of a stylus, which is incorporated in the controller of the stylus. The method includes:
[0032] Acquire the target image; wherein the target image is acquired by the image acquisition unit located on the stylus;
[0033] Determine the parameter information of the light spot in the target image; wherein, the light spot is the projection area generated by the light beam emitted by the beam projection unit projected onto the writing plane; the beam projection unit is disposed on the stylus; and
[0034] Based on the parameter information of the light spot, determine the target tilt angle of the stylus.
[0035] Thirdly, the application also provides a stylus tilt angle detection device, disposed in the stylus controller, the device comprising:
[0036] The acquisition module is used to acquire the target image; wherein, the target image is acquired by the image acquisition unit located on the stylus;
[0037] The first determining module is used to determine the parameter information of the light spot in the target image; wherein, the light spot is the projection area generated by the light beam emitted by the beam projection unit projected onto the writing plane; the beam projection unit is located on the stylus.
[0038] The second determining module is used to determine the target tilt angle of the stylus based on the parameter information of the light spot.
[0039] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0040] Acquire the target image captured by the image acquisition unit;
[0041] The target image is processed to obtain parameter information of the light spot in the target image; wherein, the light spot is the projection area generated by the beam emitted by the beam projection unit projected onto the writing plane; and
[0042] Based on the parameter information of the light spot, determine the target tilt angle of the stylus.
[0043] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0044] Acquire the target image captured by the image acquisition unit;
[0045] The target image is processed to obtain parameter information of the light spot in the target image; wherein, the light spot is the projection area generated by the beam emitted by the beam projection unit projected onto the writing plane; and
[0046] Based on the parameter information of the light spot, determine the target tilt angle of the stylus.
[0047] The aforementioned stylus and stylus tilt angle detection method include: a pen body; an image acquisition unit disposed on the pen body for acquiring an image of the writing plane on which the stylus is located; a beam projection unit disposed on the pen body for projecting a beam onto the writing plane; and a controller disposed in the pen body, communicatively connected to the image acquisition unit, and configured to: acquire the target image acquired by the image acquisition unit; process the target image to obtain parameter information of the light spot in the target image; and determine the target tilt angle of the stylus based on the parameter information of the light spot; wherein the light spot is the projection area generated by the beam emitted by the beam projection unit projected onto the writing plane. In this embodiment, the stylus is equipped with an image acquisition unit and a beam projection unit. Based on the light spot projected onto the writing plane by the image acquisition unit or the beam projection unit, and based on the parameter information of the light spot, the tilt angle of the stylus is determined. Since the method of determining the tilt angle is basically unaffected by clock jitter and electromagnetic interference, the accuracy of the determined tilt angle of the stylus is effectively improved. Attached Figure Description
[0048] Figure 1 This is a schematic diagram illustrating the principle of the stylus provided in this embodiment;
[0049] Figure 2 This is a schematic diagram of the controller provided in this embodiment;
[0050] Figure 3 This is a schematic diagram illustrating the principle of stylus tilt detection provided in this embodiment;
[0051] Figure 4 This is a flowchart illustrating the first stylus tilt angle detection method provided in this embodiment;
[0052] Figure 5 This is a flowchart illustrating the process of determining the parameter information of the light spot in this embodiment.
[0053] Figure 6 This is a flowchart illustrating the process of determining the target tilt angle provided in this embodiment;
[0054] Figure 7 This is a schematic diagram of the light spot change provided in this embodiment;
[0055] Figure 8 This is a schematic diagram illustrating the principle of determining the spot offset provided in this embodiment;
[0056] Figure 9 This is a flowchart illustrating the second stylus tilt angle detection method provided in this embodiment;
[0057] Figure 10 This is a structural block diagram of a stylus tilt angle detection device provided in this embodiment. Explanation of reference numerals in the attached figures
[0058] 101. Beam projection unit; 102. Image acquisition unit; 103. Pen tip. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0060] Styluses, as digital input tools, are widely used in drawing, note-taking, and interaction design. Tilt angle detection can enhance the user experience, for example, by enabling brush thickness variations or shadow effects in drawing software. Current mainstream tilt detection technology is based on the principle of electrostatic coupling: the electrode at the pen tip and the conductor at the screen tip form a capacitor node; the capacitance value changes when the pen is tilted, and the tilt angle is analyzed through signal processing.
[0061] Capacitance-based detection methods require complex signal synchronization and correlation calculations, and are susceptible to clock jitter and electromagnetic interference, resulting in large errors in tilt angle calculation.
[0062] To address the aforementioned challenges, the stylus provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, the stylus includes: a pen body; an image acquisition unit disposed on the pen body for acquiring images of the writing plane on which the stylus is located; a beam projection unit disposed on the pen body for projecting a beam onto the writing plane; and a controller disposed in the pen body and communicatively connected to the image acquisition unit, wherein the controller is configured to: acquire the target image acquired by the image acquisition unit; process the target image to obtain parameter information of the light spot in the target image; wherein the light spot is the projection area generated by the beam emitted by the beam projection unit projected onto the writing plane; and determine the target tilt angle of the stylus based on the parameter information of the light spot.
[0063] Among them, the stylus is an intelligent touch input device that differs from ordinary passive styluses. It is mainly used in touch devices such as capacitive screens, digital displays / tablets, or other writing surfaces. It does not achieve touch control solely through physical contact, but rather incorporates built-in electronic components, sensors, and control circuits, enabling it to actively send signals and transmit data to the touch device. Touch devices are electronic devices that integrate touch sensing technology, supporting users to achieve human-computer information interaction through direct operation methods such as touch, writing, and gestures. They are also the core application carrier of styluses. Their core feature is that they abandon the indirect operation of traditional mice and keyboards, using touch as the core interaction method, and combining display, processing, and sensing modules to achieve a closed loop of command input and information feedback. Touch devices can be tablet computers (e.g., iPads, Android tablets), touchscreen smartphones, and handheld learning machines / digital tablets.
[0064] In one embodiment, such as Figure 1 As shown, a stylus is provided, including:
[0065] The pen body includes an image acquisition unit 101 disposed on the pen body for acquiring images of the writing surface on which the stylus is located; a beam projection unit 102 disposed on the pen body for projecting a beam onto the writing surface; and a controller disposed in the pen body for communicating with the image acquisition unit 101. The image acquisition unit 101 and the beam projection unit 102 are located on both sides of the pen tip 103.
[0066] Optionally, in some embodiments such as Figure 2 As shown, both the beam projection unit and the image acquisition unit are communicatively connected to the controller, such as... Figure 3 As shown, when the stylus is perpendicular to the writing plane, the light spot formed by the beam projected by the beam projection unit on the writing plane is a perfect circle; when the stylus is tilted to the writing plane, the light spot formed by the beam projected by the beam projection unit on the writing plane is an ellipse; therefore, by detecting the light spot, the tilt angle can be measured.
[0067] Optionally, in some implementations, the beam projection unit can be a visible light projection unit, which emits a visible light beam to form a circular or elliptical light spot on the writing plane. It should be noted that in order to improve the clarity of the outline edge of the formed light spot, the beam projection power can be increased and the projected beam can be filtered for diffuse reflection to improve the clarity of the light spot edge.
[0068] Optionally, in some embodiments, the beam projection unit is an infrared light projection unit; the image acquisition unit is a CMOS (Complementary Metal-Oxide-Semiconductor) camera unit. In this embodiment, the CMOS camera unit is a camera integrating an ultra-small CMOS image sensor with a resolution of 640×480 pixels. The sensor is equipped with a wide-angle lens with an f / 2.0 aperture, achieving a field of view of 120 degrees, which can cover a sufficiently large writing area around the pen tip. The diameter of the entire camera module is controlled within 1.8mm, and the length does not exceed 5mm, ensuring that it does not affect the writing feel and center of gravity balance of the pen. The infrared light projection unit is an infrared LED projection unit that can emit near-infrared light with a wavelength of 850nm or 940nm, and the power is controlled at 10-20mW. The infrared LED is equipped with a collimating lens, projecting a circular light spot onto the writing surface in a vertical state. The light spot diameter is about 1mm, and the edges are clear. Since the infrared light projected by the infrared light projection unit is invisible, the light spot formed on the writing surface is imperceptible to the human eye, preventing glare or visual interference during writing and drawing, thus ensuring a good user experience. Furthermore, the CMOS image sensor has excellent photosensitivity in the near-infrared band (850nm, 940nm), enabling clear acquisition of the light spot image and meeting the requirements for high-precision tilt detection. Therefore, the combination of the infrared light projection unit and the CMOS camera unit not only does not interfere with normal writing but also achieves tilt angle detection, improving user satisfaction. It should be noted that to improve measurement accuracy, an infrared filter can be added in front of the camera, or image processing algorithms can be used to separate the infrared light spot from the visible light information to ensure the accuracy of the acquired light spot parameters.
[0069] In one embodiment, the stylus is used during, such as Figure 4 As shown, the stylus controller is also configured as follows:
[0070] S401, acquire the target image acquired by the image acquisition unit.
[0071] Optionally, in this embodiment, the beam projection unit is an infrared light projection unit, and the image acquisition unit is a CMOS camera unit.
[0072] In one optional implementation, in response to a tilt angle detection trigger operation for the stylus, the controller controls the beam projection unit to turn on and controls the image acquisition unit to acquire an image, thereby obtaining the target image acquired by the image acquisition unit. Optionally, the tilt angle detection trigger operation for the stylus may be a tilt angle detection request sent by a host device associated with the stylus, a trigger operation by the user on a control (e.g., a button) on the stylus, or a voice message representing tilt angle detection received through the microphone on the stylus.
[0073] Another alternative implementation involves, in response to an activation operation on the beam projection unit, the controller activates the beam projection unit and controls the image acquisition unit to acquire an image, thereby obtaining the target image acquired by the image acquisition unit. The activation operation on the beam projection unit can be a trigger operation on a button on a stylus, or an operation to activate the beam projection unit via a touchscreen.
[0074] S402, process the target image to obtain the parameter information of the light spot in the target image.
[0075] The light spot is the projection area generated by the light beam emitted by the beam projection unit projected onto the writing plane, such as... Figure 3 As shown, when the stylus is perpendicular to the writing plane, the light spot formed by the beam projected by the beam projection unit on the writing plane is a perfect circle; when the stylus is tilted to the writing plane, the light spot formed by the beam projected by the beam projection unit on the writing plane is an ellipse.
[0076] One possible implementation involves performing a Fourier transform on the target image and filtering out low-frequency (background) and high-frequency (noise) noise to obtain a processed image. The processed image is then subjected to an inverse transform to obtain a clean spot image. The contour is then extracted, and the parameter information of the spot in the target image is obtained based on the contour information.
[0077] Another alternative implementation involves inputting the target image into an image processing model, which then outputs parameter information of the light spots in the target image. The image processing model can be a trained neural network model.
[0078] Another alternative implementation involves the CMOS camera unit capturing the target image during the pulsed emission of the infrared light projection module and capturing the background image during the extinguishing of the pulses. By subtracting the two images, the static background can be eliminated, leaving only the light spot, and the parameter information of the light spot can be obtained.
[0079] S403 determines the target tilt angle of the stylus based on the parameter information of the light spot.
[0080] The target tilt angle refers to the tilt angle of the stylus at the current moment.
[0081] One optional implementation involves determining the target tilt angle of the stylus based on the parameter information of the light spot and a parameter list. The parameter list records various tilt angles and the corresponding parameter information for each type of tilt angle.
[0082] Another alternative implementation involves finding the minimum bounding rectangle of the light spot profile. The target tilt angle of the stylus is then determined based on the ratio of the width to the length of the minimum bounding rectangle; specifically, an inverse cosine operation can be performed on the ratio, and the final result can be used as the target tilt angle of the stylus.
[0083] Another optional implementation is that the parameter information of the light spot includes the major axis length and minor axis length of the ellipse corresponding to the edge contour of the light spot. Based on this, the target tilt angle of the stylus is determined according to the parameter information of the light spot. An optional implementation is to determine the target tilt angle of the stylus according to the ratio of the minor axis length to the major axis length; specifically, the target tilt angle is obtained by performing an inverse cosine operation on the ratio of the minor axis length to the major axis length.
[0084] The aforementioned stylus includes: a pen body; an image acquisition unit disposed on the pen body for acquiring an image of the writing surface on which the stylus is located; a beam projection unit disposed on the pen body for projecting a beam onto the writing surface; and a controller disposed in the pen body, communicatively connected to the image acquisition unit, and configured to: acquire the target image acquired by the image acquisition unit; process the target image to obtain parameter information of the light spot in the target image; and determine the target tilt angle of the stylus based on the parameter information of the light spot; wherein the light spot is the projection area generated by the beam emitted by the beam projection unit projected onto the writing surface. In this embodiment, the stylus is configured with an image acquisition unit and a beam projection unit. Based on the light spot projected onto the writing surface by the image acquisition unit or the beam projection unit, and based on the parameter information of the light spot, the tilt angle of the stylus is determined. Since the method of determining the tilt angle is basically unaffected by clock jitter and electromagnetic interference, the accuracy of the determined tilt angle of the stylus is effectively improved.
[0085] In one embodiment, to make the obtained light spot parameter information more accurate, such as Figure 5 As shown, an optional implementation of the controller processing the target image to obtain parameter information of the light spot in the target image includes:
[0086] S501, perform binarization processing on the target image to obtain a binarized image.
[0087] One possible implementation is to pre-set a grayscale threshold, set pixels in the target image with grayscale values greater than the threshold to 255 (white), and set pixels with grayscale values less than or equal to the threshold to 0 (black), thus obtaining a binarized image.
[0088] Another alternative implementation involves dynamically calculating a local threshold based on the average gray level or gray level distribution in the neighborhood of each pixel, then determining whether it is a spot area pixel by pixel, and finally generating a binarized image.
[0089] Another alternative implementation involves iterating through all possible grayscale thresholds, calculating the inter-class variance between the foreground and background, and using the grayscale value that maximizes the inter-class variance as the optimal global threshold to complete image binarization.
[0090] S502, Based on the binarized image, determine the boundary information of the edge contour of the light spot.
[0091] One possible implementation involves obtaining the coordinate information of each feature point on the edge contour of the light spot in the binarized image. Based on the coordinate information of each feature point on the edge contour, the boundary information of the edge contour of the light spot is determined.
[0092] Another alternative implementation involves performing Canny edge detection on the binarized image to directly obtain the set of edge pixels of the light spot. This set of edge pixels is then used as the boundary information of the light spot's edge contour.
[0093] Another alternative implementation involves using horizontal and vertical convolution operators to calculate the image gradient, extracting the edges based on the gradient magnitude, and then obtaining the boundary information of the edge contour of the light spot.
[0094] S503, based on the boundary information, uses the least squares ellipse fitting algorithm to determine the parameter information of the light spot.
[0095] One possible implementation involves substituting all contour points of the light spot boundary into a general quadratic ellipse equation, and then solving for the optimal ellipse parameters by constructing a least-squares error function. These optimal ellipse parameters are then used as the parameter information for the light spot. Specifically, by minimizing the sum of the squared geometric distances from all contour points to the ellipse, the ellipse that best fits the light spot boundary is obtained, thereby outputting the center, major axis, minor axis, and orientation angle.
[0096] Another optional implementation involves assigning weights based on the confidence level of the contour points, with points closer to the ideal edge receiving greater weights and noise points receiving smaller weights. Then, a least-squares solution is performed to obtain the ellipse parameter information, which is then used as the parameter information for the light spot. In this embodiment, high-quality contour points have a greater impact on the fitting result, while noise points have a smaller impact, making the final ellipse closer to the actual light spot shape.
[0097] This embodiment employs binarization of the target image, extraction of the light spot edge contour, and acquisition of light spot parameter information through a least-squares ellipse fitting algorithm. This effectively suppresses environmental noise and background interference, quickly and accurately separates the light spot region, and extracts its geometric contour. Least-squares ellipse fitting can perform optimal mathematical fitting on the light spot contour, improving the detection accuracy and stability of parameters such as the major axis, minor axis, center, and orientation angle of the light spot. This provides reliable data support for the subsequent accurate calculation of the stylus tilt angle. At the same time, the algorithm has low complexity and fast processing speed, which is beneficial to improving the real-time performance and reliability of stylus tilt detection.
[0098] Based on the above embodiments, in order to more accurately determine the tilt angle of the stylus, such as Figure 6 As shown, the controller determines the target tilt angle of the stylus based on the ratio of the minor axis length to the major axis length. Possible implementations include:
[0099] S601, determine the first tilt angle based on the ratio of the minor axis length to the major axis length.
[0100] Optionally, in this embodiment, the ratio of the minor axis length to the major axis length is calculated using an inverse cosine to obtain the first tilt angle. For example... Figure 7 As shown, when the stylus is perpendicular to the writing plane, the shape of the light spot is as follows: Figure 7 As shown in the left image, the shape of the light spot when the stylus is tilted is as follows: Figure 7 As shown in the right-hand figure, the first tilt angle can be determined using the following formula: cos(θ)=a / b; where b is the length of the major axis; a is the length of the minor axis; and θ is the first tilt angle.
[0101] S602, determine the second tilt angle based on the position information of the light spot on the target image.
[0102] Optionally, in this embodiment, the location information is the coordinate information of the center point of the light spot.
[0103] One optional implementation involves determining a second tilt angle based on the position information of the light spot on the target image and a list of tilt angles. The list of tilt angles includes various position information and the corresponding tilt angle for each position.
[0104] Another optional implementation involves determining the offset between the light spot and the center position of the target image based on the position information of the light spot on the target image and the center position of the target image. A second tilt angle is then determined based on this offset. Figure 1As shown, the beam projection unit and the image acquisition unit are located on both sides of the pen tip with a certain distance between them. Therefore, when the stylus is tilted, the distance and deviation parameters (X-axis deviation and Y-axis deviation) between the center of the light spot and the center of the image are not the same. Therefore, the second tilt angle can be determined based on the deviation. In this embodiment, an optional implementation method for determining the offset between the light spot and the center position of the target image based on the position information of the light spot on the target image and the center position of the target image is as follows: Figure 8 As shown, a gridding algorithm is used to determine the first center coordinates of the light spot's center position and the second center coordinates of the target image's center position (e.g., the origin). Based on these coordinates, the offset between the center position of the light spot and the center position of the target image is determined; this offset includes X-axis and Y-axis offsets. A second tilt angle is determined based on the offsets and an offset list. The offset list records each offset and its corresponding tilt angle.
[0105] S603, determine the target tilt angle of the stylus based on the first tilt angle and the second tilt angle.
[0106] One alternative implementation is to use the average of the first tilt angle and the second tilt angle as the target tilt angle of the stylus.
[0107] Another optional implementation involves weighted summation of the first tilt angle and the second tilt angle to obtain the target tilt angle of the stylus. Specifically, the image quality of the target image is acquired, and a first weight corresponding to the first tilt angle is determined based on the image quality. The difference between the value 1 and the first weight is used as the second weight corresponding to the second tilt angle. Based on the first and second weights, the first tilt angle and the second tilt angle are weighted and summed to obtain the summation result. The summation result is used as the target tilt angle of the stylus. In this embodiment, an optional implementation for acquiring the image quality of the target image is to acquire the sharpness of the target image and determine the image quality based on the sharpness. Another optional implementation involves acquiring the contour width of the obtained boundary contour and determining the image quality based on the contour width and width range. Each width range corresponds to a quality score; generally, the wider the contour width, the worse the image quality.
[0108] In this embodiment, the first tilt angle is obtained based on the ratio of the major and minor axes of the light spot, and the second tilt angle is obtained based on the position information of the light spot. The two are then fused to determine the final target tilt angle. This fully integrates the high precision of geometric projection calculation with the high stability of position offset detection, achieving complementary advantages. It effectively suppresses the problem that a single detection method is easily affected by noise, surface texture, or installation errors, significantly improving the accuracy, robustness, and reliability of stylus tilt angle detection. At the same time, it can adapt to different tilt angles and complex usage environments, improving the overall detection effect.
[0109] In one embodiment, such as Figure 9 As shown, a stylus tilt angle detection method is applied to a stylus controller. One optional implementation of this method is as follows:
[0110] S901, acquire the target image acquired by the image acquisition unit. The image acquisition unit is a CMOS camera unit.
[0111] S902, perform binarization processing on the target image to obtain a binarized image.
[0112] S903, based on the binarized image, determine the boundary information of the edge contour of the light spot. The light spot is the projection area generated by the light beam emitted by the beam projection unit projecting onto the writing plane.
[0113] S904. Based on the boundary information, a least-squares ellipse fitting algorithm is used to determine the parameter information of the light spot. The parameter information of the light spot includes the major axis length and minor axis length of the ellipse corresponding to the edge contour of the light spot.
[0114] S905, perform an inverse cosine operation on the ratio of the minor axis length to the major axis length to obtain the first tilt angle.
[0115] S906, based on the position information of the light spot on the target image and the center position of the target image, determine the offset between the light spot and the center position of the target image.
[0116] S907, determine the second tilt angle based on the offset.
[0117] S908 performs a weighted summation of the first tilt angle and the second tilt angle to obtain the target tilt angle of the stylus.
[0118] This embodiment acquires a target image captured by an image acquisition unit; processes the target image to obtain parameter information of the light spot in the target image; and determines the target tilt angle of the stylus based on the parameter information of the light spot. The light spot is the projection area generated by the light beam emitted by the beam projection unit projected onto the writing plane. In this embodiment, the stylus is equipped with an image acquisition unit and a beam projection unit. Based on the light spot projected onto the writing plane by the image acquisition unit or the beam projection unit, and based on the parameter information of the light spot, the tilt angle of the stylus is determined. Since the method of determining the tilt angle is largely unaffected by clock jitter and electromagnetic interference, the accuracy of the determined tilt angle of the stylus is effectively improved.
[0119] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0120] Based on the same inventive concept, this application also provides a stylus tilt angle detection device for implementing the stylus tilt angle detection method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations of one or more stylus tilt angle detection device embodiments provided below can be found in the limitations of the stylus tilt angle detection method described above, and will not be repeated here.
[0121] In one embodiment, such as Figure 10 As shown, a stylus tilt angle detection device 1 is provided, disposed in the stylus controller, including: an acquisition module 10, a first determination module 20, and a second determination module 30, wherein:
[0122] The acquisition module 10 is used to acquire a target image; wherein the target image is acquired by an image acquisition unit located on the stylus.
[0123] The first determining module 20 is used to determine the parameter information of the light spot in the target image; wherein, the light spot is the projection area generated by the light beam emitted by the beam projection unit projected onto the writing plane; the beam projection unit is disposed on the stylus;
[0124] The second determining module 30 is used to determine the target tilt angle of the stylus based on the parameter information of the light spot.
[0125] The stylus tilt angle detection device in this embodiment acquires a target image captured by an image acquisition unit; processes the target image to obtain parameter information of the light spot in the target image; and determines the target tilt angle of the stylus based on the parameter information of the light spot. The light spot is the projection area generated by the light beam emitted by the beam projection unit projected onto the writing plane. In this embodiment, the stylus is equipped with an image acquisition unit and a beam projection unit. Based on the light spot projected onto the writing plane by the image acquisition unit or the beam projection unit, and based on the parameter information of the light spot, the tilt angle of the stylus is determined. Since the method of determining the tilt angle is largely unaffected by clock jitter and electromagnetic interference, the accuracy of the determined stylus tilt angle is effectively improved.
[0126] In one embodiment, the first determining module is further specifically used for:
[0127] The target image is binarized to obtain a binary image; and
[0128] Based on the binarized image, determine the boundary information of the edge contour of the light spot;
[0129] Based on the boundary information, the least squares ellipse fitting algorithm is used to determine the parameter information of the light spot.
[0130] In one embodiment, the parameter information of the light spot includes the length of the major axis and the length of the minor axis of the ellipse corresponding to the edge contour of the light spot; the second determining module is further specifically used for:
[0131] The target tilt angle of the stylus is determined based on the ratio of the minor axis length to the major axis length.
[0132] In one embodiment, the second determining module is further specifically used for:
[0133] The first tilt angle is determined based on the ratio of the minor axis length to the major axis length;
[0134] Based on the position information of the light spot on the target image, determine the second tilt angle; and
[0135] The target tilt angle of the stylus is determined based on the first tilt angle and the second tilt angle.
[0136] In one embodiment, the second determining module is further specifically used for:
[0137] Based on the position information of the light spot on the target image and the center position of the target image, determine the offset between the light spot and the center position of the target image; and
[0138] Determine the second tilt angle based on the offset.
[0139] In one embodiment, the second determining module is further specifically used for:
[0140] The first tilt angle is obtained by performing an inverse cosine operation on the ratio of the minor axis length to the major axis length.
[0141] Each module in the aforementioned stylus tilt angle detection device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0142] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0143] Acquire the target image captured by the image acquisition unit;
[0144] The target image is processed to obtain parameter information of the light spot in the target image; wherein, the light spot is the projection area generated by the beam emitted by the beam projection unit projected onto the writing plane; and
[0145] Based on the parameter information of the light spot, determine the target tilt angle of the stylus.
[0146] In one embodiment, when the processor executes the computer program, it further performs the following steps: processing the target image to obtain parameter information of the light spot in the target image, including:
[0147] The target image is binarized to obtain a binary image;
[0148] Based on the binarized image, determine the boundary information of the light spot's edge contour; and
[0149] Based on the boundary information, the least squares ellipse fitting algorithm is used to determine the parameter information of the light spot.
[0150] In one embodiment, when the processor executes the computer program, it further implements the following steps: the parameter information of the light spot includes the length of the major axis and the length of the minor axis of the ellipse corresponding to the edge contour of the light spot;
[0151] Based on the parameter information of the light spot, determine the target tilt angle of the stylus, including:
[0152] The target tilt angle of the stylus is determined based on the ratio of the minor axis length to the major axis length.
[0153] In one embodiment, when the processor executes the computer program, it further performs the following steps: determining the target tilt angle of the stylus based on the ratio of the minor axis length to the major axis length, including:
[0154] The first tilt angle is determined based on the ratio of the minor axis length to the major axis length;
[0155] Based on the position information of the light spot on the target image, determine the second tilt angle; and
[0156] The target tilt angle of the stylus is determined based on the first tilt angle and the second tilt angle.
[0157] In one embodiment, when the processor executes the computer program, it further performs the following steps: determining a second tilt angle based on the position information of the light spot on the target image, including:
[0158] Based on the position information of the light spot on the target image and the center position of the target image, determine the offset between the light spot and the center position of the target image; and
[0159] Determine the second tilt angle based on the offset.
[0160] In one embodiment, when the processor executes the computer program, it further performs the following steps: determining a first tilt angle based on the ratio of the minor axis length to the major axis length, including:
[0161] The first tilt angle is obtained by performing an inverse cosine operation on the ratio of the minor axis length to the major axis length.
[0162] In one embodiment, when the processor executes the computer program, it further implements the following steps: when determining the target tilt angle of the stylus based on the first tilt angle and the second tilt angle, it is configured to:
[0163] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0164] Acquire the target image captured by the image acquisition unit;
[0165] The target image is processed to obtain parameter information of the light spot in the target image; wherein, the light spot is the projection area generated by the beam emitted by the beam projection unit projected onto the writing plane; and
[0166] Based on the parameter information of the light spot, determine the target tilt angle of the stylus.
[0167] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: processing the target image to obtain parameter information of the light spots in the target image, including:
[0168] The target image is binarized to obtain a binary image;
[0169] Based on the binarized image, determine the boundary information of the light spot's edge contour; and
[0170] Based on the boundary information, the least squares ellipse fitting algorithm is used to determine the parameter information of the light spot.
[0171] In one embodiment, when the computer program is executed by the processor, it further implements the following steps: the parameter information of the light spot includes the length of the major axis and the length of the minor axis of the ellipse corresponding to the edge contour of the light spot;
[0172] Based on the parameter information of the light spot, determine the target tilt angle of the stylus, including:
[0173] The target tilt angle of the stylus is determined based on the ratio of the minor axis length to the major axis length.
[0174] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: determining the target tilt angle of the stylus based on the ratio of the minor axis length to the major axis length, including:
[0175] The first tilt angle is determined based on the ratio of the minor axis length to the major axis length;
[0176] Based on the position information of the light spot on the target image, determine the second tilt angle; and
[0177] The target tilt angle of the stylus is determined based on the first tilt angle and the second tilt angle.
[0178] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: determining a second tilt angle based on the position information of the light spot on the target image, including:
[0179] Based on the position information of the light spot on the target image and the center position of the target image, determine the offset between the light spot and the center position of the target image; and
[0180] Determine the second tilt angle based on the offset.
[0181] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: determining a first tilt angle based on the ratio of the minor axis length to the major axis length, including:
[0182] The first tilt angle is obtained by performing an inverse cosine operation on the ratio of the minor axis length to the major axis length.
[0183] In one embodiment, when the computer program is executed by the processor, it further implements the following steps: when determining the target tilt angle of the stylus based on the first tilt angle and the second tilt angle, it is configured to:
[0184] The first tilt angle and the second tilt angle are weighted and summed to determine the target tilt angle of the stylus.
[0185] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:
[0186] Acquire the target image captured by the image acquisition unit;
[0187] The target image is processed to obtain parameter information of the light spot in the target image; wherein, the light spot is the projection area generated by the beam emitted by the beam projection unit projected onto the writing plane; and
[0188] Based on the parameter information of the light spot, determine the target tilt angle of the stylus.
[0189] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: processing the target image to obtain parameter information of the light spots in the target image, including:
[0190] The target image is binarized to obtain a binary image;
[0191] Based on the binarized image, determine the boundary information of the light spot's edge contour; and
[0192] Based on the boundary information, the least squares ellipse fitting algorithm is used to determine the parameter information of the light spot.
[0193] In one embodiment, when the computer program is executed by the processor, it further implements the following steps: the parameter information of the light spot includes the length of the major axis and the length of the minor axis of the ellipse corresponding to the edge contour of the light spot;
[0194] Based on the parameter information of the light spot, determine the target tilt angle of the stylus, including:
[0195] The target tilt angle of the stylus is determined based on the ratio of the minor axis length to the major axis length.
[0196] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: determining the target tilt angle of the stylus based on the ratio of the minor axis length to the major axis length, including:
[0197] The first tilt angle is determined based on the ratio of the minor axis length to the major axis length;
[0198] Based on the position information of the light spot on the target image, determine the second tilt angle; and
[0199] The target tilt angle of the stylus is determined based on the first tilt angle and the second tilt angle.
[0200] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: determining a second tilt angle based on the position information of the light spot on the target image, including:
[0201] Based on the position information of the light spot on the target image and the center position of the target image, determine the offset between the light spot and the center position of the target image; and
[0202] Determine the second tilt angle based on the offset.
[0203] In one embodiment, when the computer program is executed by a processor, it further performs the following steps: determining a first tilt angle based on the ratio of the minor axis length to the major axis length, including:
[0204] The first tilt angle is obtained by performing an inverse cosine operation on the ratio of the minor axis length to the major axis length.
[0205] In one embodiment, when the computer program is executed by the processor, it further implements the following steps: when determining the target tilt angle of the stylus based on the first tilt angle and the second tilt angle, it is configured to:
[0206] The first tilt angle and the second tilt angle are weighted and summed to determine the target tilt angle of the stylus.
[0207] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0208] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0209] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A stylus, characterized in that, include: Pen body; An image acquisition unit is disposed on the pen body and is used to acquire images of the writing plane on which the stylus is located. A beam projection unit, disposed on the pen body, is used to project a beam onto the writing surface; as well as A controller, located within the pen body, is communicatively connected to the image acquisition unit, and the controller is configured to: Acquire the target image acquired by the image acquisition unit; The target image is processed to obtain parameter information of the light spot in the target image; wherein, the light spot is the projection area generated by the light beam emitted by the light beam projection unit projected onto the writing plane; and Based on the parameter information of the light spot, the target tilt angle of the stylus is determined.
2. The stylus according to claim 1, characterized in that, When the controller processes the target image to obtain parameter information of the light spots in the target image, it is configured as follows: The target image is binarized to obtain a binarized image; Based on the binarized image, determine the boundary information of the edge contour of the light spot; and Based on the boundary information, the parameter information of the light spot is determined using a least-squares ellipse fitting algorithm.
3. The stylus according to claim 1 or 2, characterized in that, The parameter information of the light spot includes the length of the major axis and the length of the minor axis of the ellipse corresponding to the edge contour of the light spot; When the controller determines the target tilt angle of the stylus based on the parameter information of the light spot, it is configured to: The target tilt angle of the stylus is determined based on the ratio of the minor axis length to the major axis length.
4. The stylus according to claim 3, characterized in that, When the controller determines the target tilt angle of the stylus based on the ratio of the minor axis length to the major axis length, it is configured to: The first tilt angle is determined based on the ratio of the minor axis length to the major axis length; The second tilt angle is determined based on the position information of the light spot on the target image; as well as The target tilt angle of the stylus is determined based on the first tilt angle and the second tilt angle.
5. The stylus according to claim 4, characterized in that, When the controller determines the second tilt angle based on the position information of the light spot on the target image, it is configured to: Based on the position information of the light spot on the target image and the center position of the target image, determine the offset between the light spot and the center position of the target image; as well as The second tilt angle is determined based on the offset.
6. The stylus according to claim 4, characterized in that, When the controller determines the first tilt angle based on the ratio of the minor axis length to the major axis length, it is configured as follows: The first tilt angle is obtained by performing an inverse cosine operation on the ratio of the minor axis length to the major axis length.
7. The stylus according to claim 4, characterized in that, When the controller determines the target tilt angle of the stylus based on the first tilt angle and the second tilt angle, it is configured to: The target tilt angle of the stylus is obtained by weighted summation of the first tilt angle and the second tilt angle.
8. A method for detecting the tilt angle of a stylus, characterized in that, A controller applied to a stylus, the method comprising: Acquire a target image; wherein the target image is acquired by an image acquisition unit located on the stylus; Determine the parameter information of the light spot in the target image; wherein, the light spot is the projection area generated by the light beam emitted by the beam projection unit projected onto the writing plane; the beam projection unit is disposed on the stylus; and Based on the parameter information of the light spot, the target tilt angle of the stylus is determined.
9. A stylus tilt angle detection device, characterized in that, The device, located in the controller of the stylus, includes: An acquisition module is used to acquire a target image; wherein the target image is acquired by an image acquisition unit located on the stylus; A first determining module is used to determine parameter information of a light spot in the target image; wherein the light spot is a projection area generated by a light beam emitted by a beam projection unit projected onto a writing plane; the beam projection unit is disposed on the stylus; and The second determining module is used to determine the target tilt angle of the stylus based on the parameter information of the light spot.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the stylus tilt angle detection method according to claim 8.