A text correction method, an electronic device, and a storage medium

CN115439869BActive Publication Date: 2026-06-16YGSOFT INC

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
YGSOFT INC
Filing Date
2022-08-24
Publication Date
2026-06-16

AI Technical Summary

Technical Problem

Existing convolutional neural networks and recurrent neural networks cannot effectively recognize fan-shaped text with large curvature, resulting in poor fan-shaped text recognition performance.

Method used

By obtaining the polar coordinates of the pixels in the fan-shaped text region and remapping the pixels using the polar coordinates, the region is converted into a linear text region while maintaining the pixel arrangement order.

🎯Benefits of technology

It improves the recognition effect of fan-shaped text regions, and can correct fan-shaped text into linear text regions, achieving better recognition results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115439869B_ABST
    Figure CN115439869B_ABST
Patent Text Reader

Abstract

The application discloses a text correction method, an electronic device and a storage medium. The method comprises the following steps: obtaining a fan-shaped text region contained in a target image; obtaining polar coordinates of a plurality of pixel points in the fan-shaped text region; performing remapping on the plurality of pixel points by using the polar coordinates of the plurality of pixel points, so as to obtain a linear text region composed of remapped pixel points, wherein the arrangement order of the plurality of pixel points before and after the remapping is unchanged. In the foregoing manner, the fan-shaped text region can be corrected into the linear text region, so that the recognition effect of the fan-shaped text region is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of text recognition technology, and in particular to a text correction method, electronic device, and storage medium. Background Technology

[0002] Seals, postmarks, tire codes, shop signs, and other similar items often contain a large amount of highly curved fan-shaped text, which cannot be directly recognized by traditional convolutional neural networks or recurrent neural networks. Current technologies often employ OCR (Optical Character Recognition) to recognize this text. For example, deep learning-based OCR methods train network parameters to automatically recognize input text images. However, these methods perform poorly in recognizing fan-shaped text. Summary of the Invention

[0003] The main technical problem addressed by this application is to provide a text correction method, electronic device, and storage medium that can correct a fan-shaped text region into a linear text region, thereby improving the recognition effect of the fan-shaped text region.

[0004] To address the aforementioned technical problems, the first aspect of this application provides a text correction method, which includes: obtaining a fan-shaped text region contained in a target image; obtaining the polar coordinates of several pixels in the fan-shaped text region; and remapping the several pixels using the polar coordinates to obtain a linear text region composed of the remapped pixels, wherein the arrangement order of the several pixels remains unchanged before and after the remapping.

[0005] To address the aforementioned technical problems, a second aspect of this application provides an electronic device comprising a memory and a processor coupled to each other, wherein the memory stores program instructions; and the processor executes the program instructions stored in the memory to implement the method described in the first aspect.

[0006] To address the aforementioned technical problems, a third aspect of this application provides a computer-readable storage medium for storing program instructions that can be executed to implement the method described in the first aspect.

[0007] The beneficial effects of this application are as follows: Unlike existing technologies, this application obtains the fan-shaped text region contained in the target image and the polar coordinates of several pixels within the fan-shaped text region. Then, it remaps these pixels using their polar coordinates to obtain a linear text region composed of the remapped pixels, where the order of the pixels remains unchanged before and after the remap. By remapping these pixels, the fan-shaped text region can be corrected into a linear text region. Further recognition of this linear text region yields better recognition results. Attached Figure Description

[0008] Figure 1 This is a flowchart illustrating the first embodiment of the text correction method provided in this application;

[0009] Figure 2 This is a schematic diagram of one embodiment of the target image provided in this application;

[0010] Figure 3 This is a flowchart illustrating the second embodiment of the text correction method provided in this application;

[0011] Figure 4 This is a flowchart illustrating the third embodiment of the text correction method provided in this application;

[0012] Figure 5 This is a schematic diagram of the framework structure of one embodiment of the electronic device provided in this application;

[0013] Figure 6 This is a schematic diagram of the framework structure of one embodiment of the computer-readable storage medium provided in this application. Detailed Implementation

[0014] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0015] It should be noted that the embodiments of this application contain descriptions involving "first," "second," etc., which are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature.

[0016] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0017] Please refer to the following: Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the text correction method provided in this application. Figure 2This is a schematic diagram of an embodiment of the target image provided in this application; the method includes:

[0018] S11: Obtain the fan-shaped text region contained in the target image.

[0019] In one embodiment, the target image contains a fan-shaped text region; the target image is detected to obtain the location of the fan-shaped text region. In a specific embodiment, the target image is obtained by photographing a document containing a seal, and the seal contains a fan-shaped text region. For example... Figure 2 As shown, a seal can contain both fan-shaped and linear text regions. Specifically, the target image can be detected to obtain several control points for the fan-shaped and linear text regions. These control points represent the position and size of the detected fan-shaped and linear text regions. For the linear text regions, OCR can be directly used for recognition to obtain the text contained within those regions.

[0020] For a fan-shaped text region, its geometric parameters can be obtained. These parameters may include the coordinates of several pixels within the fan-shaped text region, several boundary points of the fan-shaped text, the position of the center point of the fan-shaped text region, and at least one of the start point, end point, and outer radius of the fan-shaped text region. For example... Figure 2 As shown, in one specific embodiment, a rectangular coordinate system can be established with a preset position at the upper left corner of the fan-shaped text area as the origin, so as to obtain the rectangular coordinates of several pixels in the fan-shaped text area.

[0021] S12: Obtain the polar coordinates of several pixels in the fan-shaped text region.

[0022] In one embodiment, the Cartesian coordinates of several pixels in the fan-shaped text area are converted to polar coordinates. For each pixel in the fan-shaped text area, the polar coordinates can be obtained using the formula (ρ, θ) = T(x, y). Here, T represents the function for converting Cartesian coordinates to polar coordinates, and T can be expressed in the following form:

[0023]

[0024]

[0025] stρ∈(0, R_Outer] andθ∈(-180°, 180°]. (1)

[0026] Where x is the first axis coordinate of a pixel in the fan-shaped text region in the rectangular coordinate system, and the first axis can be the x-axis; y is the second axis coordinate of a pixel in the fan-shaped text region in the rectangular coordinate system, and the second axis can be the y-axis; R-Outer is the outer radius of the fan-shaped text region; ρ is the polar radius in polar coordinates; θ is the polar angle in polar coordinates; stρ∈(0,R-Outer] indicates that the value of the polar radius is greater than 0 and less than or equal to the outer radius of the fan-shaped text region.

[0027] S13: Remap several pixels using their polar coordinates to obtain a linear text region composed of the remapped pixels.

[0028] In one embodiment, for each pixel in the fan-shaped text region, the polar coordinates and a preset size of the pixel can be remapped to obtain the remapped position of the pixel in the Cartesian coordinate system. Based on the remapped positions of several pixels, a linear text region of a preset size is obtained. The polar coordinates include the polar radius and polar angle, and the preset size includes a preset length and a preset width. Specifically, for each pixel, the product of the preset width and the pixel's polar angle is divided by 2π to obtain the pixel's remapped first axis coordinate; the product of the preset length and the pixel's polar radius is divided by the outer radius of the fan-shaped text region to obtain the pixel's remapped second axis coordinate. This is illustrated in Formula 2 below.

[0029]

[0030]

[0031]

[0032]

[0033] Where ω is the coordinate of the first axis of the remapping. A vector representation of a single pixel. R-Outer is the outer radius of the fan-shaped text region, K w K is the preset width. h This is the preset length.

[0034] The preset length and preset width can be set as needed and are not limited here. The arrangement order of several pixels remains unchanged before and after remapping. For example, if the first pixel is above the second pixel before remapping, the first pixel will still be above the second pixel after remapping, but the position of the first pixel in the Cartesian coordinate system can change before and after remapping.

[0035] This implementation method, after obtaining the fan-shaped text region contained in the target image and the polar coordinates of several pixels within the fan-shaped text region, remaps these pixels using their polar coordinates to obtain a linear text region composed of the remapped pixels. The order of the pixels remains unchanged before and after the remap. By remapping these pixels, the fan-shaped text region can be corrected into a linear text region. Further recognition of this linear text region yields better recognition results.

[0036] Please refer to the following: Figure 2 and Figure 3 , Figure 3 This is a flowchart illustrating a second embodiment of the text correction method provided in this application, the method comprising:

[0037] S31: Obtain the original image containing the fan-shaped text region.

[0038] In one embodiment, the original image is obtained by photographing a document containing a seal, but the seal in the original image is offset relative to the forward reference line. For example... Figure 2 As shown, the origin is any point at the top left corner of the original image (e.g., ...). Figure 2 Establish a Cartesian coordinate system (point O in the image). Using one axis of the Cartesian coordinate system as the positive reference line (e.g., the x-axis), obtain the position of the center point of the fan-shaped text area contained in the seal and the position of the convex / concave reference point in the original image. The convex / concave reference point can be a boundary point on the outer ring of the fan-shaped text area. Connect the convex / concave reference point and the center point of the fan-shaped text. If the angle between the line connecting the convex / concave reference point and the center point of the fan-shaped text and the positive reference line is equal to a preset angle, then it is considered that the seal in the original image has shifted relative to the positive reference line, that is, the fan-shaped text area has shifted relative to the positive reference line. The preset angle can be set according to the position of the concave and convex reference point on the arc of the fan-shaped text area. If the concave and convex reference point is a boundary point in the middle of the arc of the fan-shaped text area, the preset angle can be set to 90°. That is, when the angle between the line connecting the concave and convex reference point and the center point and the positive reference line is equal to 90°, the fan-shaped text area is considered to have not shifted. When the angle between the line connecting the concave and convex reference point and the center point and the positive reference line is not equal to 90°, the fan-shaped text area is considered to have shifted.

[0039] S32: Determine the convexity / concaveness of the fan-shaped text region in the original image.

[0040] In one embodiment, the coordinate differences between at least two pixels on the arc of the fan-shaped text region and the center point of the fan-shaped text region along a preset axis can be statistically analyzed to obtain statistical results; based on the statistical results, the concavity / convexity of the fan-shaped text region can be determined. Specifically, the coordinate differences between the ordinates of at least two pixels and the ordinate of the center point can be obtained to obtain the central tendency value of the coordinate differences corresponding to at least two pixels. That is, the central tendency value is obtained using the following formula 3.

[0041]

[0042] Where δ is the value representing central tendency; y i yi is the ordinate of the i-th point within the fan-shaped text region; y0 is the ordinate of the center point of the fan-shaped text region; N is the total number of pixels contained in the fan-shaped text region; P i Pstart is the i-th pixel of the fan-shaped text region; Pend is the starting point of the fan-shaped text region; Pi is the ending point of the fan-shaped text region; Pi ... i (x i ,y i )∈[Pstart,Pend] indicates that the i-th pixel of the fan-shaped text region is either the starting point of the fan-shaped text region, the ending point of the fan-shaped text region, or any point between the starting point and the ending point of the fan-shaped text region.

[0043] When the central tendency value is greater than a preset value, the fan-shaped text area is determined to be convex; when the central tendency value is less than the preset value, the fan-shaped text area is determined to be concave. In one embodiment, the preset value can be 0. That is, as shown... Figure 2 As shown, when a rectangular coordinate system is established with the top left corner of the fan-shaped text as the origin, and the fan-shaped text area is located in the first quadrant of the rectangular coordinate system, the fan-shaped text area is convex when the vertical coordinates of the start and end points of the fan-shaped text area are less than the vertical coordinates of any boundary point on the arc of the fan-shaped text area; and concave when the vertical coordinates of the start and end points of the fan-shaped text area are greater than the vertical coordinates of any boundary point on the arc of the fan-shaped text area.

[0044] S33: Based on the concavity and convexity of the fan-shaped text region, rotate the original image to obtain the target image.

[0045] In one embodiment, two candidate control points can be predetermined. One control point is a boundary point on the arc of the concave fan-shaped text region; the other control point is a boundary point on the arc of the convex fan-shaped text region. The two candidate control points can be understood as the intersection of a ray and a circle. One candidate control point is selected as a concavity / convexity reference point based on its concavity / convexity. The image rotation angle is determined based on the position of the reference point, and the original image is rotated using this angle to obtain the target image.

[0046] In other implementations, three candidate control points can be predetermined, such that when the fan-shaped text region is convex, at least one candidate control point exists on the arc of the fan-shaped text region, or when the fan-shaped text region is concave, at least one candidate control point exists on the arc of the fan-shaped text region. For example, when the fan-shaped text region is convex, there is one candidate control point on the arc of the fan-shaped text region; when the fan-shaped text region is concave, there are two candidate control points on the arc of the fan-shaped text region. When the fan-shaped text region is determined to be convex, the candidate control point corresponding to the arc of the fan-shaped text region is used as the convex / concave reference point; when the fan-shaped text region is determined to be concave, either candidate control point is selected from the two candidate control points corresponding to the arc of the fan-shaped text region as the convex / concave reference point. The image rotation angle is determined based on the position of the convex / concave reference point, and the original image is rotated using the image rotation angle to obtain the target image.

[0047] Understandably, the number of candidate control points can be set as needed and is not limited here.

[0048] S34: Obtain the fan-shaped text region contained in the target image.

[0049] S35: Obtain the polar coordinates of several pixels in the fan-shaped text region.

[0050] S36: Remap several pixels using their polar coordinates to obtain a linear text region composed of the remapped pixels.

[0051] For detailed implementation of steps S34-S36, please refer to steps S11-S13 of the first embodiment of the text correction method provided in this application, which will not be repeated here.

[0052] The concavity / convexity of the fan-shaped text region is crucial for text correction; errors in concavity / convexity determination can affect the orientation of the text being corrected. Therefore, this implementation first determines the concavity / convexity of the fan-shaped text region. Based on this, the original image is rotated to obtain the target image. Next, the fan-shaped text region and the polar coordinates of several pixels within it are obtained. These polar coordinates are then used to remap the pixels, resulting in a linear text region composed of the remapped pixels. The order of the pixels remains unchanged before and after the remapping. This method further improves the correction effect of the fan-shaped text region.

[0053] Please see Figure 4 , Figure 4 This is a flowchart illustrating the third embodiment of the text correction method provided in this application, which includes:

[0054] S41: Obtain the original image containing the fan-shaped text region.

[0055] In one embodiment, the original image is obtained by photographing a document containing a seal, but the seal in the original image is offset relative to the forward reference line.

[0056] S42: Determine the convexity / concaveness of the fan-shaped text region in the original image.

[0057] For detailed implementation of steps S41-S42, please refer to steps S31-S32 of the second embodiment of the text correction method provided in this application, which will not be repeated here.

[0058] S43: Obtain the geometric parameters of the fan-shaped text region in the original image.

[0059] In one embodiment, the geometric parameters of the fan-shaped text region may include the position of the center point of the fan-shaped text region, the starting point of the fan-shaped text region, the ending point of the fan-shaped text region, and the outer radius of the fan-shaped text region. When obtaining the geometric parameters of the fan-shaped text region, the original image can be detected to obtain several boundary points of the fan-shaped text region. Based on these boundary points, the position and size of the fan-shaped text region in the original image can be determined. This can be achieved by using an algorithm to detect the original image and obtaining the boundary points; alternatively, a detection model can be used. No limitation is imposed here.

[0060] In another implementation, several boundary points are detected in the original image. The distance between any two adjacent boundary points is calculated, and then the average distance is calculated. Then, for each pair of adjacent boundary points, one is selected as a reference boundary point, and the distance between the two points is calculated. If the distance between the two points is greater than the average distance, the points other than the reference boundary point are removed. This method can eliminate erroneous boundary points obtained during the detection process of the original image.

[0061] After obtaining several boundary points of the fan-shaped text region, the geometric parameters of the region are derived using these boundary points. Specifically, the boundary points are divided into several groups, each containing three boundary points, with at least one distinct boundary point in any two groups. Using each group of boundary points, a circle is defined, and the center of this circle is determined. For several groups of boundary points, several center positions are obtained. These center positions are then clustered using a clustering algorithm to determine the location of the center point of the fan-shaped text region.

[0062] Based on the location of the center point and several boundary points, the starting point and ending point of the sector-shaped text region are obtained. The starting and ending points of the sector-shaped text region are each one of the boundary points. Specifically, the first distance from each boundary point to the center point is calculated, and the two boundary points corresponding to the two largest first distances are taken as the starting and ending points of the sector-shaped text region. The largest first distance is the outer radius of the sector-shaped text region.

[0063] S44: Using geometric parameters and concavity / convexity, determine the position of the concavity / convexity reference point in the original image; where the concavity / convexity reference point is a boundary point of the fan-shaped text region.

[0064] In one embodiment, the positions of at least two candidate control points are obtained based on the position of the center point of the fan-shaped text region, the outer radius, and the slope of the start and end lines, wherein the start and end lines are obtained by connecting the start and end points of the fan-shaped text region. Specifically, the coordinates of the two candidate control points can be calculated using the following formula 4.

[0065]

[0066] Where x0 is the first axis coordinate of the center point of the fan-shaped text region; y0 is the second axis coordinate of the center point of the fan-shaped text region; R is the outer radius of the fan-shaped text region; and k is the slope of the start and end lines. The slope of the normal to the starting and ending lines

[0067] After obtaining the positions of the two candidate control points, one of them can be selected as a concavity / convexity reference point based on the concavity / convexity of the fan-shaped text region. In one embodiment, one control point is a boundary point on the arc of the fan-shaped text region when the fan-shaped text region is concave; the other control point is a boundary point on the arc of the fan-shaped text region when the fan-shaped text region is convex. Therefore, once the concavity / convexity of the fan-shaped text region is determined, one of the two candidate control points can be selected as the concavity / convexity reference point based on this property.

[0068] S45: Determine the image rotation angle of the original image based on the position of the concave and convex reference points.

[0069] In one embodiment, the angle between the line connecting the concave / convex reference point and the center point of the fan-shaped text area and the positive reference line is obtained; based on the angle, the image rotation angle is determined. The positive reference line can be an axis of a user-established Cartesian coordinate system. For example, a Cartesian coordinate system can be established with any point at the top left corner of the original image as the origin, placing the original image in the first quadrant of the Cartesian coordinate system, with the x-axis as the positive reference line. In this embodiment, the image rotation angle can be controlled between 0° and 90°. It is understood that in other embodiments, the image rotation angle can also be in other ranges, such as between 0° and 180°, and is not limited here.

[0070] S46: Rotate the original image using the image rotation angle to obtain the target image.

[0071] S47: Obtain the fan-shaped text region contained in the target image.

[0072] S48: Obtain the polar coordinates of several pixels in the fan-shaped text region.

[0073] S49: Remap several pixels using their polar coordinates to obtain a linear text region composed of the remapped pixels.

[0074] For detailed implementation of steps S47-S49, please refer to steps S11-S13 of the first embodiment of the text correction method provided in this application, which will not be repeated here.

[0075] In this embodiment, the original image may contain only a fan-shaped text region, or it may contain both linear and fan-shaped text regions. When both the linear and fan-shaped text regions are offset relative to the positive reference line, the concavity / convexity of the fan-shaped text region can be determined first, and its geometric parameters in the original image can be obtained. Using the geometric parameters and the concavity / convexity, the position of the concavity / convexity reference point in the original image can be determined. The concavity / convexity reference point is a boundary point of the fan-shaped text region. Based on the position of the concavity / convexity reference point, the image rotation angle of the original image is determined. The original image is then rotated using this rotation angle to obtain the target image. At this point, neither the linear nor fan-shaped text regions in the target image are offset relative to the positive reference line.

[0076] In other embodiments, when the original image contains both linear text regions and fan-shaped text regions, and both linear text regions and fan-shaped text regions are offset relative to the positive reference line, the image rotation angle can be calculated based on several pixels of the linear text region, and the original image can be rotated using the image rotation angle to obtain the target image.

[0077] Furthermore, after determining the concavity and convexity of the fan-shaped text region, this application can also segment the original image based on the concavity and convexity. In one embodiment, when the original image contains at least one fan-shaped text region, the concavity and convexity can be used to determine an initial angle. The original image is then segmented according to the initial angle to obtain a target image, wherein the target image contains a complete fan-shaped text region, thereby ensuring that the linear text region obtained after processing the target image is complete. The initial angle can be the angle between any ray and the positive reference line, or it can be the angle between any two rays. For example, if the original image is obtained by processing a document containing a circular seal, and the circular seal contains two fan-shaped text regions, the circular seal can be segmented into two parts according to the initial angle, each part containing one fan-shaped text region. The polar coordinates of several pixels in the fan-shaped text region contained in each part are used to remap several pixels to obtain a linear text region composed of several remapped pixels. It is understood that if only one of the two fan-shaped text regions needs to be corrected, when segmenting the original image according to the initial angle, it is only necessary to ensure the integrity of the fan-shaped text region to be corrected.

[0078] After correcting the fan-shaped text region into a linear text region using the above method, any existing text recognition technology can be used to recognize the linear text region to obtain the text contained within it. Furthermore, the text correction method provided in this application can correct not only fan-shaped text regions with small curvature but also fan-shaped text regions with large curvature.

[0079] Please see Figure 5 , Figure 5 This is a schematic diagram of the framework structure of one embodiment of the electronic device provided in this application.

[0080] The electronic device 50 includes a memory 51 and a processor 52 coupled to each other. The memory 51 stores program instructions, and the processor 52 executes the program instructions stored in the memory 51 to implement the steps of any of the above-described method embodiments. In a specific implementation scenario, the electronic device 50 may include, but is not limited to, a microcomputer or a server. In addition, the electronic device 50 may also include mobile devices such as laptops and tablets, which are not limited here.

[0081] Specifically, processor 52 controls itself and memory 51 to implement the steps of any of the above-described method embodiments. Processor 52 may also be referred to as a CPU (Central Processing Unit). Processor 52 may be an integrated circuit chip with signal processing capabilities. Processor 52 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or any conventional processor. Furthermore, processor 52 may be implemented using integrated circuit chips.

[0082] Please see Figure 6 , Figure 6 This is a schematic diagram of the framework structure of one embodiment of the computer-readable storage medium provided in this application.

[0083] The computer-readable storage medium 60 stores program instructions 61, which, when executed by a processor, are used to implement the steps in any of the above method embodiments.

[0084] The computer-readable storage medium 60 can specifically be a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, or a medium that can store computer programs. Alternatively, it can be a server that stores the computer program, which can send the stored computer program to other devices for execution or can also run the stored computer program itself.

[0085] If the technical solution of this application involves personal information, the product using this technical solution has clearly informed the user of the personal information processing rules and obtained the user's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using this technical solution has obtained the user's separate consent before processing the sensitive personal information, and also meets the requirement of "express consent". For example, at personal information collection devices such as cameras, clear and prominent signs are set up to inform users that they have entered the scope of personal information collection and that personal information will be collected. If an individual voluntarily enters the collection scope, it is deemed that they have agreed to the collection of their personal information; or on the personal information processing device, with clear signs / information informing users of the personal information processing rules, authorization is obtained from the individual through pop-up information or by asking the individual to upload their personal information; wherein, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the types of personal information processed.

[0086] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A text correction method, characterized in that, The method includes: Obtain the original image containing the fan-shaped text region and the geometric parameters of the fan-shaped text region in the original image; wherein, the geometric parameters include the position of the center point of the fan-shaped text region, and the start point, end point and outer radius of the fan-shaped text region; The statistical results are obtained by calculating the coordinate differences between at least two pixels on the arc of the fan-shaped text region and the center point of the fan-shaped text region along the vertical axis. Based on the statistical results, the concavity and convexity of the fan-shaped text region are determined; Based on the position of the center point of the fan-shaped text region, the radius of the outer ring, and the slope of the start and end lines, the positions of at least two candidate control points are obtained, wherein the start and end lines are obtained by connecting the start and end points of the fan-shaped text region; based on the concavity and convexity of the fan-shaped text region, one of the at least two candidate control points is selected as a concavity and convexity reference point; the angle between the line connecting the concavity and convexity reference point and the center point of the fan-shaped text region and the positive reference line is obtained; based on the angle, the image rotation angle is determined; the original image is rotated using the image rotation angle; or, an initial angle is determined based on the concavity and convexity; the original image is cut based on the initial angle; wherein the target image obtained by cutting the original image contains a complete fan-shaped text region; Obtain the fan-shaped text region in the target image obtained by rotating or cropping the original image; Obtain the polar coordinates of several pixels in the fan-shaped text region; The pixels are remapped using their polar coordinates to obtain a linear text region composed of the remapped pixels, wherein the order of the pixels remains unchanged before and after the remapping.

2. The method according to claim 1, characterized in that, The step of remapping the plurality of pixels using their polar coordinates to obtain a linear text region composed of the remapped pixels includes: For each pixel, the polar coordinates and preset size of the pixel are remapped to obtain the remapped position of the pixel in the Cartesian coordinate system. Based on the remapping positions of the aforementioned pixels, the linear text region of the preset size is obtained.

3. The method according to claim 2, characterized in that, The polar coordinates include polar radius and polar angle, and the preset size includes preset length and preset width; the remapping calculation of the polar coordinates and preset size of the pixel to obtain the remapping position of the pixel in the Cartesian coordinate system includes: Divide the product of the preset width and the polar angle of the pixel by 2π to obtain the remapped first axis coordinate of the pixel; and, Divide the product of the preset length and the extreme radius of the pixel by the outer radius of the fan-shaped text region to obtain the remapped second axis coordinate of the pixel.

4. The method according to claim 1, characterized in that, Obtaining the geometric parameters of the fan-shaped text region in the original image includes: Obtain several boundary points of the fan-shaped text; Using the aforementioned boundary points, the position of the center point of the fan-shaped text region, as well as the starting point, ending point, and outer radius of the fan-shaped text region, are obtained.

5. An electronic device, characterized in that, Including interconnected memory and processor, The memory stores program instructions; The processor is used to execute program instructions stored in the memory to implement the method according to any one of claims 1-4.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium is used to store program instructions that can be executed to implement the method as described in any one of claims 1-4.