Angle correction method and device for inclined text, equipment and medium

By obtaining the standard trajectory points of the text to be corrected and performing correction angle optimization processing, the problems of large overhead and low accuracy of tilted text correction in the prior art are solved, and more efficient and accurate text correction is achieved.

CN120562378APending Publication Date: 2025-08-29GUANGZHOU SHIYUAN ELECTRONICS CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410212587.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-02-27
Publication Date
2025-08-29

AI Technical Summary

Technical Problem

In the prior art, the tilted text correction method requires a large amount of data annotation and has a large calculation overhead, resulting in low accuracy of correction results, especially in a small range of text in a vertical direction with low accuracy.

Method used

By obtaining the standard trajectory points of the text to be corrected, performing at least one correction angle optimization process, determining the optimal angle based on the distribution information of the standard trajectory points, and text correction is performed using the last correction angle as the final correction angle.

Benefits of technology

It reduces computing power overhead, improves the accuracy and scope of application of correction results, and can determine the optimal text correction angle without calculating a large amount of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120562378A_ABST
    Figure CN120562378A_ABST
Patent Text Reader

Abstract

The invention discloses an inclined text angle correction method and device, equipment and a medium. The invention belongs to the technical field of image processing. The method comprises the following steps: acquiring a standard track point of a to-be-corrected text; performing at least one correction angle optimization processing on the to-be-corrected text, in each correction angle optimization processing, obtaining an optimal angle based on the distribution information of the standard track points, and taking a result of the last correction angle optimization processing as a final correction angle; and performing angle correction on the to-be-corrected text by adopting the final correction angle. By adopting the technical scheme, the problems of high computing power overhead and low correction result precision in the process of correcting the inclined text can be solved, the optimal text correction angle can be determined without calculating a large amount of data, the computing power overhead in the process of correcting the inclined text is reduced, and the correction accuracy of the inclined text is improved. And moreover, the application range of inclined text correction is wider, and the accuracy of a correction result is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of image processing technology, and specifically relates to a method, device, equipment and medium for correcting the angle of tilted text. Background Art

[0002] With the advancement of technology, the use of various large and small intelligent terminal devices is becoming increasingly popular, such as smartphones, smart TVs, and large conference display panels. When users input text by handwriting, issues such as handwriting angle and writing habits can cause the input text to be tilted. For example, although a line of text is horizontal, each character may be tilted to the left at a certain angle, or the entire line of text may be higher on the right and lower on the left, with each character also tilted at a certain angle. To improve the accuracy of text recognition, it is very important to correct the angle of the input text.

[0003] In related technologies, the main method for correcting tilted text angles is to first render the text as an image and then correct the image. This includes manually collecting a large amount of handwritten tilted text at different angles, labeling it, and then training a deep neural network. This large amount of labeled data is then used to train a model to recognize text tilt angles. Furthermore, the method uses projection, Hough transform, and Fourier transform to project the text image at different angles and obtain the tilt angle corresponding to the minimum projection value.

[0004] Because the existing technology uses deep learning training models to correct tilted text, it is necessary to collect a large amount of labeled data. Not only is the data annotation time costly, but the model angle prediction results are also greatly affected by the data annotation quality. There is a problem of low detection accuracy of tilt angles, especially small-scale vertical text tilt angles, which leads to low accuracy of tilted text correction results. At the same time, when using text image projection to correct tilted text, there is a problem of high correction computing power overhead due to the need to project the entire image. Summary of the Invention

[0005] The purpose of the embodiments of the present application is to provide a method, device, equipment and medium for angle correction of tilted text, which can solve the problems of high computing power overhead and low correction result accuracy when correcting tilted text. By obtaining the standard trajectory points of the text to be corrected and performing at least one correction angle optimization process on the text to be corrected, in each correction angle optimization process, the optimal angle is obtained based on the distribution information of the standard trajectory points, and the result of the last correction angle optimization process is used as the final correction angle, and then the final correction angle is used to perform angle correction on the text to be corrected. The optimal text correction angle can be determined without calculating a large amount of data, thereby reducing the computing power overhead in the tilted text correction process, and the application range of tilted text correction is wider, thereby improving the accuracy of the correction result.

[0006] In a first aspect, an embodiment of the present application provides a method for correcting an angle of tilted text, the method comprising:

[0007] Obtain the standard trajectory points of the text to be corrected;

[0008] Performing at least one correction angle optimization process on the text to be corrected, obtaining an optimal angle based on the distribution information of the standard trajectory points in each correction angle optimization process, and using the result of the last correction angle optimization process as the final correction angle;

[0009] The final correction angle is used to perform angle correction on the text to be corrected.

[0010] The technical effect of this solution is that it can solve the problems of high computing power overhead and low correction result accuracy when correcting tilted text. By obtaining the standard trajectory points of the text to be corrected, the correction angle of the text to be corrected is optimized, and the optimal angle is determined based on the distribution information of the standard trajectory points. Then, the angle of the text to be corrected is corrected using the optimal correction angle. The optimal text correction angle can be determined without calculating a large amount of data, reducing the computing power overhead in the tilted text correction process, and the application range of tilted text correction is wider, thereby improving the accuracy of the correction results.

[0011] Furthermore, the standard trajectory points of the text to be corrected are obtained, including:

[0012] Get the initial trajectory points of the text to be corrected;

[0013] Performing regularization processing based on the initial trajectory points to obtain regularized trajectory points;

[0014] The stroke trajectory is resampled based on the regularized trajectory points to obtain standard trajectory points of the text to be corrected.

[0015] The technical effect of this solution is that by obtaining the initial trajectory points of the text to be corrected, performing regularization processing based on the initial trajectory points to obtain regularized trajectory points, and resampling the stroke trajectories based on the regularized trajectory points to obtain standard trajectory points of the text to be corrected, the standardization and reliability of the sampling of the text to be corrected can be improved.

[0016] Furthermore, regularization processing is performed based on the initial trajectory points to obtain regularized trajectory points, including:

[0017] Get the coordinate information of each initial trajectory point;

[0018] Determine the coordinate origin based on the coordinate information of all initial trajectory points;

[0019] Determine the coordinate transformation ratio of each initial trajectory point based on the coordinate origin and the preset target height;

[0020] The coordinate information of each initial trajectory point is proportionally transformed according to the coordinate transformation ratio to obtain a regularized trajectory point.

[0021] The technical effect of this solution is that by obtaining the coordinate information of each initial trajectory point, determining the coordinate origin, and determining the coordinate transformation ratio of each initial trajectory point based on the coordinate origin and the pre-set target height, and then performing proportional transformation on the coordinate information of each initial trajectory point to obtain the regularized trajectory point, the purpose of regularizing the initial trajectory points of each text to be corrected can be achieved, thereby improving the standardization of the stroke distribution in each text to be corrected.

[0022] Furthermore, the text to be corrected is subjected to at least one correction angle optimization process, and in each correction angle optimization process, an optimal angle is obtained based on the distribution information of the standard trajectory points, including:

[0023] Determining at least two candidate angle values ​​based on the angle range and incremental step size in the first correction angle optimization process;

[0024] For each candidate angle value, the coordinates of the standard trajectory point are transformed using the preset transformation rules to obtain the transformed trajectory point;

[0025] Determining the optimal angle for the first correction angle optimization process based on the distribution information of the transformation trajectory points on the horizontal and vertical coordinates;

[0026] According to the optimal angle of the first correction angle optimization process and the pre-set angle range and incremental step in the next correction angle optimization process, the optimal angle of the next correction angle optimization process is determined until the optimal angle of the last correction angle optimization process is obtained as the final correction angle.

[0027] The technical effect of this solution is that by continuously narrowing the range of the optimal angle and the incremental step size through a cyclic optimization method, the accuracy of obtaining the optimal angle can be improved, thereby improving the reliability of the correction of the corrected text.

[0028] Furthermore, for each candidate angle value, the coordinates of the standard trajectory points are transformed using a preset transformation rule, including:

[0029] The following formula is used to transform the coordinates of the standard trajectory points:

[0030]

[0031] Among them, x is the horizontal coordinate of the standard trajectory point, y is the vertical coordinate of the standard trajectory point, α1 is the current candidate angle value, and x warp is the horizontal coordinate of the transformation trajectory point, y warp is the vertical coordinate of the transformation trajectory point.

[0032] The technical effect of this solution is that by using the coordinate transformation formula of keeping the vertical coordinate unchanged and rotating the horizontal coordinate to transform the standard trajectory points, the standard trajectory points can be compressed into a denser range, which is conducive to the analysis of the distribution of the standard trajectory points.

[0033] Furthermore, the angle range in the next correction angle optimization process is twice the incremental step size of the previous correction angle optimization process;

[0034] The center angle in the next correction angle optimization process is the optimal angle of the previous correction angle optimization process.

[0035] The technical effect of this scheme is that by setting the angle range size in the next correction angle optimization processing to twice the incremental step size of the previous correction angle optimization processing, and the center angle in the next correction angle optimization processing to the optimal angle of the previous correction angle optimization processing, the correction angle can be further optimized based on the optimal angle obtained in the previous optimization processing, thereby improving the reliability of determining the optimal angle, and thereby improving the reliability of correcting the text.

[0036] Furthermore, determining the optimal angle of the first correction angle optimization process according to the distribution information of the transformation trajectory points on the horizontal and vertical coordinates includes:

[0037] sorting the coordinates of the transformation trajectory points according to the horizontal coordinates, and constructing a column array with the transformation trajectory points having the same horizontal coordinates;

[0038] Calculate the column array index values ​​for the column arrays that meet the preset statistical conditions, and add them up to obtain the sum of the index values ​​of the current candidate angle values;

[0039] Traverse each candidate angle value and take the one with the largest sum of index values ​​among the candidate angle values ​​as the optimal angle for the first correction angle optimization process.

[0040] The technical effect of this solution is that by sorting the coordinates of the transformation trajectory points according to the horizontal coordinates and calculating the sum of the index values ​​of the transformation trajectory point array with the same horizontal coordinate, the angle with the largest sum of the index values ​​among the candidate angle values ​​is used as the optimal angle for the first correction angle optimization processing, which can achieve the purpose of determining the optimal correction angle according to the distribution of the transformation trajectory points and improve the reliability of the correction angle optimization.

[0041] Furthermore, the preset statistical condition includes: the ratio of the number of transformation trajectory points in the column array to the vertical coordinate span of the column array is greater than a set threshold.

[0042] The technical effect of this solution is that by using the ratio of the number of transformation trajectory points in the column array to the vertical coordinate span of the column array to be less than a set threshold as a preset statistical condition, the transformation trajectory points that are evenly and densely distributed in the same horizontal coordinate can be screened out, thereby reducing the computing power overhead of the subsequent optimal angle calculation and improving the reliability of the text correction.

[0043] Furthermore, the column array index value is calculated for the column arrays that meet the preset statistical conditions, including:

[0044] If the current column array meets the preset statistical conditions, the square of the number of transformation trajectory points in the current column array is used as the column array index value of the current column array.

[0045] The technical effect of this solution is that by taking the square of the number of transformation trajectory points in the column array that meets the preset statistical conditions as the column array index value of the current column array, the distribution of the transformation trajectory points under the current column array can be clearly reflected, thereby improving the reliability of determining the optimal angle.

[0046] Furthermore, the text to be corrected is the text of the current text line;

[0047] Performing angle correction on the text to be corrected using the final correction angle includes:

[0048] The final correction angle is used to perform angle correction on all text to be corrected in the current text line.

[0049] The technical benefit of this solution is that by performing angle correction on the text to be corrected line by line, correction errors caused by different tilt directions of multiple lines of text can be avoided, thereby improving the reliability of the correction of the text to be corrected. At the same time, performing angle correction on the same text line at once can improve correction efficiency.

[0050] In a second aspect, an embodiment of the present application provides a device for correcting an angle of tilted text, the device comprising:

[0051] A standard trajectory point acquisition module is used to obtain the standard trajectory points of the text to be corrected;

[0052] a correction angle determination module, configured to perform at least one correction angle optimization process on the text to be corrected, wherein in each correction angle optimization process, an optimal angle is obtained based on the distribution information of the standard trajectory points, and the result of the last correction angle optimization process is used as the final correction angle;

[0053] An angle correction module is used to perform angle correction on the text to be corrected using the final correction angle.

[0054] The technical effect of this solution is that it can solve the problems of high computing power overhead and low correction result accuracy when correcting tilted text. By obtaining the standard trajectory points of the text to be corrected, the correction angle of the text to be corrected is optimized, and the optimal angle is determined based on the distribution information of the standard trajectory points. Then, the angle of the text to be corrected is corrected using the optimal correction angle. The optimal text correction angle can be determined without calculating a large amount of data, reducing the computing power overhead in the tilted text correction process, and the application range of tilted text correction is wider, thereby improving the accuracy of the correction results.

[0055] In a third aspect, an embodiment of the present application provides an electronic device comprising 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.

[0056] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0057] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the method described in the first aspect.

[0058] In an embodiment of the present application, the standard trajectory points of the text to be corrected are obtained; the text to be corrected is subjected to at least one correction angle optimization process, and in each correction angle optimization process, the optimal angle is obtained based on the distribution information of the standard trajectory points, and the result of the last correction angle optimization process is used as the final correction angle; the text to be corrected is angle-corrected using the final correction angle. The above-mentioned angle correction method for tilted text can solve the problems of high computing power overhead and low accuracy of correction results when correcting tilted text. By obtaining the standard trajectory points of the text to be corrected and performing at least one correction angle optimization process on the text to be corrected, in each correction angle optimization process, the optimal angle is obtained based on the distribution information of the standard trajectory points, and the result of the last correction angle optimization process is used as the final correction angle, and then the text to be corrected is angle-corrected using the final correction angle. The optimal text correction angle can be determined without calculating a large amount of data, reducing the computing power overhead in the tilted text correction process, and having a wider range of applicability for tilted text correction, thereby improving the accuracy of the correction results. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] Figure 1 1 is a flow chart of a method for correcting the angle of tilted text provided in an embodiment of the present application;

[0060] Figure 2 This is a schematic diagram of a process for obtaining standard trajectory points of a text to be corrected provided in an embodiment of the present application;

[0061] Figure 3 This is a flow chart of the correction angle optimization process provided by an embodiment of the present application;

[0062] Figure 4 2 is a schematic structural diagram of a device for correcting an angle of tilted text provided in an embodiment of the present application;

[0063] Figure 5 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0064] In order to make the purpose, technical solutions and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. It should also be noted that, for ease of description, only parts related to the present application, not all of the contents, are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0065] The following will be combined with the accompanying drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described 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 are within the scope of protection of this application.

[0066] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this application can be implemented in an order other than that illustrated or described herein, and that the objects distinguished by "first," "second," and the like are generally of the same type, and do not limit the number of objects; for example, the first object can be one or more. In addition, the term "and / or" in the specification and claims refers to at least one of the connected objects, and the character " / " generally indicates that the objects connected are in an "or" relationship.

[0067] The following, in conjunction with the accompanying drawings, describes in detail the angle correction method, device, equipment and medium for tilted text provided in the embodiments of the present application through specific embodiments and their application scenarios.

[0068] Currently, most tilt correction methods are targeted at text images. Even online handwritten text trajectories are first rendered into images and then tilt correction is performed.

[0069] There are two main modes for text tilt correction:

[0070] 1. Deep learning-based approach: This method transforms the problem of detecting text image tilt angles into a problem of classifying specific tilt angles. A large amount of handwritten tilted text at different angles is manually collected and annotated, and a deep neural network is built for training. This large amount of annotated data is then used to train a model for recognizing text tilt angles. However, detection accuracy is low for small vertical tilt angles.

[0071] 2. Traditional image algorithms: projection method, Hough transform method, Fourier transform method. The traditional projection method mainly projects the text image at different angles to obtain the tilt angle corresponding to the minimum projection value. This method requires the entire image to be projected, which consumes a lot of computing power and takes a long time to process in actual projects. The Hough transform method can find the corresponding reference point by finding specific features in the spatial target pixels. Although it can obtain high-precision results, it also has a large overhead of time and memory. The Fourier transform method converts the spectrum image between the spatial domain and the frequency domain, which requires Fourier forward and inverse transforms, which is inefficient and not very practical.

[0072] The problem with existing technologies is that the deep learning training model requires a large amount of labeled data, which is costly, and the effectiveness of the model's angle prediction is affected by the quality of the data annotation. At the same time, the detection accuracy is low, especially for vertical tilt within a small range.

[0073] Furthermore, traditional image algorithms, such as projection methods, require the entire image to be projected, which consumes significant computing power and takes a long time to process in real-world applications. While rotating the projection axis instead of the image requires scanning all pixels in the document image, the Hough transform method identifies specific features within the spatial target pixels to find corresponding reference points. This method achieves high accuracy for the entire document, but has lower accuracy for vertical tilt within a small range of a single line, and consumes significant time and memory.

[0074] In the handwritten text recognition process, handwritten text trajectory tilt correction is an extremely important step that directly affects the accuracy of text recognition. Handwritten text trajectory tilt correction must not only consider different writing scenarios, but also take into account the overall operating efficiency of the algorithm. In response to the above two points, this solution proposes a new online handwritten text vertical tilt fast correction method. In view of the characteristics of this scenario, the tilt correction range is limited to the vertical tilt angle between [-α, +α]. Under the dynamic change of different angle search increments, the energy values ​​of all trajectory points at this angle are calculated. The angle corresponding to the maximum energy value is selected as the optimal tilt correction angle in the current range, and then all trajectory points are rotated to obtain the corrected trajectory.

[0075] To improve the effectiveness of online writing trajectory tilt correction, this solution proposes a new, faster method for vertical trajectory tilt correction. Most solutions render online trajectory data as images, employing image-level tilt correction strategies. Drawing images and traversing image-level information calculations are time-consuming. This solution processes the original trajectory points directly, resulting in sparser data and less computational effort. Furthermore, it offers improved results: an energy calculation strategy is proposed to evaluate the optimal tilt angle, along with a coarse-to-fine angle optimization strategy that can be combined with actual scenarios. This allows for precise calculation of the tilt angle while reducing the range of angle optimization, thus reducing the computational effort.

[0076] Figure 1 FIG. 1 is a flow chart of a method for correcting the angle of tilted text provided in an embodiment of the present application. Figure 1 As shown, the specific steps include:

[0077] S101, obtaining standard trajectory points of the text to be corrected;

[0078] First, this solution can be used to correct the angle of tilted text input by handwriting, as well as the problem of text tilt after capturing images of handwritten or machine-entered text. In particular, it is suitable for correcting the angle of online handwritten text that is tilted in the vertical direction.

[0079] Based on the above usage scenarios, it is understandable that the implementation of this application can be intelligent terminals with text recognition, data processing, and text correction capabilities, such as mobile phones, tablet computers, desktop computers, and large conference display panels. These intelligent terminals can be devices that directly receive user handwriting input, such as interactive display panels in classrooms and large conference display panels used to display written text in conference rooms.

[0080] The text to be corrected may be a text input by a user that is tilted at an angle in the vertical direction. The text to be corrected may be offline, such as an image or scan of a paper document, or online, and sensed by a sensor on a special digitizer or a digitizing panel that receives the movement of the pen tip. The same text line of the text to be corrected may be horizontal or tilted. Generally, the tilt angles of the texts in the same text line are the same. The standard trajectory points may be trajectory points obtained by sampling each stroke in the text to be corrected at equal distances according to the stroke direction.

[0081] In one embodiment, the stroke trajectory points in the text to be corrected may be regularized and resampled at equal distances to obtain standard trajectory points of the text to be corrected.

[0082] Specifically, the standard trajectory points of the text to be corrected can be obtained by Figure 2 The steps shown are implemented.

[0083] Figure 2 This is a flow chart of obtaining standard trajectory points of a text to be corrected provided in an embodiment of the present application.

[0084] like Figure 2 As shown, the specific steps include:

[0085] S1011, obtaining the initial trajectory points of the text to be corrected;

[0086] Among them, the initial trajectory points of the text to be corrected can be the trajectory points obtained by sampling each stroke in the text to be corrected according to a certain sampling rate. The sampling rate can be predetermined by the user based on the computing power cost required for correcting the text to be corrected and the accuracy of the correction result, or it can be determined based on the hardware sampling rate of the online writing product itself, which is not limited here. The initial trajectory points of the text to be corrected can be used to calculate the coordinate position, inclination angle, and stroke direction and stroke shape of each stroke in the text to be corrected.

[0087] In one embodiment, the initial trajectory point of the text to be corrected may be determined according to the stroke sampling result of the text to be corrected.

[0088] S1012, performing regularization processing based on the initial trajectory points to obtain regularized trajectory points;

[0089] The regularization process may be a process of scaling the initial trajectory points of the text to be corrected according to their original aspect ratio. The regularized trajectory points may be trajectory points obtained by regularizing the coordinate values ​​of the initial trajectory points. Regularization of the coordinate values ​​of the initial trajectory points can be achieved by regularizing the coordinate values ​​of the initial trajectory points.

[0090] In one embodiment, a coordinate system can be established for all initial trajectory points, and the coordinate values ​​of the initial trajectory points of each stroke in the same line of text to be corrected can be obtained. Based on the coordinate values ​​of the initial trajectory points, the initial trajectory point with the smallest horizontal and vertical coordinates in the text line is determined, and the initial trajectory point is used as the new origin of the text line. The coordinates of other initial trajectory points are subtracted from the coordinate value of this point to obtain the coordinates of the new initial trajectory points aligned with the new origin, and the new initial trajectory point coordinates are scaled according to preset rules to obtain regularized trajectory points. The preset rules can be to scale the initial trajectory points to a certain target height value, and to maintain the original aspect ratio of all the initial trajectory points in the text line during the scaling process.

[0091] In a feasible embodiment, optionally, performing regularization processing based on the initial trajectory points to obtain regularized trajectory points includes:

[0092] Get the coordinate information of each initial trajectory point;

[0093] Determine the coordinate origin based on the coordinate information of all initial trajectory points;

[0094] Determine the coordinate transformation ratio of each initial trajectory point based on the coordinate origin and the preset target height;

[0095] The coordinate information of each initial trajectory point is proportionally transformed according to the coordinate transformation ratio to obtain a regularized trajectory point.

[0096] Among them, the coordinate information of each initial trajectory point can be the coordinate value of each initial trajectory point in the coordinate system established for all the texts to be corrected. The coordinate origin determined based on the coordinate information of all the initial trajectory points can be the initial trajectory point with the smallest coordinate value among the initial trajectory points of the same line of text to be corrected. The pre-set target height can be the height reached by the highest point of the highest text in the text to be corrected in the same line. The target height can be pre-set based on the size of each text in the same line of text to be corrected and the complexity of the text strokes. The coordinate transformation ratio of each initial trajectory point can be determined based on the ratio between the original coordinate value of the highest point and the coordinate value of the target height.

[0097] In one embodiment, the coordinate origin is determined based on the coordinate information of all initial trajectory points. Any initial trajectory point can be used as the coordinate origin, and the new coordinates of each initial trajectory point are determined based on the coordinate origin. The aspect ratio is then determined by the ordinate span and the abscissa span of the new coordinates, and the scaling ratio is determined by the ratio of the ordinate span to the target height. After proportional scaling, the new coordinates of each initial trajectory point can be obtained, which is the regularized trajectory point.

[0098] This solution obtains the coordinate information of each initial trajectory point, determines the coordinate origin, and determines the coordinate transformation ratio of each initial trajectory point based on the coordinate origin and the pre-set target height. Then, the coordinate information of each initial trajectory point is proportionally transformed to obtain the regularized trajectory point. This can achieve the purpose of regularizing the initial trajectory points of each text to be corrected, and improve the standardization of the stroke distribution in each text to be corrected.

[0099] S1013: resampling the stroke trajectory based on the regularized trajectory points to obtain standard trajectory points of the text to be corrected.

[0100] The resampling of the stroke trajectory may be performed by equally spaced sampling of the regularized stroke trajectory according to the trajectory direction, and the standard trajectory points may be sampling points obtained by equally spaced resampling of the stroke trajectory points of the text to be corrected.

[0101] In one embodiment, the stroke trajectory of the text to be corrected after regularization may be determined based on the regularized trajectory points, and the stroke trajectory may be resampled at equal intervals to obtain standard trajectory points of the text to be corrected.

[0102] In one embodiment, due to the inconsistent sampling rates of trajectory points of different hardware products and the different writing speeds of different users during online writing, the distribution of the initial trajectory points in the stroke trajectory of the text to be corrected may be unreliable. Therefore, the initial trajectory points can be regularized in advance, and the regularized stroke trajectory can be sampled at equal intervals to improve the reliability of sampling of the text to be corrected.

[0103] This solution obtains the initial trajectory points of the text to be corrected, performs regularization processing based on the initial trajectory points to obtain regularized trajectory points, and resamples the stroke trajectories based on the regularized trajectory points to obtain standard trajectory points of the text to be corrected. This can improve the standardization and reliability of the sampling of the text to be corrected.

[0104] S102, performing at least one correction angle optimization process on the text to be corrected, wherein in each correction angle optimization process, an optimal angle is obtained based on the distribution information of the standard trajectory points, and the result of the last correction angle optimization process is used as the final correction angle;

[0105] The correction angle may be the angle at which the text to be corrected is rotated. The correction angle optimization process may be a process of rotating the text to be corrected according to a rotation angle range and a preset step size, and determining the optimal correction angle based on the rotation result. For example, the rotation angle range may be -45° to 45°, and the preset step size may be 10°. Thus, an angle sequence may be obtained, namely -45°, -35°, -25°, -15°, -5°, 5°, 15°, 25°, 35°, and 45°.

[0106] The distribution information of the standard trajectory points may be distribution information of the standard trajectory points on the horizontal and vertical coordinates. The distribution information may be determined based on the density of the standard trajectory points within the same coordinate range. The optimal angle may be the rotation angle that minimizes the vertical tilt angle of the text to be corrected. The optimal angle may be determined based on the distribution information of the standard trajectory points, i.e., the rotation angle at which the standard trajectory points are most densely distributed after the text to be corrected is rotated is the optimal angle.

[0107] In one embodiment, the text to be corrected can be subjected to at least one correction angle optimization process according to a preset step size based on the empirical value of the rotation angle and the preset rotation angle. In each correction angle optimization process, the optimal angle is obtained based on the distribution information of the standard trajectory points, and the optimal angle is used as the rotation angle range for the next correction angle optimization process, and further correction angle optimization process is performed. In this way, the correction angle optimization process is cycled until the preset number of optimization processes is reached, and the result of the last correction angle optimization process is used as the final correction angle. The preset number of optimization processes can be preset by the user based on at least one of the correction computing power requirements of the text to be corrected, the degree of inclination of the text, and the correction standard.

[0108] For example, if the optimal angle obtained from the first correction angle optimization process is -25°, then during the second correction angle optimization process, the second correction angle optimization process is performed with a certain step size within the range of -10° to 10°, with -25° as the center. If necessary, after the optimal angle is obtained from the second correction angle optimization process, a third or even fourth correction angle optimization process can be performed, and the optimal angle obtained at the end is used as the final correction angle.

[0109] S103: Perform angle correction on the text to be corrected using the final correction angle.

[0110] In one embodiment, the final correction angle may be used as the rotation angle of the text to be corrected, and the text to be corrected may be controlled to rotate according to the final correction angle.

[0111] In a feasible embodiment, optionally, the text to be corrected is the text of the current text line;

[0112] Performing angle correction on the text to be corrected using the final correction angle includes:

[0113] The final correction angle is used to perform angle correction on all text to be corrected in the current text line.

[0114] The current text line may be a text line where a certain text to be corrected that is currently being corrected is located.

[0115] In one embodiment, the text to be corrected is text in a current text line, and the final correction angle may be used to perform angle correction on all text to be corrected in the current text line.

[0116] This solution, by performing angle correction on the text to be corrected line by line, can avoid correction errors caused by different tilt directions of multiple lines of text, improving the reliability of the correction of the text to be corrected. At the same time, performing angle correction on the same text line at once can improve correction efficiency.

[0117] It can be understood that this solution can use the same angle for correction for the same text line, or when the text inclination angles of the first and second halves of the same text line change, the final correction angles can be determined for the first and second halves respectively, and corrections can be performed separately.

[0118] The technical solution provided by the embodiment of the present application is to obtain the standard trajectory points of the text to be corrected; perform at least one correction angle optimization process on the text to be corrected, and in each correction angle optimization process, obtain the optimal angle based on the distribution information of the standard trajectory points, and use the result of the last correction angle optimization process as the final correction angle; and use the final correction angle to perform angle correction on the text to be corrected. The above-mentioned angle correction method for tilted text can solve the problems of high computing power overhead and low correction result accuracy when correcting tilted text. By obtaining the standard trajectory points of the text to be corrected and performing at least one correction angle optimization process on the text to be corrected, in each correction angle optimization process, obtain the optimal angle based on the distribution information of the standard trajectory points, and use the result of the last correction angle optimization process as the final correction angle, and then use the final correction angle to perform angle correction on the text to be corrected, the optimal text correction angle can be determined without calculating a large amount of data, reducing the computing power overhead in the tilted text correction process, and having a wider range of applicability for tilted text correction, thereby improving the accuracy of the correction result.

[0119] Figure 3 This is a flow chart of the correction angle optimization process provided by the embodiment of the present application. Figure 3 As shown, the specific steps include:

[0120] S201, determining at least two candidate angle values ​​based on the angle range and incremental step size in the first correction angle optimization process;

[0121] Among them, the angle range can be the rotation angle range for controlling the rotation of the text to be corrected. For example: the angle range is [-45°, +45°], which can mean that the angle range for controlling the rotation of the text to be corrected is 45° to the left and right respectively. The angle range can be determined based on the empirical value of the rotation angle and the preset rotation angle. The incremental step can be the angle increment for controlling each rotation of the text to be corrected. The incremental step can be the angle value obtained by evenly dividing the angle range. The candidate angle value can be the rotation angle value when controlling the rotation of the text to be corrected according to the incremental step.

[0122] For example, in multiple correction angle optimization processes, for one of the correction angle optimization processes, the candidate angle value pairs can be rotated to obtain multiple rotation results corresponding to multiple candidate angle values, and a measurement result can be obtained under each rotation result, such as the measured horizontal coordinate distribution, etc., and the measurement results of multiple rotation results can be compared to obtain the optimal angle among the multiple candidate angle values.

[0123] In one embodiment, at least two candidate angle values ​​for rotating the text to be corrected may be determined based on the angle range and incremental step size in the first correction angle optimization process.

[0124] S202, for each candidate angle value, using a preset transformation rule to perform coordinate transformation on the standard trajectory point to obtain a transformed trajectory point;

[0125] The preset transformation rule may be a rule for transforming the coordinate values ​​of the standard trajectory points in the text to be corrected after the text to be corrected is rotated. The preset transformation rule may be a rule for rotating the horizontal coordinates of the standard trajectory points while maintaining the vertical coordinate span of the standard trajectory points unchanged. The transformed trajectory points may be trajectory points obtained by transforming the coordinates of the standard trajectory points according to the preset transformation rule.

[0126] In one embodiment, for each candidate angle value, a preset transformation rule may be used to perform coordinate transformation on the standard trajectory points under different candidate angle values ​​to obtain transformed trajectory points.

[0127] In a feasible embodiment, optionally, for each candidate angle value, a preset transformation rule is used to perform coordinate transformation on the standard trajectory point, including:

[0128] The following formula is used to transform the coordinates of the standard trajectory points:

[0129]

[0130] Among them, x is the horizontal coordinate of the standard trajectory point, y is the vertical coordinate of the standard trajectory point, α1 is the current candidate angle value, and x warp is the horizontal coordinate of the transformation trajectory point, y warp is the vertical coordinate of the transformation trajectory point.

[0131] In one embodiment, the following formula can be used to transform the coordinates of the standard trajectory points:

[0132]

[0133] Among them, x is the horizontal coordinate of the standard trajectory point, y is the vertical coordinate of the standard trajectory point, α1 is the current candidate angle value, and x warp is the horizontal coordinate of the transformation trajectory point, y warpis the vertical coordinate of the transformation trajectory point.

[0134] By using the above formula, the horizontal coordinate of the standard trajectory point can be rotated according to the candidate angle value without changing the vertical coordinate of the standard trajectory point, so as to compress the horizontal coordinate projection of the standard trajectory point more densely, thereby facilitating the analysis of the distribution of the standard trajectory point.

[0135] This scheme transforms the coordinates of the standard trajectory points by adopting a coordinate transformation formula that keeps the vertical coordinate unchanged and rotates the horizontal coordinate. This can compress the standard trajectory points into a denser range, which is beneficial to the analysis of the distribution of the standard trajectory points.

[0136] S203, determining the optimal angle for the first correction angle optimization process based on the distribution information of the transformation trajectory points on the horizontal and vertical coordinates;

[0137] The distribution information of the transformation trajectory points on the horizontal and vertical coordinates can be the number of transformation trajectory points distributed on the same horizontal coordinate; or the number of transformation trajectory points distributed on the same vertical coordinate. This solution mainly corrects text that is tilted in the vertical direction. Therefore, the distribution information of the transformation trajectory points on the horizontal and vertical coordinates can mainly be the number of transformation trajectory points distributed on the same horizontal coordinate.

[0138] The optimal angle may be the rotation angle that is closest to the vertical direction after the text to be corrected is rotated. The optimal angle may be determined based on the distribution information. The denser the distribution of the transformation trajectory points on the same horizontal coordinate but different vertical coordinates, the smaller the tilt angle of the text to be corrected after being rotated according to the angle.

[0139] In one embodiment, the optimal angle of the first correction angle optimization process may be determined according to the distribution density of the transformation trajectory points on the horizontal and vertical coordinates.

[0140] In a feasible embodiment, optionally, determining the optimal angle of the first correction angle optimization process based on the distribution information of the transformation trajectory points on the horizontal and vertical coordinates includes:

[0141] sorting the coordinates of the transformation trajectory points according to the horizontal coordinates, and constructing a column array with the transformation trajectory points having the same horizontal coordinates;

[0142] Calculate the column array index values ​​for the column arrays that meet the preset statistical conditions, and add them up to obtain the sum of the index values ​​of the current candidate angle values;

[0143] Traverse each candidate angle value and take the one with the largest sum of index values ​​among the candidate angle values ​​as the optimal angle for the first correction angle optimization process.

[0144] Among them, the column array can be the vertical coordinate array of the transformation trajectory points under the same horizontal coordinate. The preset statistical condition can be a pre-set condition for screening densely and evenly distributed transformation trajectory points. For example: the ratio of the number of transformation trajectory points in the column array to the vertical coordinate span of the column array is greater than the distribution threshold. The column array index value can be the density value of each of the column arrays. The column array index value can be calculated based on the number of the following arrays under the same horizontal coordinate, for example: the square of the number of transformation trajectory points in the column array under the same horizontal coordinate can be used as the column array index value, and the number of transformation trajectory points in the column array under the same horizontal coordinate can also be used as the column array index value. The sum of the index values ​​can be the sum of the index values ​​of each of the column arrays.

[0145] In one embodiment, the coordinates of the transformation trajectory points can be sorted according to the size of the horizontal coordinates, and a column array can be constructed using the vertical coordinates of the transformation trajectory points with the same horizontal coordinates. For example: {x1: [y1, y3, y4]; x2: [y2]; ...; xn: [y80, y90, yn]}, where the column array corresponding to x1 is [y1, y3, y4]; and the column array corresponding to x2 is [y2].

[0146] In one embodiment, a determination is made as to whether the column arrays satisfy a preset statistical condition based on a threshold of the vertical coordinates in each column array and the number of transformation trajectory points. A column array index value is calculated for each column array that satisfies the preset statistical condition, and each column array index value is summed to obtain the sum of the index values ​​for the current candidate angle value. The sum of the index values ​​for each candidate angle value is traversed, and the candidate angle with the largest sum of the index values ​​among the candidate angle values ​​is selected as the optimal angle for the first correction angle optimization process.

[0147] This scheme, by sorting the coordinates of the transformation trajectory points according to the horizontal coordinates and calculating the sum of the index values ​​of the transformation trajectory point array with the same horizontal coordinate, takes the maximum sum of the index values ​​among the candidate angle values ​​as the optimal angle for the first correction angle optimization processing. This can achieve the purpose of determining the optimal correction angle according to the distribution of the transformation trajectory points, and improve the reliability of the correction angle optimization.

[0148] In a feasible embodiment, optionally, the preset statistical condition includes: a ratio of the number of transformation trajectory points in the column array to the vertical coordinate span of the column array is greater than a set threshold.

[0149] The number of transformation trajectory points in the column array may be the number of transformation trajectory points at the same horizontal coordinate. The vertical coordinate span of the column array may be the difference between the maximum vertical coordinate value and the minimum vertical coordinate value in each column array. The set threshold may be a preset value for determining uniform and dense distribution of transformation trajectory points at the same horizontal coordinate, and may be set to a value between [0, 1]. In this embodiment, the threshold is preferably set to 0.2.

[0150] In one embodiment, the preset statistical condition may be that the ratio of the number of transformation trajectory points in the column array to the vertical coordinate span of the column array is greater than a set threshold. For example:

[0151] k / h>τ;

[0152] Wherein, k is the number of transformation trajectory points in the column array, h is the vertical coordinate span of the column array, and τ is the set threshold.

[0153] This scheme uses the ratio of the number of transformation trajectory points in the column array to the vertical coordinate span of the column array to be less than a set threshold as a preset statistical condition. This can screen out transformation trajectory points that are evenly and densely distributed in the same horizontal coordinate, thereby reducing the computing power overhead of the subsequent optimal angle calculation and improving the reliability of the text correction.

[0154] In a feasible embodiment, optionally, calculating a column array index value for a column array that meets a preset statistical condition includes:

[0155] If the current column array meets the preset statistical conditions, the square of the number of transformation trajectory points in the current column array is used as the column array index value of the current column array.

[0156] In one embodiment, if the current column array meets a preset statistical condition, the square of the number of transformation trajectory points in the current column array may be used as the column array index value of the current column array.

[0157] This solution, by taking the square of the number of transformation trajectory points in the column array that meets the preset statistical conditions as the column array index value of the current column array, can clearly reflect the distribution of the transformation trajectory points under the current column array, thereby improving the reliability of determining the optimal angle.

[0158] S204, based on the optimal angle of the first correction angle optimization process and the pre-set angle range and incremental step size in the next correction angle optimization process, determine the optimal angle of the next correction angle optimization process, until the optimal angle of the last correction angle optimization process is obtained as the final correction angle.

[0159] The preset angle range for the next correction angle optimization process may be a range centered around the optimal angle of the first correction angle optimization process. The size of the angle range for the next correction angle optimization process may be an integer multiple of the incremental step size of the previous correction angle optimization process. The final correction angle may be the optimal angle of the last optimization process, obtained after performing angle optimization according to a preset number of optimizations.

[0160] In one embodiment, the text to be corrected can be rotated based on the optimal angle of the first correction angle optimization processing and the preset angle range and incremental step in the next correction angle optimization processing, and the optimal angle of the next correction angle optimization processing can be determined based on the distribution information of the transformed trajectory points after rotation on the horizontal and vertical coordinates, until the optimal angle of the last correction angle optimization processing is obtained as the final correction angle.

[0161] In a feasible embodiment, optionally, the angle range in the next correction angle optimization process is twice the incremental step size of the previous correction angle optimization process;

[0162] The center angle in the next correction angle optimization process is the optimal angle of the previous correction angle optimization process.

[0163] In one embodiment, the angle range in the next correction angle optimization process may be twice the incremental step size of the previous correction angle optimization process, and the center angle in the next correction angle optimization process is the optimal angle of the previous correction angle optimization process.

[0164] This solution, by setting the angle range size in the next correction angle optimization process to twice the incremental step size of the previous correction angle optimization process, and the center angle in the next correction angle optimization process to the optimal angle of the previous correction angle optimization process, can further optimize the correction angle based on the optimal angle obtained in the previous optimization process, thereby improving the reliability of determining the optimal angle, and thereby improving the reliability of correcting the text.

[0165] The technical solution provided in the embodiment of the present application determines at least two candidate angle values ​​based on the angle range and incremental step size in the first correction angle optimization processing, and for each candidate angle value, uses a preset transformation rule to perform coordinate transformation on the standard trajectory point to obtain a transformed trajectory point, and determines the optimal angle of the first correction angle optimization processing based on the distribution information of the transformed trajectory point on the horizontal and vertical coordinates, and determines the optimal angle of the next correction angle optimization processing based on the optimal angle of the first correction angle optimization processing and the preset angle range and incremental step size in the next correction angle optimization processing, until the optimal angle of the last correction angle optimization processing is obtained as the final correction angle, which can achieve the purpose of continuously narrowing the optimal angle range through cyclic optimization, thereby improving the accuracy of the optimal angle and thereby improving the reliability of the correction of the text to be corrected.

[0166] Figure 4 Schematic diagram of the structure of the angle correction device for tilted text provided in the embodiment of the present application. Figure 4 As shown, specifically including the following:

[0167] The standard trajectory point acquisition module 301 is used to obtain the standard trajectory points of the text to be corrected;

[0168] A correction angle determination module 302 is configured to perform at least one correction angle optimization process on the text to be corrected, wherein in each correction angle optimization process, an optimal angle is obtained based on the distribution information of the standard trajectory points, and the result of the last correction angle optimization process is used as the final correction angle;

[0169] The angle correction module 303 is configured to perform angle correction on the text to be corrected using the final correction angle.

[0170] Furthermore, the standard trajectory point acquisition module 301 is specifically configured to:

[0171] Get the initial trajectory points of the text to be corrected;

[0172] Performing regularization processing based on the initial trajectory points to obtain regularized trajectory points;

[0173] The stroke trajectory is resampled based on the regularized trajectory points to obtain standard trajectory points of the text to be corrected.

[0174] Furthermore, the standard trajectory point acquisition module 301 is specifically configured to:

[0175] Get the coordinate information of each initial trajectory point;

[0176] Determine the coordinate origin based on the coordinate information of all initial trajectory points;

[0177] Determine the coordinate transformation ratio of each initial trajectory point based on the coordinate origin and the preset target height;

[0178] The coordinate information of each initial trajectory point is proportionally transformed according to the coordinate transformation ratio to obtain a regularized trajectory point.

[0179] Furthermore, the correction angle determination module 302 is specifically configured to:

[0180] Determining at least two candidate angle values ​​based on the angle range and incremental step size in the first correction angle optimization process;

[0181] For each candidate angle value, the coordinates of the standard trajectory point are transformed using the preset transformation rules to obtain the transformed trajectory point;

[0182] Determining the optimal angle for the first correction angle optimization process based on the distribution information of the transformation trajectory points on the horizontal and vertical coordinates;

[0183] According to the optimal angle of the first correction angle optimization process and the pre-set angle range and incremental step in the next correction angle optimization process, the optimal angle of the next correction angle optimization process is determined until the optimal angle of the last correction angle optimization process is obtained as the final correction angle.

[0184] Furthermore, the correction angle determination module 302 is specifically configured to:

[0185] The following formula is used to transform the coordinates of the standard trajectory points:

[0186]

[0187] Among them, x is the horizontal coordinate of the standard trajectory point, y is the vertical coordinate of the standard trajectory point, α1 is the current candidate angle value, and x warp is the horizontal coordinate of the transformation trajectory point, y warp is the vertical coordinate of the transformation trajectory point.

[0188] Furthermore, the angle range in the next correction angle optimization process is twice the incremental step size of the previous correction angle optimization process;

[0189] The center angle in the next correction angle optimization process is the optimal angle of the previous correction angle optimization process.

[0190] Furthermore, the correction angle determination module 302 is specifically configured to:

[0191] sorting the coordinates of the transformation trajectory points according to the horizontal coordinates, and constructing a column array with the transformation trajectory points having the same horizontal coordinates;

[0192] Calculate the column array index values ​​for the column arrays that meet the preset statistical conditions, and add them up to obtain the sum of the index values ​​of the current candidate angle values;

[0193] Traverse each candidate angle value and take the one with the largest sum of index values ​​among the candidate angle values ​​as the optimal angle for the first correction angle optimization process.

[0194] Furthermore, the preset statistical condition includes: the ratio of the number of transformation trajectory points in the column array to the vertical coordinate span of the column array is greater than a set threshold.

[0195] Furthermore, the correction angle determination module 302 is specifically configured to:

[0196] If the current column array meets the preset statistical conditions, the square of the number of transformation trajectory points in the current column array is used as the column array index value of the current column array.

[0197] Furthermore, the text to be corrected is the text of the current text line;

[0198] The angle correction module 303 is specifically configured to:

[0199] The final correction angle is used to perform angle correction on all text to be corrected in the current text line.

[0200] The technical solution provided in the embodiments of the present application includes a standard trajectory point acquisition module for acquiring the standard trajectory points of the text to be corrected; a correction angle determination module for performing at least one correction angle optimization process on the text to be corrected. In each correction angle optimization process, the optimal angle is obtained based on the distribution information of the standard trajectory points, and the result of the last correction angle optimization process is used as the final correction angle; and an angle correction module for using the final correction angle to perform angle correction on the text to be corrected. The above-mentioned angle correction device for tilted text can solve the problems of high computing power consumption and low correction result accuracy when correcting tilted text. By obtaining the standard trajectory points of the text to be corrected and performing at least one correction angle optimization process on the text to be corrected, in each correction angle optimization process, the optimal angle is obtained based on the distribution information of the standard trajectory points, and the last correction angle optimization process result is used as the final correction angle, and then the final correction angle is used to perform angle correction on the text to be corrected. The optimal text correction angle can be determined without calculating a large amount of data, thereby reducing the computing power consumption in the tilted text correction process, and the application range of tilted text correction is wider, thereby improving the accuracy of the correction result.

[0201] The angle correction device for tilted text in the embodiments 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. For example, 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 (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), an ATM, or an kiosks, etc., which are not specifically limited in the embodiments of the present application.

[0202] The device for correcting the angle of tilted text 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.

[0203] The angle correction device for tilted text provided in the embodiment of the present application can implement each process implemented in the above method embodiment. To avoid repetition, it will not be described here.

[0204] Figure 5 Schematic diagram of the structure of the electronic device provided in the embodiment of the present application. Figure 5 As shown, an embodiment of the present application also provides an electronic device 400, including a processor 401, a memory 402, and a program or instruction stored in the memory 402 and executable on the processor 401. When the program or instruction is executed by the processor 401, each process of the above-mentioned embodiment of the angle correction method for tilted text is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.

[0205] 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.

[0206] 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 embodiment of the angle correction method for tilted text is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0207] The processor is the 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), random access memory (RAM), a magnetic disk, or an optical disk.

[0208] 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 embodiment of the angle correction method for tilted text, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0209] 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.

[0210] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element. In addition, it should be noted 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 the opposite 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.

[0211] 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 the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0212] 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 this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.

[0213] The above are only preferred embodiments of the present application and the technical principles employed. The present application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions that are possible for those skilled in the art will not depart from the scope of protection of the present application. Therefore, although the present application has been described in more detail through the above embodiments, the present application is not limited to the above embodiments and may include more other equivalent embodiments without departing from the concept of the present application. The scope of the present application is determined by the scope of the claims.

Claims

1. A method for correcting the angle of tilted text, characterized in that: The method comprises: Obtain the standard trajectory points of the text to be corrected; Performing at least one correction angle optimization process on the text to be corrected, obtaining an optimal angle based on the distribution information of the standard trajectory points in each correction angle optimization process, and using the result of the last correction angle optimization process as the final correction angle; The final correction angle is used to perform angle correction on the text to be corrected.

2. The method according to claim 1, characterized in that Get the standard trajectory points of the text to be corrected, including: Get the initial trajectory points of the text to be corrected; Performing regularization processing based on the initial trajectory points to obtain regularized trajectory points; The stroke trajectory is resampled based on the regularized trajectory points to obtain standard trajectory points of the text to be corrected.

3. The method according to claim 2, characterized in that Regularization processing is performed based on the initial trajectory points to obtain regularized trajectory points, including: Get the coordinate information of each initial trajectory point; Determine the coordinate origin based on the coordinate information of all initial trajectory points; Determine the coordinate transformation ratio of each initial trajectory point based on the coordinate origin and the preset target height; The coordinate information of each initial trajectory point is proportionally transformed according to the coordinate transformation ratio to obtain a regularized trajectory point.

4. The method according to claim 1, wherein Performing at least one correction angle optimization process on the text to be corrected, wherein in each correction angle optimization process, an optimal angle is obtained based on the distribution information of the standard trajectory points, including: Determining at least two candidate angle values ​​based on the angle range and incremental step size in the first correction angle optimization process; For each candidate angle value, the coordinates of the standard trajectory point are transformed using the preset transformation rules to obtain the transformed trajectory point; Determining the optimal angle for the first correction angle optimization process based on the distribution information of the transformation trajectory points on the horizontal and vertical coordinates; According to the optimal angle of the first correction angle optimization process and the pre-set angle range and incremental step in the next correction angle optimization process, the optimal angle of the next correction angle optimization process is determined until the optimal angle of the last correction angle optimization process is obtained as the final correction angle.

5. The method according to claim 4, characterized in that For each candidate angle value, the coordinates of the standard trajectory points are transformed using the preset transformation rules, including: The following formula is used to transform the coordinates of the standard trajectory points: Among them, x is the horizontal coordinate of the standard trajectory point, y is the vertical coordinate of the standard trajectory point, α1 is the current candidate angle value, and x warp is the horizontal coordinate of the transformation trajectory point, y warp is the vertical coordinate of the transformation trajectory point.

6. The method according to claim 4, characterized in that The angle range in the next correction angle optimization process is twice the incremental step size of the previous correction angle optimization process; The center angle in the next correction angle optimization process is the optimal angle of the previous correction angle optimization process.

7. The method according to claim 4, characterized in that Determining the optimal angle of the first correction angle optimization process according to the distribution information of the transformation trajectory points on the horizontal and vertical coordinates includes: sorting the coordinates of the transformation trajectory points according to the horizontal coordinates, and constructing a column array with the transformation trajectory points having the same horizontal coordinates; Calculate the column array index values ​​for the column arrays that meet the preset statistical conditions, and add them up to obtain the sum of the index values ​​of the current candidate angle values; Traverse each candidate angle value and take the one with the largest sum of index values ​​among the candidate angle values ​​as the optimal angle for the first correction angle optimization process.

8. The method according to claim 7, characterized in that The preset statistical condition includes: a ratio of the number of transformation trajectory points in the column array to the vertical coordinate span of the column array is greater than a set threshold.

9. The method according to claim 7, characterized in that Calculates column array index values ​​for column arrays that meet preset statistical conditions, including: If the current column array meets the preset statistical conditions, the square of the number of transformation trajectory points in the current column array is used as the column array index value of the current column array.

10. The method according to claim 1, characterized in that The text to be corrected is the text of the current text line; Performing angle correction on the text to be corrected using the final correction angle includes: The final correction angle is used to perform angle correction on all text to be corrected in the current text line.

11. A device for correcting the angle of tilted text, characterized in that: The device comprises: A standard trajectory point acquisition module is used to obtain the standard trajectory points of the text to be corrected; a correction angle determination module, configured to perform at least one correction angle optimization process on the text to be corrected, wherein in each correction angle optimization process, an optimal angle is obtained based on the distribution information of the standard trajectory points, and the result of the last correction angle optimization process is used as the final correction angle; An angle correction module is used to perform angle correction on the text to be corrected using the final correction angle.

12. 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 steps of the angle correction method of tilted text as described in any one of claims 1 to 10.

13. 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 steps of the method for correcting the angle of tilted text according to any one of claims 1 to 10 are implemented.