A method and device for flattening bending text based on stamp outline

By detecting circles or ellipses in the stamp, obtaining and flattening the line segments on the stamp to form a rectangular image for text recognition, it solves the problem of difficult recognition of curved text in the stamp and achieves more efficient text recognition and lower computing resources. need.

CN114120308BActive Publication Date: 2025-01-24SHANGHAI HEHE INFORMATION TECH DEV +3
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111679618.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2025-01-24
Estimated Expiration
2041-12-31

AI Technical Summary

Technical Problem

The prior art is difficult to effectively identify and extract curved text arranged along the outline of the stamp in the stamp, making it difficult to recognize.

Method used

The curved text flattening recognition method based on the stamp outline is adopted. By detecting circles or ellipses in the stamp area, multiple line segments on the stamp are obtained. The Bresenham straight line algorithm is used to sample and flatten the line segments to form a rectangular image, and then the text is detected. and optical character recognition.

Benefits of technology

Improve the easy reading and recognition accuracy of the stamps, reduce the needs of computing resources, and improve the efficiency and speed of computing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114120308B_ABST
    Figure CN114120308B_ABST
Patent Text Reader

Abstract

The present application discloses a method for flattening and recognizing curved text based on stamp contours. A stamp is detected in an image to obtain a stamp area. A circle or ellipse detection algorithm is used to perform detection in the stamp area. For a detected circular stamp, multiple line segments on the circular stamp are obtained; all the line segments are arranged in parallel and close to each other, and the rectangular image formed is used as the stamp image after the circular stamp is flattened. For a detected elliptical stamp, multiple line segments on the elliptical stamp are obtained; all the line segments are arranged in parallel and close to each other, and the line segments are scaled to have the same length, and the rectangular image formed is used as the stamp image after the elliptical stamp is flattened. Text detection is performed on the flattened stamp image, and then optical character recognition is performed on the detected text to obtain a text recognition result. The present application only needs to process columns of pixels, and has higher computing efficiency, faster computing speed, and lower requirements for hardware computing resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to a method for flattening and identifying curved text in a stamp image. Background Art

[0002] Document images may contain stamps (also called seals). When identifying and extracting text information from document images, it is necessary to identify and extract text information from stamp images. The outline of a stamp can be circular, elliptical, rectangular, etc. Figure 1 and Figure 2 These are two oval stamps. The text in the stamps includes both curved text arranged along the stamp outline and normal text arranged along a straight line. Normal text may have one or more lines. Existing OCR (Optical Character Recognition) technology can detect and recognize normal text arranged along a straight line well, but the detection and recognition of curved text arranged along the stamp outline is poor, which brings challenges to the recognition and extraction of curved text in stamps.

[0003] The Chinese invention patent application "A method for intelligent detection and recognition of seals" with application publication number CN110728277A and application publication date January 24, 2020, discloses a technical solution for flattening the text area in the seal, identifying the text area, and outputting the corresponding text. The solution only records "flattening the arc-shaped text area" and does not specify what circle or ellipse detection algorithm is used. Summary of the invention

[0004] The technical problem to be solved by the present application is to propose a method for flattening the text based on the stamp outline and then identifying it, which not only improves the readability of the stamp text, but also reduces the difficulty of identifying the stamp text.

[0005] To solve the above technical problems, the present application proposes a curved text flattening recognition method based on stamp contour, comprising the following steps. Step S10: Detect a stamp in an image to obtain a stamp area. Step S20: Use a circle or ellipse detection algorithm to perform detection in the stamp area. If a circle is detected in the stamp area, the center position of the circle is obtained by the circle detection algorithm, and step S30 is entered. If an ellipse is detected in the stamp area, two focus positions are obtained by the ellipse detection algorithm, and step S35 is entered. If no circle or ellipse is detected in the stamp area, step S40 is entered, and the stamp area is used as a flattened stamp image. Step S30: For the detected circular stamp, multiple line segments on the circular stamp are obtained; all pixel points on each line segment are obtained using the Bresenham line algorithm; all line segments are arranged in parallel next to each other, and a rectangular image composed of multiple parallel line segments is used as the stamp image after the circular stamp is flattened; all pixel points on each line segment are used as a column of pixel points in the rectangular image, and then step S40 is entered. Step S35: for the detected elliptical stamp, obtain multiple line segments on the elliptical stamp; use the Bresenham straight line algorithm to obtain all the pixels on each line segment; arrange all the line segments in parallel and close to each other, and scale each line segment so that the length of each line segment is the same, and the rectangular image composed of multiple parallel line segments is used as the stamp image after the elliptical stamp is flattened; all the pixels on each scaled line segment are used as a column of pixels in the rectangular image, and then enter step S40. Step S40: perform text detection on the flattened stamp image, and then perform optical character recognition on the detected text to obtain the text recognition result. The above method does not stretch the area of ​​the stamp image, but samples the stamp image (obtains multiple line segments, each line segment has a width of one pixel), and then flattens the multiple line segments (arranges them in parallel and close to each other). This method of processing only the line segments only needs to process a column of pixels. Compared with processing a certain image area, the operation efficiency is higher, the operation speed is faster, and the requirements for hardware computing resources are lower.

[0006] Furthermore, in step S10, a general object detection method is used to detect stamps in the image.

[0007] Preferably, the general object detection method is the You Only Look Once YOLO algorithm.

[0008] Preferably, in step S20, the circle or ellipse detection algorithm is an EDCircles algorithm.

[0009] Furthermore, in step S30, the multiple line segments on the circular stamp are obtained by: taking any point on the circular outline of the stamp as the starting point, connecting the center of the circle and the starting point to form the first line segment; taking the center of the circle as the fixed point, rotating the first line segment clockwise or counterclockwise once every fixed angle α, and obtaining the second line segment, the third line segment, and so on in turn.

[0010] Furthermore, in step S35, the multiple line segments on the elliptical stamp are obtained as follows: (a) a focus of the elliptical outline of the stamp is connected with the endpoint of the major axis closest to the focus to form the first line segment; assuming that the total number of all line segments is k, k must be an even number; the distance between the two foci of the ellipse is d. (b) The first line segment is first translated along the major axis of the ellipse in the direction of the other focus by a distance of 2d / k, and then the endpoint of the first line segment after translation on the major axis of the ellipse is used as a fixed point, and the first line segment is rotated in a clockwise or counterclockwise direction by a fixed angle of α, and the other endpoint is extended or shortened until it intersects with the elliptical outline of the stamp to obtain the second line segment; the translation and rotation can be performed in either the reverse order or simultaneously; the second line segment is first translated along the major axis of the ellipse in the direction of the other focus by a distance of 2d / k, and then the endpoint of the second line segment after translation on the major axis of the ellipse is used as a fixed point, and the first line segment is rotated in either the reverse order or simultaneously; and so on and so forth until the k / 2th line segment is obtained, and the k / 2th line segment and the first line segment are both on the major axis of the ellipse. (c) First translate the k / 2th line segment along the major axis of the ellipse in the direction of the initial focus by a distance of 2d / k, then use the endpoint of the k / 2th line segment on the major axis of the ellipse as a fixed point, rotate it by a fixed angle α in the same direction as before, and extend or shorten the other endpoint until it intersects with the elliptical outline of the stamp to obtain the k / 2+1th line segment; the translation and rotation can be performed in either the same order or simultaneously; first translate the k / 2+1th line segment along the major axis of the ellipse in the direction of the initial focus by a distance of 2d / k, then use the endpoint of the k / 2+1th line segment on the major axis of the ellipse as a fixed point, rotate it by a fixed angle α in the same direction as before, and extend or shorten the other endpoint until it intersects with the elliptical outline of the stamp to obtain the k / 2+2th line segment; the translation and rotation can be performed in either the same order or simultaneously; and so on until the kth line segment is obtained.

[0011] Furthermore, α≤1 degree.

[0012] Furthermore, if divisible, the total number of all line segments in a circular or elliptical stamp is 360 / α.

[0013] Preferably, in step S40, an efficient and accurate scene text detector EAST algorithm is used to perform text detection.

[0014] Furthermore, in step S40, if two discontinuous texts are detected in a row of the flattened stamp image, the left text is spliced ​​to the end of the right text, and the spliced ​​text line is subjected to optical character recognition to obtain a text recognition result.

[0015] The present application also proposes a curved text flattening recognition device based on stamp contour, including a stamp detection unit, a circle or ellipse detection unit, a circle flattening unit, an ellipse flattening unit, and a character recognition unit. The stamp detection unit is used to detect a stamp in an image and obtain a stamp area. The circle or ellipse detection unit is used to detect in the stamp area using a circle or ellipse detection algorithm; if a circle is detected in the stamp area, the center position of the circle is obtained by the circle detection algorithm and sent to the circle flattening unit; if an ellipse is detected in the stamp area, two focus positions are obtained by the ellipse detection algorithm and sent to the ellipse flattening unit; if no circle or ellipse is detected in the stamp area, it is sent to the character recognition unit, and the stamp area is then used as a flattened stamp image. The circular flattening unit is used to obtain multiple line segments on the detected circular stamp; use the Bresenham line algorithm to obtain all the pixel points on each line segment; arrange all the line segments in parallel and close to each other, and the rectangular image composed of the multiple parallel line segments is used as the stamp image after the circular stamp is flattened; all the pixel points on each line segment are used as a column of pixel points in the rectangular image, and then sent to the character recognition unit. The elliptical flattening unit is used to obtain multiple line segments on the detected elliptical stamp; use the Bresenham line algorithm to obtain all the pixel points on each line segment; arrange all the line segments in parallel and close to each other, and scale each line segment so that the length of each line segment is the same, and the rectangular image composed of the multiple parallel line segments is used as the stamp image after the elliptical stamp is flattened; all the pixel points on each scaled line segment are used as a column of pixel points in the rectangular image, and then sent to the character recognition unit. The character recognition unit is used to perform text detection on the flattened stamp image, and then perform optical character recognition on the detected text to obtain the text recognition result.

[0016] The technical effect achieved by the present application is: combining multiple technologies such as stamp detection, circle or ellipse detection algorithm, sampling and stretching (flattening) of circle or ellipse images, text detection, OCR text recognition, etc., to flatten and recognize curved text in stamps. The entire method is in the form of software and can be easily installed in smart devices such as computers, smart phones, and tablets. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 , Figure 2These are schematic diagrams of two types of oval stamps.

[0018] Figure 3 It is a flow chart of the curved text flattening recognition method based on stamp contour proposed in this application.

[0019] Figure 4 It is a schematic diagram of obtaining multiple line segments on the circular stamp in step S30.

[0020] Figure 5 It is a schematic diagram of obtaining multiple line segments on the elliptical stamp in step S35.

[0021] Figure 6 yes Figure 5 A partial enlarged schematic diagram of the dotted rectangular box in the middle.

[0022] Figure 7 , Figure 8 They are Figure 1 , Figure 2 Image of the oval stamp shown flattened.

[0023] Fig. 9 It is a schematic diagram showing that the stamp image after flattening contains two discontinuous texts.

[0024] Fig.10 It is a schematic diagram of splicing two discontinuous texts in the flattened stamp image together.

[0025] Fig.11 It is a structural schematic diagram of a curved text flattening recognition device based on stamp contour proposed in this application.

[0026] Explanation of the reference numerals in the figures: 10 is a stamp detection unit, 20 is a circle or ellipse detection unit, 30 is a circle flattening unit, 35 is an ellipse flattening unit, and 40 is a character recognition unit. DETAILED DESCRIPTION

[0027] See also Figure 3 The curved text flattening recognition method based on stamp contour proposed in this application includes the following steps.

[0028] Step S10: Detect the stamp in the image and obtain the area where the stamp is located, which is called the stamp area. This step uses a general object detection method to detect the stamp. There are many general object detection methods. For example, the YOLO (You Only Look Once) algorithm is selected based on speed considerations.

[0029] Step S20: Detection is performed in the stamp area using a circle or ellipse detection algorithm. This step uses, for example, an EDCircles algorithm to detect circles or ellipses. The EDCircles algorithm is described in the article "EDCircles: A real-time circle detector with a false detection control" published in Volume 46, Issue 3 of Pattern Recognition magazine in March 2013, by Cuneyt Akinlar and Cihan Topal.

[0030] If a circle is detected in the stamp area, the center position and radius of the circle are obtained by the circle detection algorithm, and the process goes to step S30.

[0031] If an ellipse is detected in the stamp area, the two focus positions and the sizes of the major axis and the minor axis are obtained through the ellipse detection algorithm, and the process goes to step S35.

[0032] If no circle or ellipse is detected in the stamp area, it means that this is a rectangular stamp, and the process goes to step S40, where the rectangular stamp area is used as a flattened stamp image.

[0033] Step S30: For the detected circular stamp, Figure 4As shown, the center of the circle is point C. (1) Obtain multiple line segments on the circular stamp. The acquisition method is: take any point A1 on the circular contour of the stamp as the starting point, connect the center C and the starting point A1 to form the first line segment r1. Take the center C as the fixed point, rotate the first line segment r1 once in the clockwise direction (preferably) or counterclockwise direction at a fixed angle α, and obtain the second line segment r2, the third line segment r3, ... in turn. This application only uses all line segments r1, r2, ..., and discards the fan-shaped area between two adjacent line segments. Therefore, these line segments r1, r2, ... need to be dense enough to accurately sample the curved text in the stamp, so as to accurately restore the information of the curved text in the stamp, which requires α≤1 degree. The total number of all line segments is 360 / α (if divisible). Preferably, when α=1 degree, the total number of all line segments is 360. (2) Use Bresenham's line algorithm to obtain all the pixels on each line segment. (3) Arrange all the line segments in parallel and close to each other (i.e., the pixels of adjacent line segments are close together and are adjacent pixels), and the rectangular image composed of multiple parallel line segments is used as the stamp image after the circular stamp is flattened. All the pixels on each line segment are used as a column of pixels in the rectangular image, and the number of all line segments is used as the number of columns of the rectangular image. Then proceed to step S40.

[0034] Step S35: For the detected oval stamp, Figure 5 and Figure 6As shown, the two foci are point F1 and point F2, the distance between the two foci F1 and F2 is d, and the major axis of the ellipse is line segment MN. (1) Obtain multiple line segments on the elliptical stamp. The acquisition method is: (a) Connect a focus of the elliptical outline of the stamp with the major axis endpoint closest to the focus to form the first line segment r1. The first line segment r1 can be from point F1 to point M, or from point F2 to point N. Here, the first line segment r1 is taken as an example from point F1 to point M. Assume that the total number of all line segments is k, and k must be an even number. (b) First, translate the first line segment r1 along the major axis MN of the ellipse in the direction of the other focus (point F2) by a distance of 2d / k, and then use the endpoint of the translated first line segment on the major axis MN of the ellipse as a fixed point, rotate it in a clockwise direction (preferred) or counterclockwise direction by a fixed angle α, and extend or shorten the other endpoint until it intersects with the elliptical outline of the stamp to obtain the second line segment r2. The order of translation and rotation can be interchanged, or they can be performed simultaneously. First translate the second line segment r2 along the major axis MN of the ellipse in the direction of the other focus by a distance of 2d / k, then use the endpoint of the translated second line segment on the major axis MN of the ellipse as a fixed point, rotate it by a fixed angle α in the same direction as before, and extend or shorten the other endpoint until it intersects with the elliptical outline of the stamp to obtain the third line segment r3. The order of translation and rotation can be interchanged, or they can be performed simultaneously. And so on, until the k / 2th line segment r(k / 2) is obtained. The k / 2th line segment r(k / 2) is from point F2 to point N. The k / 2th line segment r(k / 2) and the first line segment r1 are both on the major axis MN of the ellipse. (c) First translate the k / 2th line segment along the major axis MN of the ellipse toward the initial focus (point F1) by a distance of 2d / k, then use the endpoint of the translated k / 2th line segment on the major axis MN of the ellipse as a fixed point, rotate it by a fixed angle α in the same direction as before, and extend or shorten the other endpoint until it intersects with the elliptical outline of the stamp to obtain the k / 2+1th line segment. The translation and rotation can be interchanged in order or performed simultaneously. First translate the k / 2+1th line segment along the major axis MN of the ellipse toward the initial focus by a distance of 2d / k, then use the endpoint of the translated k / 2+1th line segment on the major axis MN of the ellipse as a fixed point, rotate it by a fixed angle α in the same direction as before, and extend or shorten the other endpoint until it intersects with the elliptical outline of the stamp to obtain the k / 2+2th line segment. The translation and rotation can be interchanged in order or performed simultaneously. And so on, until the kth line segment rk is obtained. This application only uses all line segments r1, r2, ..., rk, and discards the area between two adjacent line segments. Therefore, these line segments r1, r2, ..., rk need to be dense enough to accurately sample the curved text in the stamp, so as to accurately restore the information of the curved text in the stamp, which requires α≤1 degree. The total number of all line segments is 360 / α (if divisible).Preferably, when α=1 degree, the total number of all line segments is 360. (2) Use the Bresenham line algorithm to obtain all pixel points on each line segment. (3) Arrange all line segments in parallel and close to each other (that is, the pixel points of adjacent line segments are close together and are adjacent pixel points), and scale each line segment so that the length of each line segment is the same (that is, it contains the same number of pixel points). The rectangular image composed of multiple parallel line segments is used as the stamp image after the elliptical stamp is flattened. All pixel points on each scaled line segment are used as a column of pixel points in the rectangular image, and the number of all line segments is used as the number of columns of the rectangular image. Preferably, all line segments are scaled to the size of the minor axis of the ellipse (that is, scaled to the number of pixel points contained in the minor axis). Then proceed to step S40.

[0035] Step S40: Perform text detection on the flattened stamp image, and then perform optical character recognition (OCR) on the detected text to obtain a text recognition result. This step uses, for example, an EAST (An Efficient and Accurate Scene Text Detector) algorithm to perform text detection.

[0036] See also Figure 7 or Figure 8 , Figure 7 yes Figure 1 The stamp image shown is the oval stamp after it is flattened. Figure 8 yes Figure 2 The stamp image after the oval stamp is flattened is shown. If only a continuous text is detected in a row in the flattened stamp image, the text in the row is subjected to OCR to obtain the text recognition result.

[0037] See also Fig. 9 If two discontinuous texts are detected in a line in the flattened stamp image, and the two texts are separated by other characters (such as characters that are obviously misplaced). This is usually because when obtaining multiple line segments in a circular or elliptical stamp, the position of the first line segment is not properly selected, resulting in the curved text in the stamp being broken into two discontinuous segments after flattening. In this case, the left text is spliced ​​to the end of the right text, such as Fig.10 As shown, the spliced ​​text lines are processed by OCR to obtain text recognition results.

[0038] See also Fig.11 The curved text flattening recognition device based on stamp contour proposed in the present application includes a stamp detection unit 10, a circle or ellipse detection unit 20, a circle flattening unit 30, an ellipse flattening unit 35, and a character recognition unit 40.

[0039] The stamp detection unit 10 is used to detect a stamp in an image to obtain a stamp area.

[0040] The circle or ellipse detection unit 20 is used to detect in the stamp area using a circle or ellipse detection algorithm. If a circle is detected in the stamp area, the center position and the radius are obtained by the circle detection algorithm and sent to the circle flattening unit 30. If an ellipse is detected in the stamp area, the two focus positions and the sizes of the major axis and the minor axis are obtained by the ellipse detection algorithm and sent to the ellipse flattening unit 35. If no circle or ellipse is detected in the stamp area, it is sent to the character recognition unit 40, and the rectangular stamp area is used as a flattened stamp image.

[0041] The circular flattening unit 30 is used to obtain multiple line segments on the detected circular stamp; use the Bresenham line algorithm to obtain all pixel points on each line segment; arrange all line segments in parallel, and the rectangular image composed of multiple parallel line segments is used as the stamp image after the circular stamp is flattened. All pixel points on each line segment are used as a column of pixel points in the rectangular image, and then sent to the character recognition unit 40.

[0042] The ellipse flattening unit 35 is used to obtain multiple line segments on the detected ellipse stamp; use the Bresenham line algorithm to obtain all pixel points on each line segment; arrange all line segments in parallel and close to each other, and scale each line segment so that the length of each line segment is the same, and the rectangular image composed of multiple parallel line segments is used as the stamp image after the ellipse stamp is flattened. All pixel points on each scaled line segment are used as a column of pixel points in the rectangular image, and then sent to the character recognition unit 40.

[0043] The character recognition unit 40 is used to perform text detection on the flattened stamp image, and then perform optical character recognition on the detected text to obtain a text recognition result.

[0044] In the curved text flattening recognition method and device based on stamp contour proposed in the present application, the stamp area in the image is first detected, and then a circle or ellipse is detected in the stamp area. Line segments (which can be understood as a sampling) are obtained for the detected circle or ellipse and stretched into a rectangular image. Text detection and OCR recognition are performed on the stretched rectangular image to finally obtain the information of the curved text in the stamp.

[0045] Compared with the prior art, the present application has the following beneficial technical effects.

[0046] First, the present application uses a circle or ellipse detection algorithm, such as the EDCircles algorithm, which can obtain the coordinates, length and other information of the circle or ellipse; combined with the Bresenham line algorithm, a better flattening (stretching) effect can be obtained for circular or elliptical stamps.

[0047] Second, when acquiring multiple line segments of an elliptical stamp, the present application combines the methods of translation and rotation, which has a better flattening effect on the elliptical image and improves the accuracy of subsequent text detection and recognition.

[0048] Third, the present application provides a method for processing when curved text in a stamp is cut into two sections during the flattening process, thereby improving the recognition effect of curved text in the stamp.

[0049] Fourth, the traditional image stretching or flattening method processes a certain image area (a collection of multiple pixel points). The present application converts the flattening of the stamp area into sampling the stamp area first, and then flattening (arranging in parallel) the multiple line segments obtained by sampling (each line segment is a column of pixel points), so only columns of pixel points need to be processed, which has higher computational efficiency, faster computational speed, and lower requirements on hardware computing resources.

[0050] The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should all be included in the protection scope of the present application.

Claims

1. A method for flattening and recognizing curved text based on stamp contour, characterized in that: The method comprises the following steps: Step S10: Detect the stamp in the image and obtain the stamp area; Step S20: Detection is performed in the stamp area using a circle or ellipse detection algorithm; If a circle is detected in the stamp area, the center position of the circle is obtained by the circle detection algorithm, and the process proceeds to step S30; If an ellipse is detected in the stamp area, two focus positions are obtained by the ellipse detection algorithm, and the process proceeds to step S35; If no circle or ellipse is detected in the stamp area, the process proceeds to step S40, where the stamp area is treated as a flattened stamp image; Step S30: for the detected circular stamp, obtain multiple line segments on the circular stamp; one end of all the line segments is the center of the circle, and the other end is on the circular contour of the stamp, and the angle between every two adjacent line segments is the same; use the Bresenham line algorithm to obtain all the pixel points on each line segment; arrange all the line segments in parallel and close to each other, and the rectangular image composed of the multiple parallel line segments is used as the stamp image after the circular stamp is flattened; all the pixel points on each line segment are used as a column of pixel points in the rectangular image, and then enter step S40; Step S35: for the detected elliptical stamp, a plurality of line segments on the elliptical stamp are obtained; the first ends of all the line segments are on the line connecting the two foci of the ellipse, the second ends are on the elliptical outline of the stamp, and the spacing between the first ends of every two adjacent line segments is the same, and the angle between every two adjacent line segments is the same; all pixel points on each line segment are obtained using the Bresenham line algorithm; all the line segments are arranged in parallel and close to each other, and the line segments are scaled so that the lengths of the line segments are the same, and the rectangular image composed of the plurality of parallel line segments is used as the stamp image after the elliptical stamp is flattened; All the pixels on each line segment after scaling are regarded as a column of pixels of the rectangular image, and then the process goes to step S40; Step S40: performing text detection on the flattened stamp image, and then performing optical character recognition on the detected text to obtain a text recognition result.

2. The method for flattening and recognizing curved text based on stamp contour according to claim 1, characterized in that: In step S10, a general object detection method is used to detect stamps in the image.

3. The method for flattening and recognizing curved text based on stamp contour according to claim 2, characterized in that: The general object detection method is that you only look at the YOLO algorithm once.

4. The method for flattening and recognizing curved text based on stamp contour according to claim 1, characterized in that: In the step S20, the circle or ellipse detection algorithm is the EDCircles algorithm.

5. The method for flattening and recognizing curved text based on stamp contour according to claim 1, characterized in that: In step S30, the multiple line segments on the circular stamp are obtained by: taking any point on the circular outline of the stamp as the starting point, connecting the center of the circle with the starting point to form the first line segment; taking the center of the circle as the fixed point, rotating the first line segment clockwise or counterclockwise once every fixed angle α, and obtaining the second line segment, the third line segment, and so on in sequence.

6. The method for flattening and recognizing curved text based on stamp contour according to claim 1, characterized in that: In step S35, the method of obtaining the multiple line segments on the elliptical stamp is as follows: (a) Connect one focus of the ellipse outline of the stamp with the endpoint of the major axis closest to the focus to form the first line segment; assume that the total number of all line segments is k, and k must be an even number; the distance between the two foci of the ellipse is d; (b) first translate the first line segment along the major axis of the ellipse in the direction of the other focus by a distance of 2d / k, then use the endpoint of the translated first line segment on the major axis of the ellipse as a fixed point, rotate it by a fixed angle α in a clockwise or counterclockwise direction, and extend or shorten the other endpoint until it intersects with the elliptical outline of the stamp to obtain the second line segment; the translation and rotation can be performed in either the reverse order or simultaneously; first translate the second line segment along the major axis of the ellipse in the direction of the other focus by a distance of 2d / k, then use the endpoint of the translated second line segment on the major axis of the ellipse as a fixed point, rotate it by a fixed angle α in the same direction as before, and extend or shorten the other endpoint until it intersects with the elliptical outline of the stamp to obtain the third line segment; the translation and rotation can be performed in either the reverse order or simultaneously; and so on and so forth until the k / 2th line segment is obtained, and the k / 2th line segment and the first line segment are both on the major axis of the ellipse; (c) First translate the k / 2th line segment along the major axis of the ellipse in the direction of the initial focus by a distance of 2d / k, then use the endpoint of the k / 2th line segment on the major axis of the ellipse as a fixed point, rotate it by a fixed angle α in the same direction as before, and extend or shorten the other endpoint until it intersects with the elliptical outline of the stamp to obtain the k / 2+1th line segment; the translation and rotation can be performed in either the same order or simultaneously; first translate the k / 2+1th line segment along the major axis of the ellipse in the direction of the initial focus by a distance of 2d / k, then use the endpoint of the k / 2+1th line segment on the major axis of the ellipse as a fixed point, rotate it by a fixed angle α in the same direction as before, and extend or shorten the other endpoint until it intersects with the elliptical outline of the stamp to obtain the k / 2+2th line segment; the translation and rotation can be performed in either the same order or simultaneously; and so on until the kth line segment is obtained.

7. The method for flattening and recognizing curved text based on stamp contour according to claim 5 or 6, characterized in that: α≤1 degree.

8. The method for flattening and recognizing curved text based on stamp contour according to claim 5 or 6, characterized in that: If divisible, the total number of line segments in a circular or elliptical stamp is 360 / α.

9. The method for flattening and recognizing curved text based on stamp contour according to claim 1, characterized in that: In the step S40, the efficient and accurate scene text detector EAST algorithm is used to perform text detection.

10. The method for flattening and recognizing curved text based on stamp contour according to claim 1, characterized in that: In the step S40, if two discontinuous texts are detected in a row of the flattened stamp image, the left text is spliced ​​to the end of the right text, and the spliced ​​text line is subjected to optical character recognition to obtain a text recognition result.

11. A device for flattening and recognizing curved text based on stamp contour, characterized in that: It includes a stamp detection unit, a circle or ellipse detection unit, a circle flattening unit, an ellipse flattening unit, and a character recognition unit; The stamp detection unit is used to detect a stamp in an image and obtain a stamp area; The circle or ellipse detection unit is used to detect in the stamp area using a circle or ellipse detection algorithm; if a circle is detected in the stamp area, the center position of the circle is obtained by the circle detection algorithm and sent to the circle flattening unit; if an ellipse is detected in the stamp area, two focus positions are obtained by the ellipse detection algorithm and sent to the ellipse flattening unit; if no circle or ellipse is detected in the stamp area, it is sent to the character recognition unit, and the stamp area is used as a flattened stamp image; The circular flattening unit is used to obtain multiple line segments on the detected circular stamp; one end of all the line segments is the center of the circle, and the other end is on the circular outline of the stamp, and the angle between every two adjacent line segments is the same; all the pixel points on each line segment are obtained by using the Bresenham line algorithm; all the line segments are arranged in parallel and close to each other, and a rectangular image composed of multiple parallel line segments is used as the stamp image after the circular stamp is flattened; all the pixel points on each line segment are used as a column of pixel points of the rectangular image, and then sent to the character recognition unit; The ellipse flattening unit is used to obtain multiple line segments on the detected ellipse stamp; the first ends of all the line segments are on the line connecting the two foci of the ellipse, and the second ends are on the ellipse contour of the stamp, and the spacing between the first ends of every two adjacent line segments is the same, and the angle between every two adjacent line segments is the same; all pixel points on each line segment are obtained by using the Bresenham straight line algorithm; all the line segments are arranged in parallel and close to each other, and the line segments are scaled so that the lengths of the line segments are the same, and the rectangular image composed of the multiple parallel line segments is used as the stamp image after the ellipse stamp is flattened; all the pixel points on each scaled line segment are used as a column of pixel points of the rectangular image, and then sent to the character recognition unit; The character recognition unit is used to perform text detection on the flattened stamp image, and then perform optical character recognition on the detected text to obtain a text recognition result.

Citation Information

Patent Citations

  • Intelligent seal detection and identification method

    CN110728277A

  • Character recognition method and device and computer readable storage medium

    CN111046754A