A seal character recognition method
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NANCHANG HANGKONG UNIVERSITY
- Filing Date
- 2026-06-30
- Publication Date
- 2026-08-07
AI Technical Summary
又如申请号为“CN202411515387”的专利文献公开了一种包含印章图像的多内容识别方法,通过先识别非手写文本再定位印章区域的方式进行印章信息抽取,但其印章识别模块仅基于简单区域分割与对称性假设,缺乏对环形文字结构的专门建模,在面对文字密集、字体变形或印章残缺等情况时鲁棒性不足
[0014] The beneficial effects of this invention are as follows: For the ring-shaped and arc-shaped text commonly found in circular or elliptical seals, this invention significantly improves the recognition accuracy of non-horizontally linear text by intelligently judging the text layout and combining interference text removal, polar coordinate expansion and adaptive text line extraction strategies, thus solving the technical problem that traditional OCR technology cannot handle non-linear text layout.
Smart Images

Figure CN122531031A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of image processing and character recognition technology, specifically to a method for recognizing characters on a seal. Background Technology
[0002] With the development of office automation and document digitization, seal recognition has become increasingly important in various document processing scenarios. Seals are widely used in various formal occasions such as government and business, and their text recognition presents unique challenges. The text in circular and oval seals is usually arranged in a ring or arc shape, and may contain various layouts such as ring-shaped text and central text. Traditional OCR technology has difficulty directly processing such non-horizontally arranged text.
[0003] Therefore, specialized recognition methods for oval seals have gradually attracted attention, but existing technologies still have significant limitations in practical applications. On the one hand, conventional OCR engines are mainly optimized for horizontally or nearly horizontally arranged text, and their performance is poor for curved or ring-shaped text, resulting in a significant decrease in recognition accuracy. On the other hand, although some studies have attempted to adapt ring-shaped text through image geometric transformation or text region extraction, in practical applications, these methods are still susceptible to problems such as seal image tilt, uneven lighting, background interference, and blurred edges, making it difficult to accurately locate and effectively expand the text region.
[0004] For example, patent document with application number "CN202510071652" discloses a method for recognizing seals on medical invoices. It uses a multi-level feature fusion network for text boundary detection and combines polar coordinate unfolding with OCR recognition to extract seal content. While this method improves boundary recognition accuracy in specific scenarios, it does not fully address general issues such as uncertain seal image rotation angles and excessive interference from inner contours. Another example is patent document with application number "CN202411515387," which discloses a multi-content recognition method including seal images. This method extracts seal information by first recognizing non-handwritten text and then locating the seal area. However, its seal recognition module is based solely on simple region segmentation and symmetry assumptions, lacking specialized modeling for circular text structures. This results in insufficient robustness when faced with dense text, font distortion, or incomplete seals.
[0005] Therefore, there is an urgent need for a seal character recognition method that can automatically complete seal image correction, accurate extraction of inner contours, efficient expansion of circular characters, and optimization of text images, in order to overcome the inherent defects of traditional OCR technology in processing non-linear text and improve the accuracy, robustness, and applicability of seal recognition. Summary of the Invention
[0006] To address the aforementioned technical problems, this invention proposes a method for recognizing characters on seals. This method can automatically process elliptical and circular seal images, accurately extract the inner ring outline of the seal, intelligently determine the text arrangement, effectively expand the circular text, and finally achieve text recognition through OCR technology.
[0007] This invention proposes a method for recognizing characters on a seal, which includes the following steps: Step S1; Image preprocessing: Read the first seal image I1, perform rotation and correction processing on the first seal image I1 to obtain the second seal image I2: Step S2; Seal region extraction: The inner ring contour of the seal in the second seal image I2 is extracted using contour detection and ellipse fitting algorithm. The area outside the inner ring contour of the seal is set to a white background to obtain the third seal image I3. Step S3; Target text extraction and processing: Remove non-target text content from the third seal image I3, detect and extract the target text region to obtain the seal text image I. t , Step S4; OCR recognition: I... (The rest of the text image is missing from the original text and can be omitted.) t Perform OCR recognition to obtain the seal text recognition results; Step S3, the specific steps are as follows: Step S31; Text arrangement determination: Binarize the third seal image I3 to obtain the first seal binary image I. b1 , let w s1 Represents the binary image I of the first seal b1 The width, based on the binary image I of the first seal. b1 The target text region is obtained by projection, and the y-coordinate value of the upper boundary of the target text region is calculated. s and the y-coordinate value of the lower boundary of the target text region. e Determine the text arrangement in the target text region of the third seal image I3; Step S32; Horizontal text processing: If the target text is arranged horizontally, then in the third seal image I3, it is processed using the format (0, y). s () is the origin, and the extracted height is y. e -y s Width is w s1 The rectangular area is used to obtain the seal text image I. t Proceed to step S36; Step S33; Circular text preprocessing: If the target text is arranged in a circular pattern, remove the first stamp binary image I. b1 The content of the target text region in the Chinese and African languages is used to obtain the binary image I of the second seal. b2 ; Step S34; Polar coordinate expansion: Expand the third seal image I3 and the second seal binary image I b2 Perform polar coordinate expansion to obtain the expanded image of the third seal and the binary image I of the text line of the first seal. tb1 ; Step S35; Expand the image and extract text: Based on the binary image I of the first seal text line. tb1 By projecting the image onto the target text region, and then extracting the target text region from the unfolded image of the third seal image, we obtain the seal text image I. t ; Step S36: Complete text extraction.
[0008] Further, in step S1, the first seal image I1 is subjected to rotation correction processing to obtain the rotation-corrected second seal image I2. The specific steps are as follows: Step S11: Use an image binarization algorithm to binarize the first seal image I1 to obtain the third seal binary image I. b3 ; Step S12: Use an edge detection algorithm to process the binary image I of the third seal. b3 Perform edge detection to obtain the first edge image I c1 A contour detection algorithm is used to analyze the first edge image I. c1 The contours in the image are detected and added to the first contour set C1; the contour with the largest area is found from the first contour set C1 to obtain the seal contour c. s ; Step S13; Set the rectangle aspect ratio threshold r rwh ; Calculate the seal outline c s The minimum bounding rectangle R m Let x rc R represents the minimum bounding rectangle m Let the x-coordinate of the geometric center point be y. rc R represents the minimum bounding rectangle m Let h be the y-coordinate of the geometric center point. r R represents the minimum bounding rectangle m The height of w r R represents the minimum bounding rectangle m Let the width be denoted by angle, and let angle represent the minimum bounding rectangle R. m The angle between the longer side and the horizontal direction, with the angle ranging from [0, 90], if max(w r ,h r ) / min(w r ,h r )>r rwh Then, for the first seal image I1, around the center point (x) rc ,yrc Rotate the angle by a factor such that the minimum bounding rectangle R is minimized. m The longer side is parallel to the horizontal line, resulting in the corrected stamp image I. r Otherwise, the first seal image I1 is directly used as the correction seal image Iᵣ. Step S14; In the calibration stamp image I r In the coordinates (x) rc -w r / 2,y rc -h r / 2) is the origin, and the extracted height is the minimum bounding rectangle R. m height h r The width is the minimum bounding rectangle R m Width w r The rectangular area graphic is used to obtain the second seal image I2.
[0009] Furthermore, in step S2, a contour detection and ellipse fitting algorithm is used to extract the inner ring contour of the second seal image I2. The specific steps are as follows: Step S21: Use an image binarization algorithm to binarize the second seal image I2 to obtain the fourth seal binary image I. b4 ; Step S22: Use an edge detection algorithm to process the binary image I of the fourth seal. b4 Edge detection is performed to obtain the second edge image I. c2 A contour detection algorithm is used to analyze the second edge image I. c2 The contours in the image are detected and added to the second edge contour set C2; the contour with the largest area is taken from the second edge contour set C2 as the outer ring contour of the seal, and the fourth seal binary image I is processed. b4 Invert all pixels within the outer contour region of the seal to obtain the binary image I of the fifth seal. b5 ; Step S23: Use an edge detection algorithm to process the binary image I of the fifth seal. b5 Edge detection is performed to obtain the third edge image I. c3 A contour detection algorithm is used to analyze the third edge image I. c3 The contours in the middle are detected and added to the third edge contour set C3; the contour with the largest area is taken from the third edge contour set C3 as the inner ring contour of the seal.
[0010] Further, in step S31, based on the binary image I of the first seal... b1 The target text region is obtained by projection, and the y-coordinate value of the upper boundary of the target text region is calculated. s and the y-coordinate value of the lower boundary of the target text region. eTo determine the text arrangement in the target text region of the third seal image I3, the specific steps are as follows: Step S311; For the binary image I of the first seal b1 Perform horizontal projection to obtain the first horizontal projection array P. h1 Let h s1 Represents the binary image I of the first seal b1 Height; Set the first text height threshold h t1 Set the height h of the first seal text area. a1 h a1 Let h be the height of the first seal text area. a1 The initial value is set to 0; the y-coordinate value of the upper boundary of the target text region is set. s y s As a variable, set the y-coordinate value of the upper boundary of the target text region. s The initial value is set to 0; the first effective projection threshold p1 is set; the first loop variable ia is set, and its initial value is set to 1, and P is set to 0. h1,ia Represents the first horizontal projection array P h1 The ia-th element; Step S3111; If ia>h s1 Then proceed to step S3118; Step S3112; If P h1,ia If ≤p1, then proceed to step S3116; Step S3113; Increase the height h of the first seal text area a1 The value increases by 1; Step S3114; if h a1 <h t1 Then proceed to step S3117; Step S3115; Let y s =ia-h t1 Proceed to step S3118; Step S3116; Increase the height h of the first seal text area a1 Set the value to 0; Step S3117: Increment the value of the first loop variable ia by 1, and proceed to step S3111; Step S3118; Complete the calculation of the y-coordinate value of the upper boundary of the target text region. s Calculation; Step S312; Set the first text gap height threshold h ts1 Set the spacing height h between the characters on the first seal. g1 h g1 Let h be the height of the spacing between the characters on the first seal. g1The initial value is set to 0; the y-coordinate value of the lower boundary of the target text region is set. e y e As a variable, set the y-coordinate value of the lower boundary of the target text region. e The initial value is set to h. s1 Set the second effective projection threshold p2; set the second loop variable ib, and initialize the second loop variable ib to y. s +h t1 , let P h1,ib Represents the first horizontal projection array P h1 The ibth element; Step S3121; If ib > h s1 Then proceed to step S3128; Step S3122; If P h1,ib If p2 is reached, proceed to step S3126; Step S3123; Adjust the spacing height h between the characters on the first seal. g1 The value increases by 1; Step S3124; if h g1 <h ts1 Then proceed to step S3127; Step S3125; Let y e =ib-h ts1 Proceed to step S3128; Step S3126; Adjust the spacing height h between the characters on the first seal. g1 Set the value to 0; Step S3127: Increment the value of the second loop variable ib by 1, then proceed to step S3121; Step S3128; Complete the calculation of the lower boundary y-coordinate value of the target text region. e Calculation; Step S313; Set the first line text proportion threshold r t1 Set the first height ratio threshold r h1 Set the left boundary x of the first text region. l x l Set the right boundary x of the first text region as a variable. r x r Set the y-coordinate value of the lower boundary of the first text region as a variable. down y down Let I be a variable; determine the text arrangement of the target text region in the third seal image I3, the specific steps are as follows: Step S3131; Left boundary x of the first text region l and the right boundary x of the first text region r The calculation method is as follows: ; ; Step S3132; in the first binary image of the seal I b1 In, with (x l (0) is the origin, and the extraction height is h. s1 Width is r t1 *w s1 The rectangular region is used to obtain the binary image I of the sixth seal. b6 ; Step S3133; For the binary image I of the sixth seal b6 Perform horizontal projection to obtain the second horizontal projection array P. h2 ; Step S3134; Set the spacing height h between the characters on the second seal. g2 h g2 Let h be the height of the spacing between the characters on the second seal. g2 The initial value is set to 0; the third effective projection threshold p3 is set; the third loop variable ic is set, and its initial value is set to y. s , let P h2,ic Represents the second horizontal projection array P h2 The ic-th element; Step S31341; If ic > h s1 Then proceed to step S31348; Step S31342; If P h2,ic If p3 is reached, proceed to step S31346; Step S31343; Adjust the spacing height h between the characters on the second seal. g2 The value increases by 1; Step S31344; if h g2 ≤h ts1 Then proceed to step S31347; Step S31345; Let y down =ic-h ts1 Proceed to step S31348; Step S31346; Adjust the spacing height h between the characters on the second seal. g2 Set the value to 0; Step S31347: Increment the value of the third loop variable ic by 1, then proceed to step S31341; Step S31348: Complete the calculation of the y-coordinate value of the lower boundary of the text in the first text region. down Calculation;
[0011] Step S314; if If the text in the target text region of the third seal image I3 is horizontally arranged, then the text in the target text region of the third seal image I3 is circularly arranged.
[0012] Further, in step S33, the binary image I of the first seal is removed. b1 The content of the target text region in the Chinese and African languages is used to obtain the binary image I of the second seal. b2 The specific steps are as follows: Step S331: Use an edge detection algorithm to process the binary image I of the first seal. b1 Edge detection is performed to obtain the fourth edge image I. c4 A contour detection algorithm is used to analyze the fourth edge image I. c4 The contours in the set are detected and added to the fourth edge contour set C4. Step S332; For each edge contour C in the fourth edge contour set C4 4,i Calculate edge profile C 4,i The bounding rectangle, and the edge contour C 4,i and edge contour C 4,i The outer rectangles are combined to form edge contour rectangle units, and the edge contour rectangle units are added to the first edge contour rectangle unit set R1. Step S333; Let C noise Let C represent the set of interfering contours. noise Initialize to empty; let D represent the edge contour index set, and initialize the edge contour index set D to empty; set the first quantity threshold T1; let N c4 This represents the total number of elements in the fourth edge contour set C4; the fourth loop variable id is set, with its initial value set to 1, and C... 4,id Let R represent the id-th edge contour in the fourth edge contour set C4. 1,id Let R represent the id-th edge contour rectangle element in the first edge contour rectangle element set R1. 1,id,w Represents the rectangular frame unit R of the edge contour 1,id Let R be the width of the rectangle. 1,id,h Represents the rectangular frame unit R of the edge contour 1,id The height of the rectangle; Step S3331; If id > N c4 Then proceed to step S3337; Step S3332; If the first stamp binary image I b1 The geometric center point is located at the id-th edge contour C in the fourth edge contour set C4. 4,id Internally, proceed to step S3335; Step S3333; If R1,id,w / R 1,id,h If T1 is reached, proceed to step S3335. Step S3334; Proceed to step S3336; Step S3335; The id-th edge contour C of the fourth edge contour set C4 is... 4,id Add interference contour set C noise Add the fourth loop variable id to the edge contour index set D; Step S3336; Increment the value of the fourth loop variable id by 1, then proceed to step S3331; Step S3337; Process ends; Step S334: For each edge contour index Di in the edge contour index set D, find the edge contour rectangle cell R with edge contour index Di in the first edge contour rectangle cell set R1. 1,Di The edge outline rectangle unit R 1,Di Remove from the first edge contour rectangle frame unit set R1; sort the first edge contour rectangle frame unit set R1 according to the y-coordinate value of the rectangle center point of the edge contour rectangle frame unit from largest to smallest to obtain the second edge contour rectangle frame unit set R2; Step S335; Set the threshold T for irregular spacing width w Set the noise threshold t noi Set the height difference threshold h1; Set the maximum height difference h between text within the same line. m h m Let h be the maximum height difference between texts in the same row. m Set the initial value; set the y-coordinate value of the upper boundary of the text line. u y u As a variable, set the y-coordinate value of the upper boundary of the text line to y. u The initial value is set to -1; the y-coordinate value of the lower boundary of the text line is set. d y d As a variable, set the y-coordinate value of the lower boundary of the text line to y. d Set the initial value to -1; set the processing end flag f. stop f stop The variable will be the end-of-process marker f. stop Set the initial value of N to 0; let N R2 Let T represent the total number of elements in the second edge contour rectangle unit R2; s This represents the set of rectangular cells representing the outline of the text edges. The set T of rectangular cells representing the outline of the text edges is... s Initialize to empty; set the fifth loop variable ie, and initialize the fifth loop variable ie to 1, let R 2,ieLet R represent the ie-th edge contour rectangle element of the second edge contour rectangle element R2. 2,ie,x Represents the rectangular frame unit R of the edge contour 2,ie Let R be the x-coordinate of the center point of the rectangle. 2,ie,y Represents the rectangular frame unit R of the edge contour 2,ie The y-coordinate of the center point of the rectangle, R 2,ie,w Represents the rectangular frame unit R of the edge contour 2,ie The width of the rectangle, R 2,ie,h Represents the rectangular frame unit R of the edge contour 2,ie The height of the rectangle; Step S3351; If ie > N R2 or f stop If the value is greater than 0, proceed to step S3358; Step S3352; If R 2,ie,h <t noi And R 2,ie,w <t noi Then proceed to step S3357; Step S3353; If y d <0 or R 2,ie,y +R 2,ie,h / 2-y d ≤h m or y u -(R2 ,ie,y - R2 ,ie,h / 2)≤h m Then proceed to step S3355; Step S3354; Collect the set T of rectangular frames representing the outlines of the text lines. s Non-target text edge contours are added to the interference contour set C. noise The specific steps are as follows: Step S33541; Let N ts T represents the set of rectangular cells representing the outline of the text edges. s The number of elements, setting the first character count threshold n. t1 Let the second character count threshold be n. t2 ; Step S33542; If N ts <n t1 Then proceed to step S33545; Step S33543; Remove the rectangular frame unit set T of the text edge outline. s The invalid edge outline rectangle element in the text will be removed from the set T of line text edge outline rectangle elements. s Add the edge contour of the middle edge contour rectangle element to the set of disturbance contours C. noise ; Step S33544; Proceed to step S33546; Step S33545; Set the processing end marker f stop Set the value to 1; Step S33546; Process ends; Step S3355; The edge contour rectangle unit R 2,ie Add text edge outline rectangle cell set T s ; Step S3356; Update the y-coordinate value of the upper boundary of the text line. u and the y-coordinate value of the lower boundary of the text line. d The specific steps are as follows: Step S33561; If y d If ≥0, proceed to step S33563; Step S33562; Let h m =max(R 2,ie,h ,h1); Step S33563; Let y d =max(R 2,ie,y +R2 ,ie,h / 2,y d ); Step S33564; if y u If ≥0, proceed to step S33566; Step S33565; Let y u =min(R 2,ie,y - R 2,ie,h / 2, y d + R 2,ie,h Proceed to step S33567; Step S33566; Let y u =min(R 2,ie,y - R 2,ie,h / 2, y d + R 2,ie,h ,y u ); Step S33567; Complete the y-coordinate value of the upper boundary of the text line. u and the y-coordinate value of the lower boundary of the text line. d Update; Step S3357; Increment the value of the fifth loop variable ie by 1, then proceed to step S3351; Step S3358; End processing of the interference contour set C noise The collection; Step S336; Extract the set of interference contours C noise Each contour C noise,id , contour C noise,idThe corresponding binary image I of the first seal b1 The pixels in the region are set to black to obtain the second stamp binary image I. b2 .
[0013] Further, in step S35, based on the binary image I of the first seal text line... tb1 By projecting the image onto the target text region, and then extracting the target text region from the unfolded image of the third seal image, we obtain the seal text image I. t The specific steps are as follows: Step S351; Set the y-coordinate value of the upper boundary of the target text region. ts y ts Set the y-coordinate value of the lower boundary of the target text region as a variable. te y te Set the x-coordinate value of the left boundary of the target text region as a variable. ts x ts Set the x-coordinate value of the right boundary of the target text region as a variable. te x te Let h be a variable; u Represents the binary image I of the first seal text line. tb1 The height; let w u Represents the binary image I of the first seal text line. tb1 The width; Step S352; For the binary image I of the first seal text line... tb1 Perform horizontal projection to obtain the third horizontal projection array P. h3 Set the fourth projection threshold p4; Set the height h of the second seal text area. a2 h a2 For variable h a2 Set the initial height of the second seal text area to 0; set the second text height threshold h. t2 Set the ninth loop variable ii, initialize the ninth loop variable ii to 1, and let P h3,ii Represents the third-level projection array P h3 The iith element; Step S3521; if ii>h u Then proceed to step S3528; Step S3522; If P h3,ii If p4 is less than or equal to p4, proceed to step S3526. Step S3523; Increase the height h of the text area of the second seal. a2 The value increases by 1; Step S3524; if h a2 <h t2 Then proceed to step S3527; Step S3525; Let y ts =ii-h t2 Proceed to step S3528; Step S3526; Increase the height h of the text area of the second seal. a2 Set the value to 0; Step S3527; Increment the value of the ninth loop variable ii by 1, and proceed to step S3521; Step S3528; Complete the calculation of the y-coordinate value of the upper boundary of the target text region. ts Calculation; Step S353; Set variable h a3 This indicates the height of the text area of the third seal. The height h of the text area of the third seal is... a3 The initial value is set to 0; the tenth loop variable ij is set, and its initial value is set to h. u , let P h3,ij Represents the third-level projection array P h3 The ij-th element; Step S3531; if ij <y ts Then proceed to step S3538; Step S3532; If P h3,ij If p4 is less than or equal to p4, proceed to step S3536. Step S3533; Increase the height h of the text area of the third seal. a3 The value increases by 1; Step S3534; if h a3 <h t2 Then proceed to step S3537; Step S3535; Let y te =ij+h t2 Proceed to step S3538; Step S3536; Increase the height h of the text area of the third seal. a3 Set the value to 0; Step S3537: Decrease the value of the tenth loop variable ij by 1, and proceed to step S3531; Step S3538; Complete the calculation of the lower boundary y-coordinate value of the target text region. te Calculation; Step S354; in the binary image I of the first seal text line. tb1 In the middle, with (0, y ts () is the origin, and the extracted height is y. te -y ts Width is w u The region is used to obtain the binary image I of the second seal text line. tb2 ; Step S355; For the binary image I of the second seal text line... tb2 Perform vertical projection to obtain the vertical projection array P. v Set the width of the first seal text area (w) a1 w a1 Let w be the width of the first seal text area. a1 The initial value is set to 0; the fifth projection threshold p5 is set; the target text width threshold w is set. t Set the eleventh loop variable ik, and initialize the eleventh loop variable ik to 1. Let P v,ik This represents the ik-th element of the vertical projection array Pv; Step S3551; If ik > w u Then proceed to step S3558; Step S3552; If P v,ik If ≤p5, proceed to step S3556; Step S3553; Increase the width w of the first seal text area a1 The value increases by 1; Step S3554; if w a1 <w t Then proceed to step S3557; Step S3555; Let x ts =ik-w t Proceed to step S3558; Step S3556; Increase the width w of the first seal text area a1 Set the value to 0; Step S3557; Increment the value of the eleventh loop variable ik by 1, and proceed to step S3551; Step S3558; Complete the x-coordinate value of the left boundary of the target text region. ts Calculation; Step S356; Set the width w of the text area of the second seal. a2 w a2 For variable w a2 The width of the text area of the second seal is w a2 The initial value is set to 0; the twelfth loop variable il is set, and its initial value is set to w. u , let P v,il This represents the il-th element of the vertical projection array Pv; Step S3561; If il <x ts Then proceed to step S3568; Step S3562; If P v,il If ≤p5, proceed to step S3566; Step S3563; Increase the width w of the text area of the second seal. a2 The value increases by 1; Step S3564; if w a2 <w t Then proceed to step S3567; Step S3565; Let x te =il+w t Proceed to step S3568; Step S3566; Increase the width w of the text area of the second seal. a2 Set the value to 0; Step S3567: Decrease the value of the twelfth loop variable il by 1, and proceed to step S3561; Step S3568; Complete the x-coordinate value of the right boundary of the target text region. te Calculation; Step S357; In the unfolded diagram of the third seal image, with (x ts ,y ts (x) is the origin, and the extraction width is x. te -x ts The height is y te -y ts The region yields the seal line text image I. t .
[0014] The beneficial effects of this invention are as follows: For the ring-shaped and arc-shaped text commonly found in circular or elliptical seals, this invention significantly improves the recognition accuracy of non-horizontally linear text by intelligently judging the text layout and combining interference text removal, polar coordinate expansion and adaptive text line extraction strategies, thus solving the technical problem that traditional OCR technology cannot handle non-linear text layout. Attached Figure Description
[0015] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.
[0016] Figure 1 This is a flowchart of a method according to an embodiment of the present invention. Detailed Implementation
[0017] The specific embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. It should be noted that the specific embodiments of a circular seal character recognition method according to the present invention are merely examples and are not intended to limit the scope of the invention.
[0018] like Figure 1 As shown, a method for recognizing characters on a seal includes the following steps: Step S1; Image preprocessing: Read the first seal image I1, perform rotation and correction processing on the first seal image I1 to obtain the second seal image I2: Step S2; Seal region extraction: The inner ring contour of the seal in the second seal image I2 is extracted using contour detection and ellipse fitting algorithm. The area outside the inner ring contour of the seal is set to a white background to obtain the third seal image I3. Step S3; Target text extraction and processing: Remove non-target text content from the third seal image I3, detect and extract the target text region to obtain the seal text image I. t , Step S4; OCR recognition: I... (The rest of the text image is missing from the original text and can be omitted.) t Perform OCR recognition to obtain the seal text recognition results; Step S3, the specific steps are as follows: Step S31; Text arrangement determination: Binarize the third seal image I3 to obtain the first seal binary image I. b1 , let w s1 Represents the binary image I of the first seal b1 The width, based on the binary image I of the first seal. b1 The target text region is obtained by projection, and the y-coordinate value of the upper boundary of the target text region is calculated. s and the y-coordinate value of the lower boundary of the target text region. e Determine the text arrangement in the target text region of the third seal image I3; Step S32; Horizontal text processing: If the target text is arranged horizontally, then in the third seal image I3, it is processed using the format (0, y). s () is the origin, and the extracted height is y. e -y s Width is w s1 The rectangular area is used to obtain the seal text image I. t Proceed to step S36; Step S33; Circular text preprocessing: If the target text is arranged in a circular pattern, remove the first stamp binary image I. b1 The content of the target text region in the Chinese and African languages is used to obtain the binary image I of the second seal. b2 ; Step S34; Polar coordinate expansion: Expand the third seal image I3 and the second seal binary image I b2 Perform polar coordinate expansion to obtain the expanded image of the third seal and the binary image I of the text line of the first seal. tb1 ; Step S35; Expand the image and extract text: Based on the binary image I of the first seal text line. tb1By projecting the image onto the target text region, and then extracting the target text region from the unfolded image of the third seal image, we obtain the seal text image I. t ; Step S36: Complete text extraction.
[0019] Further, in step S1, the first seal image I1 is subjected to rotation correction processing to obtain the rotation-corrected second seal image I2. The specific steps are as follows: Step S11: Use an image binarization algorithm to binarize the first seal image I1 to obtain the third seal binary image I. b3 ; Step S12: Use an edge detection algorithm to process the binary image I of the third seal. b3 Perform edge detection to obtain the first edge image I c1 A contour detection algorithm is used to analyze the first edge image I. c1 The contours in the image are detected and added to the first contour set C1; the contour with the largest area is found from the first contour set C1 to obtain the seal contour c. s ; Step S13; Set the rectangle aspect ratio threshold r rwh ; Calculate the seal outline c s The minimum bounding rectangle R m Let x rc R represents the minimum bounding rectangle m Let the x-coordinate of the geometric center point be y. rc R represents the minimum bounding rectangle m Let h be the y-coordinate of the geometric center point. r R represents the minimum bounding rectangle m The height of w r R represents the minimum bounding rectangle m Let the width be denoted by angle, and let angle represent the minimum bounding rectangle R. m The angle between the longer side and the horizontal direction, with the angle ranging from [0, 90], if max(w r ,h r ) / min(w r ,h r )>r rwh Then, for the first seal image I1, around the center point (x) rc ,y rc Rotate the angle by a factor such that the minimum bounding rectangle R is minimized. m The longer side is parallel to the horizontal line, resulting in the corrected stamp image I. r Otherwise, the first seal image I1 is directly used as the correction seal image Iᵣ. Step S14; In the calibration stamp image I r In the coordinates (x)rc -w r / 2,y rc -h r / 2) is the origin, and the extracted height is the minimum bounding rectangle R. m height h r The width is the minimum bounding rectangle R m Width w r The rectangular area graphic is used to obtain the second seal image I2.
[0020] Furthermore, in step S2, a contour detection and ellipse fitting algorithm is used to extract the inner ring contour of the second seal image I2. The specific steps are as follows: Step S21: Use an image binarization algorithm to binarize the second seal image I2 to obtain the fourth seal binary image I. b4 ; Step S22: Use an edge detection algorithm to process the binary image I of the fourth seal. b4 Edge detection is performed to obtain the second edge image I. c2 A contour detection algorithm is used to analyze the second edge image I. c2 The contours in the image are detected and added to the second edge contour set C2; the contour with the largest area is taken from the second edge contour set C2 as the outer ring contour of the seal, and the fourth seal binary image I is processed. b4 Invert all pixels within the outer contour region of the seal to obtain the binary image I of the fifth seal. b5 ; Step S23: Use an edge detection algorithm to process the binary image I of the fifth seal. b5 Edge detection is performed to obtain the third edge image I. c3 A contour detection algorithm is used to analyze the third edge image I. c3 The contours in the middle are detected and added to the third edge contour set C3; the contour with the largest area is taken from the third edge contour set C3 as the inner ring contour of the seal.
[0021] Further, in step S31, based on the binary image I of the first seal... b1 The target text region is obtained by projection, and the y-coordinate value of the upper boundary of the target text region is calculated. s and the y-coordinate value of the lower boundary of the target text region. e To determine the text arrangement in the target text region of the third seal image I3, the specific steps are as follows: Step S311; For the binary image I of the first seal b1 Perform horizontal projection to obtain the first horizontal projection array P. h1 Let h s1 Represents the binary image I of the first seal b1Height; Set the first text height threshold h t1 Set the height h of the first seal text area. a1 h a1 Let h be the height of the first seal text area. a1 The initial value is set to 0; the y-coordinate value of the upper boundary of the target text region is set. s y s As a variable, set the y-coordinate value of the upper boundary of the target text region. s The initial value is set to 0; the first effective projection threshold p1 is set; the first loop variable ia is set, and its initial value is set to 1, and P is set to 0. h1,ia Represents the first horizontal projection array P h1 The ia-th element; Step S3111; If ia>h s1 Then proceed to step S3118; Step S3112; If P h1,ia If ≤p1, then proceed to step S3116; Step S3113; Increase the height h of the first seal text area a1 The value increases by 1; Step S3114; if h a1 <h t1 Then proceed to step S3117; Step S3115; Let y s =ia-h t1 Proceed to step S3118; Step S3116; Increase the height h of the first seal text area a1 Set the value to 0; Step S3117: Increment the value of the first loop variable ia by 1, and proceed to step S3111; Step S3118; Complete the calculation of the y-coordinate value of the upper boundary of the target text region. s Calculation; Step S312; Set the first text gap height threshold h ts1 Set the spacing height h between the characters on the first seal. g1 h g1 Let h be the height of the spacing between the characters on the first seal. g1 The initial value is set to 0; the y-coordinate value of the lower boundary of the target text region is set. e y e As a variable, set the y-coordinate value of the lower boundary of the target text region. e The initial value is set to h. s1 Set the second effective projection threshold p2; set the second loop variable ib, and initialize the second loop variable ib to y. s +ht1 , let P h1,ib Represents the first horizontal projection array P h1 The ibth element; Step S3121; If ib > h s1 Then proceed to step S3128; Step S3122; If P h1,ib If p2 is reached, proceed to step S3126; Step S3123; Adjust the spacing height h between the characters on the first seal. g1 The value increases by 1; Step S3124; if h g1 <h ts1 Then proceed to step S3127; Step S3125; Let y e =ib-h ts1 Proceed to step S3128; Step S3126; Adjust the spacing height h between the characters on the first seal. g1 Set the value to 0; Step S3127: Increment the value of the second loop variable ib by 1, then proceed to step S3121; Step S3128; Complete the calculation of the lower boundary y-coordinate value of the target text region. e Calculation; Step S313; Set the first line text proportion threshold r t1 Set the first height ratio threshold r h1 Set the left boundary x of the first text region. l x l Set the right boundary x of the first text region as a variable. r x r Set the y-coordinate value of the lower boundary of the first text region as a variable. down y down Let I be a variable; determine the text arrangement of the target text region in the third seal image I3, the specific steps are as follows: Step S3131; Left boundary x of the first text region l and the right boundary x of the first text region r The calculation method is as follows: ; ; Step S3132; in the first binary image of the seal I b1 In, with (x l (0) is the origin, and the extraction height is h. s1 Width is r t1 *w s1The rectangular region is used to obtain the binary image I of the sixth seal. b6 ; Step S3133; For the binary image I of the sixth seal b6 Perform horizontal projection to obtain the second horizontal projection array P. h2 ; Step S3134; Set the spacing height h between the characters on the second seal. g2 h g2 Let h be the height of the spacing between the characters on the second seal. g2 The initial value is set to 0; the third effective projection threshold p3 is set; the third loop variable ic is set, and its initial value is set to y. s , let P h2,ic Represents the second horizontal projection array P h2 The ic-th element; Step S31341; If ic > h s1 Then proceed to step S31348; Step S31342; If P h2,ic If p3 is reached, proceed to step S31346; Step S31343; Adjust the spacing height h between the characters on the second seal. g2 The value increases by 1; Step S31344; if h g2 ≤h ts1 Then proceed to step S31347; Step S31345; Let y down =ic-h ts1 Proceed to step S31348; Step S31346; Adjust the spacing height h between the characters on the second seal. g2 Set the value to 0; Step S31347: Increment the value of the third loop variable ic by 1, then proceed to step S31341; Step S31348: Complete the calculation of the y-coordinate value of the lower boundary of the text in the first text region. down Calculation; Step S314; if If the text in the target text region of the third seal image I3 is horizontally arranged, then the text in the target text region of the third seal image I3 is circularly arranged.
[0022] Further, in step S33, the binary image I of the first seal is removed. b1 The content of the target text region in the Chinese and African languages is used to obtain the binary image I of the second seal. b2 The specific steps are as follows: Step S331: Use an edge detection algorithm to process the binary image I of the first seal.b1 Edge detection is performed to obtain the fourth edge image I. c4 A contour detection algorithm is used to analyze the fourth edge image I. c4 The contours in the set are detected and added to the fourth edge contour set C4. Step S332; For each edge contour C in the fourth edge contour set C4 4,i Calculate edge profile C 4,i The bounding rectangle, and the edge contour C 4,i and edge contour C 4,i The outer rectangles are combined to form edge contour rectangle units, and the edge contour rectangle units are added to the first edge contour rectangle unit set R1. Step S333; Let C noise Let C represent the set of interfering contours. noise Initialize to empty; let D represent the edge contour index set, and initialize the edge contour index set D to empty; set the first quantity threshold T1; let N c4 This represents the total number of elements in the fourth edge contour set C4; the fourth loop variable id is set, with its initial value set to 1, and C... 4,id Let R represent the id-th edge contour in the fourth edge contour set C4. 1,id Let R represent the id-th edge contour rectangle element in the first edge contour rectangle element set R1. 1,id,w Represents the rectangular frame unit R of the edge contour 1,id Let R be the width of the rectangle. 1,id,h Represents the rectangular frame unit R of the edge contour 1,id The height of the rectangle; Step S3331; If id > N c4 Then proceed to step S3337; Step S3332; If the first stamp binary image I b1 The geometric center point is located at the id-th edge contour C in the fourth edge contour set C4. 4,id Internally, proceed to step S3335; Step S3333; If R 1,id,w / R 1,id,h If T1 is reached, proceed to step S3335. Step S3334; Proceed to step S3336; Step S3335; The id-th edge contour C of the fourth edge contour set C4 is... 4,id Add interference contour set C noise Add the fourth loop variable id to the edge contour index set D; Step S3336; Increment the value of the fourth loop variable id by 1, then proceed to step S3331; Step S3337; Process ends; Step S334: For each edge contour index Di in the edge contour index set D, find the edge contour rectangle cell R with edge contour index Di in the first edge contour rectangle cell set R1. 1,Di The edge outline rectangle unit R 1,Di Remove from the first edge contour rectangle frame unit set R1; sort the first edge contour rectangle frame unit set R1 according to the y-coordinate value of the rectangle center point of the edge contour rectangle frame unit from largest to smallest to obtain the second edge contour rectangle frame unit set R2; Step S335; Set the threshold T for irregular spacing width w Set the noise threshold t noi Set the height difference threshold h1; Set the maximum height difference h between text within the same line. m h m Let h be the maximum height difference between texts in the same row. m Set the initial value; set the y-coordinate value of the upper boundary of the text line. u y u As a variable, set the y-coordinate value of the upper boundary of the text line to y. u The initial value is set to -1; the y-coordinate value of the lower boundary of the text line is set. d y d As a variable, set the y-coordinate value of the lower boundary of the text line to y. d Set the initial value to -1; set the processing end flag f. stop f stop The variable will be the end-of-process marker f. stop Set the initial value of N to 0; let N R2 Let T represent the total number of elements in the second edge contour rectangle unit R2; s This represents the set of rectangular cells representing the outline of the text edges. The set T of rectangular cells representing the outline of the text edges is... s Initialize to empty; set the fifth loop variable ie, and initialize the fifth loop variable ie to 1, let R 2,ie Let R represent the ie-th edge contour rectangle element of the second edge contour rectangle element R2. 2,ie,x Represents the rectangular frame unit R of the edge contour 2,ie Let R be the x-coordinate of the center point of the rectangle. 2,ie,y Represents the rectangular frame unit R of the edge contour 2,ie The y-coordinate of the center point of the rectangle, R 2,ie,w Represents the rectangular frame unit R of the edge contour 2,ie The width of the rectangle, R 2,ie,h Represents the rectangular frame unit R of the edge contour2,ie The height of the rectangle; Step S3351; If ie > N R2 or f stop If the value is greater than 0, proceed to step S3358; Step S3352; If R 2,ie,h <t noi And R 2,ie,w <t noi Then proceed to step S3357; Step S3353; If y d <0 or R 2,ie,y +R 2,ie,h / 2-y d ≤h m or y u -(R2 ,ie,y - R2 ,ie,h / 2)≤h m Then proceed to step S3355; Step S3354; Collect the set T of rectangular frames representing the outlines of the text lines. s Non-target text edge contours are added to the interference contour set C. noise The specific steps are as follows: Step S33541; Let N ts T represents the set of rectangular cells representing the outline of the text edges. s The number of elements, setting the first character count threshold n. t1 Let the second character count threshold be n. t2 ; Step S33542; If N ts <n t1 Then proceed to step S33545; Step S33543; Remove the rectangular frame unit set T of the text edge outline. s The invalid edge outline rectangle element in the text will be removed from the set T of line text edge outline rectangle elements. s Add the edge contour of the middle edge contour rectangle element to the set of disturbance contours C. noise ; Step S33544; Proceed to step S33546; Step S33545; Set the processing end marker f stop Set the value to 1; Step S33546; Process ends; Step S3355; The edge contour rectangle unit R 2,ie Add text edge outline rectangle cell set T s ; Step S3356; Update the y-coordinate value of the upper boundary of the text line.u and the y-coordinate value of the lower boundary of the text line. d The specific steps are as follows: Step S33561; If y d If ≥0, proceed to step S33563; Step S33562; Let h m =max(R 2,ie,h ,h1); Step S33563; Let y d =max(R 2,ie,y +R2 ,ie,h / 2,y d ); Step S33564; if y u If ≥0, proceed to step S33566; Step S33565; Let y u =min(R 2,ie,y - R 2,ie,h / 2, y d + R 2,ie,h Proceed to step S33567; Step S33566; Let y u =min(R 2,ie,y - R 2,ie,h / 2, y d + R 2,ie,h ,y u ); Step S33567; Complete the y-coordinate value of the upper boundary of the text line. u and the y-coordinate value of the lower boundary of the text line. d Update; Step S3357; Increment the value of the fifth loop variable ie by 1, then proceed to step S3351; Step S3358; End processing of the interference contour set C noise The collection; Step S336; Extract the set of interference contours C noise Each contour C noise,id , contour C noise,id The corresponding binary image I of the first seal b1 The pixels in the region are set to black to obtain the second stamp binary image I. b2 .
[0023] Further, in step S35, based on the binary image I of the first seal text line... tb1 By projecting the image onto the target text region, and then extracting the target text region from the unfolded image of the third seal image, we obtain the seal text image I. t The specific steps are as follows: Step S351; Set the y-coordinate value of the upper boundary of the target text region. ts y ts Set the y-coordinate value of the lower boundary of the target text region as a variable. te y te Set the x-coordinate value of the left boundary of the target text region as a variable. ts x ts Set the x-coordinate value of the right boundary of the target text region as a variable. te x te Let h be a variable; u Represents the binary image I of the first seal text line. tb1 The height; let w u Represents the binary image I of the first seal text line. tb1 The width; Step S352; For the binary image I of the first seal text line... tb1 Perform horizontal projection to obtain the third horizontal projection array P. h3 Set the fourth projection threshold p4; Set the height h of the second seal text area. a2 h a2 For variable h a2 Set the initial height of the second seal text area to 0; set the second text height threshold h. t2 Set the ninth loop variable ii, initialize the ninth loop variable ii to 1, and let P h3,ii Represents the third-level projection array P h3 The iith element; Step S3521; if ii>h u Then proceed to step S3528; Step S3522; If P h3,ii If p4 is less than or equal to p4, proceed to step S3526. Step S3523; Increase the height h of the text area of the second seal. a2 The value increases by 1; Step S3524; if h a2 <h t2 Then proceed to step S3527; Step S3525; Let y ts =ii-h t2 Proceed to step S3528; Step S3526; Increase the height h of the text area of the second seal. a2 Set the value to 0; Step S3527; Increment the value of the ninth loop variable ii by 1, and proceed to step S3521; Step S3528; Complete the calculation of the y-coordinate value of the upper boundary of the target text region. ts Calculation; Step S353; Set variable h a3 This indicates the height of the text area of the third seal. The height h of the text area of the third seal is... a3 The initial value is set to 0; the tenth loop variable ij is set, and its initial value is set to h. u , let P h3,ij Represents the third-level projection array P h3 The ij-th element; Step S3531; if ij <y ts Then proceed to step S3538; Step S3532; If P h3,ij If p4 is less than or equal to p4, proceed to step S3536. Step S3533; Increase the height h of the text area of the third seal. a3 The value increases by 1; Step S3534; if h a3 <h t2 Then proceed to step S3537; Step S3535; Let y te =ij+h t2 Proceed to step S3538; Step S3536; Increase the height h of the text area of the third seal. a3 Set the value to 0; Step S3537: Decrease the value of the tenth loop variable ij by 1, and proceed to step S3531; Step S3538; Complete the calculation of the lower boundary y-coordinate value of the target text region. te Calculation; Step S354; in the binary image I of the first seal text line. tb1 In the middle, with (0, y ts () is the origin, and the extracted height is y. te -y ts Width is w u The region is used to obtain the binary image I of the second seal text line. tb2 ; Step S355; For the binary image I of the second seal text line... tb2 Perform vertical projection to obtain the vertical projection array P. v Set the width of the first seal text area (w) a1 w a1 Let w be the width of the first seal text area. a1 The initial value is set to 0; the fifth projection threshold p5 is set; the target text width threshold w is set. t Set the eleventh loop variable ik, and initialize the eleventh loop variable ik to 1. Let P v,ikThis represents the ik-th element of the vertical projection array Pv; Step S3551; If ik > w u Then proceed to step S3558; Step S3552; If P v,ik If ≤p5, proceed to step S3556; Step S3553; Increase the width w of the first seal text area a1 The value increases by 1; Step S3554; if w a1 <w t Then proceed to step S3557; Step S3555; Let x ts =ik-w t Proceed to step S3558; Step S3556; Increase the width w of the first seal text area a1 Set the value to 0; Step S3557; Increment the value of the eleventh loop variable ik by 1, and proceed to step S3551; Step S3558; Complete the x-coordinate value of the left boundary of the target text region. ts Calculation; Step S356; Set the width w of the text area of the second seal. a2 w a2 For variable w a2 The width of the text area of the second seal is w a2 The initial value is set to 0; the twelfth loop variable il is set, and its initial value is set to w. u , let P v,il This represents the il-th element of the vertical projection array Pv; Step S3561; If il <x ts Then proceed to step S3568; Step S3562; If P v,il If ≤p5, proceed to step S3566; Step S3563; Increase the width w of the text area of the second seal. a2 The value increases by 1; Step S3564; if w a2 <w t Then proceed to step S3567; Step S3565; Let x te =il+w t Proceed to step S3568; Step S3566; Increase the width w of the text area of the second seal. a2 Set the value to 0; Step S3567: Decrease the value of the twelfth loop variable il by 1, and proceed to step S3561; Step S3568; Complete the x-coordinate value of the right boundary of the target text region. te Calculation; Step S357; In the unfolded diagram of the third seal image, with (x ts ,y ts (x) is the origin, and the extraction width is x. te -x ts The height is y te -y ts The region yields the seal line text image I. t .
[0024] Example
[0025] The embodiment is a further explanation of step S33543.
[0026] In step S33543, the set of rectangular frame units T for removing the outline of the text edges is removed. s Invalid edge outline rectangle cells in the text, and set the text edge outline rectangle cell set T s Add the edge contour of the middle edge contour rectangle element to the set of disturbance contours C. noise The specific steps are as follows: Step S335431; Set the rectangular frame unit T of the text edge outline s Sort the rectangles by the x-coordinate of their center point from smallest to largest; Step S335432; Let A wts This represents the character spacing array, where the character spacing array A is... wts Initialize to empty; let A tn This represents an array of text outline counts. The text outline count array A... tn Initialize to empty; set the first text spacing width threshold w. ts1 =8; Set text spacing t s , t s Let N be a variable; ts T represents the set of rectangular cells representing the outline of the text edges. s The total number of elements in the loop; set the sixth loop variable `if`, initialize the sixth loop variable `if` to 2, and let T... s,if Let T be the if-th edge outline rectangle in the set of text edge outline rectangles. s,if,x Represents the rectangular frame unit T with its edge outline s,if The x-coordinate of the center point of the rectangle; Step S3354321; If if>N ts Then proceed to step S3354326; Step S3354322; Let t s =T s,if,x -T s,if-1,x If t s <w ts1 Then proceed to step S3354324; Step S3354323: Add 1 to the text outline quantity array A. tn At the end, t s Add to the character spacing array A wts At the end, proceed to step S3354325; Step S3354324; Convert the text outline quantity array A tn The value of the last element is increased by 1; Step S3354325: Increment the value of the sixth loop variable if by 1, then proceed to step S3354321; Step S3354326; Process ends; Step S335433; Let N atn Array A representing the number of text outlines tn Total number of elements; set left margin tl, t s Let A be a variable; set the variable tr to represent the right margin of the text; let A tw This represents a text width array, where the text width array A is... tw Initialize to empty; set the text edge outline rectangle cell set T s Let T be the element index cid, where cid is a variable. The initial value of cid is set to 1. s,cid T represents the set of rectangular cells representing the outline of the text edges. s Let T be the cid-th element. s,cid,x T represents the set of rectangular cells representing the outline of the text edges. s Let T be the x-coordinate of the rectangular geometric center point of the cid-th element. s,cid,w This represents the width of the cid-th element of the set of rectangular cells containing the outline of the text lines; Set the seventh loop variable ig, initially setting its value to 1, and let A... tn,ig Array A representing the number of text outlines tn The igth element; Step S3354331; If ig > N atn Then proceed to step S3354336; Step S3354332; Let tl = T s,cid,x - T s,cid,w / 2, tr= T s,cid,x + T s,cid,w / 2; Step S3354333; Set the eighth loop variable ih, and set the initial value of the eighth loop variable ih to cid, let T s,ih T represents the set of rectangular cells representing the outline of the text edges. s The ih-th element, let T s,ih,x T represents the set of rectangular cells representing the outline of the text edges. s Let T be the x-coordinate of the rectangular geometric center point of the ih-th element. s,ih,w T represents the set of rectangular cells representing the outline of the text edges. s The width of the rectangle of the ih-th element; Step S33543331; If ih > cid + A tn,ig Then proceed to step S33543334; Step S33543332; Let tl = min(tl, T s,ih,x -T s,ih,w / 2), tr=max(tr, T) s,ih,x +T s,ih,w / 2); Step S33543333; Increment the value of the eighth loop variable ih by 1, and proceed to step S33543331; Step S33543334; Process ends; Step S3354334; Let cid = cid + A tn,ig Add tr-tl to A tw end; Step S3354335; Increment the value of the seventh loop variable ig by 1, then proceed to step S3354331; Step S3354336; Process ends; Step S335434; Set the spacing threshold ng=1, and let N awts The current character spacing array A represents the current character spacing. wts The total number of elements; if N awts If ≤ng, proceed to step S335437; Step S335435; Based on the text outline quantity array A tn And the character spacing array A wts Get the set of rectangular bounding box cells T for the outline of the text edge. s The non-target text edge contours are selected and added to the interference contour set C. noise The specific steps are as follows: Step S3354351; Let avg ts1 Let var represent the average spacing between the first character lines. ts Let max represent the variance of character spacing. tsRepresents the character spacing array A wts The maximum character spacing in the text is set to a safety threshold T. safe =0.0001, set the width ratio threshold r w =0.25; Average first character spacing (avg) ts1 and text spacing variance var ts The calculation formula is as follows: ; ; Step S3354352; if var ts / (avg ts1 +T safe )≥T w or N R2 -ie <n t2 or max ts ≥w s1* r w Then proceed to step S3354357; Step S3354353; Set the gap quantity threshold N s =4, if N awts ≤N s Then proceed to step S3354355; Step S3354354; Remove the rectangular frame unit set T from the text edge outline. s The specific steps for removing invalid edge contour rectangle elements are as follows: Step S33543541; Set the first gap ratio threshold r s1 =2; Set the second height ratio threshold r h2 =0.6; Remove character spacing array A wts Calculate the spacing array A between the first and last spacing elements in the array. wts The average character spacing is used to obtain the second average character spacing value avg. ts2 ; Step S33543542; Remove the rectangular frame unit set T from the text edge outline. s The specific steps for removing the invalid edge outline rectangle unit on the left side are as follows: Step S335435421; If A wts,1 >r s1 *avg ts2 Then proceed to step S335435424; Step S335435422; Let T s,1 T represents the set of rectangular cells representing the outline of the text edges. s The first edge contour rectangle unit, let T s,1,hRepresents the rectangular frame unit T with its edge outline s,1 The height of the rectangle, let T s , 1,w Represents the rectangular frame unit T with its edge outline s,1 The width of the rectangle, let T s,Nts / 2 , y T represents the set of rectangular cells representing the outline of the text edges. s The Nth ts / 2 Rectangular frame elements with edge contours; calculate the y-coordinates of the center points of the rectangles; calculate the rectangular frame element T. s,1 The distance d1 between the center point of the rectangle and the inner ring outline of the seal; Step S335435423; If T s,Nts / 2 , y ≥h s1 *r h2 or d1-T s,1,h / 2≥T s , 1,w / 2, then proceed to step S335435425; Step S335435424; Remove the rectangular frame unit set T from the text edge outline. s The first A in tn,1 Each element will f stop The value is set to 1; Step S335435425; Process ends; Step S33543543; Remove the rectangular frame unit set T from the text edge outline. s The invalid edge outline rectangle unit on the right side of the middle section is defined by the following steps: Step S335435431; If A wts,Nawts >r s1 *avg ts2 Then proceed to step S335435434; Step S335435432; Let T s,Nts / 2 , y T represents the set of rectangular cells representing the outline of the text edges. s The Nth ts / The y-coordinate of the geometric center point of the rectangle of the two edge contour rectangular frame units; let T s,Nts T represents the set of rectangular cells representing the outline of the text edges. s The Nth ts Each edge outline rectangle unit, let T s,Nts,h Represents the rectangular frame unit T with its edge outline s,Nts The height of the rectangle; let T s,Nts,w Represents the rectangular frame unit T with its edge outline s,Nts Calculate the rectangle width; calculate the edge contour rectangle element T. s,NtsThe distance d2 between the center point of the rectangle and the inner ring outline of the seal; Step S335435433; if T s,Nts / 2 ,y≥h s1 *r h2 or d2-T s,Nts,h / 2≥T s , Nts If w / 2, then proceed to step S335435435; Step S335435434; Remove the rectangular frame unit set T from the text edge outline. s The tail of the A tn,Natn Each element will be processed by the end marker f. stop Set the value to 1; Step S335435435; Process ends; Step S3354355; Set the text edge outline rectangle unit T s The edge contour of each edge contour rectangle cell is added to the set of disturbance contours C. noise ; Step S3354356; Proceed to step S3354358; Step S3354357; Set the processing end marker f stop Set the value to 1; Step S3354358; Process ends; Step S335436; Proceed to step S335438; Step S335437; Set the processing end marker f stop The value is set to 1;
[0027] Step S335438; Process ends.
[0028] The above methods can automatically and accurately identify the text in circular seal images, and are particularly suitable for text extraction from elliptical and circular seals, providing effective technical support for document digitization.
[0029] The above description is a preferred embodiment of the present invention and is not intended to limit the present invention. All equivalent or modified embodiments made without departing from the spirit disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for recognizing characters on a seal, characterized in that: The method includes the following steps: Step S1; Image preprocessing: Read the first seal image I1, perform rotation and correction processing on the first seal image I1 to obtain the second seal image I2: Step S2; Seal region extraction: The inner ring contour of the seal in the second seal image I2 is extracted using contour detection and ellipse fitting algorithm. The area outside the inner ring contour of the seal is set to a white background to obtain the third seal image I3. Step S3; Target text extraction and processing: Remove non-target text content from the third seal image I3, detect and extract the target text region to obtain the seal text image I. t , Step S4; OCR recognition: I... (The rest of the text image is missing from the original text and can be omitted.) t Perform OCR recognition to obtain the seal text recognition results; Step S3, the specific steps are as follows: Step S31; Text arrangement determination: Binarize the third seal image I3 to obtain the first seal binary image I. b1 , let w s1 Represents the binary image I of the first seal b1 The width, based on the binary image I of the first seal. b1 The target text region is obtained by projection, and the y-coordinate value of the upper boundary of the target text region is calculated. s and the y-coordinate value of the lower boundary of the target text region. e Determine the text arrangement in the target text region of the third seal image I3; Step S32; Horizontal text processing: If the target text is arranged horizontally, then in the third seal image I3, it is processed using the format (0, y). s () is the origin, and the extracted height is y. e -y s Width is w s1 The rectangular area is used to obtain the seal text image I. t Proceed to step S36; Step S33; Circular text preprocessing: If the target text is arranged in a circular pattern, remove the first stamp binary image I. b1 The content of the target text region in the Chinese and African languages is used to obtain the binary image I of the second seal. b2 ; Step S34; Polar coordinate expansion: Expand the third seal image I3 and the second seal binary image I b2 Perform polar coordinate expansion to obtain the expanded image of the third seal and the binary image I of the text line of the first seal. tb1 ; Step S35; Expand the image and extract text: Based on the binary image I of the first seal text line. tb1 By projecting the image onto the target text region, and then extracting the target text region from the unfolded image of the third seal image, we obtain the seal text image I. t ; Step S36: Complete text extraction.
2. The seal character recognition method according to claim 1, characterized in that: In step S1, the first seal image I1 is rotated and corrected to obtain the rotated and corrected second seal image I2. The specific steps are as follows: Step S11: Use an image binarization algorithm to binarize the first seal image I1 to obtain the third seal binary image I. b3 ; Step S12: Use an edge detection algorithm to process the binary image I of the third seal. b3 Perform edge detection to obtain the first edge image I c1 A contour detection algorithm is used to analyze the first edge image I. c1 The contours in the image are detected and added to the first contour set C1; the contour with the largest area is found from the first contour set C1 to obtain the seal contour c. s ; Step S13; Set the rectangle aspect ratio threshold r rwh ; Calculate the seal outline c s The minimum bounding rectangle R m Let x rc R represents the minimum bounding rectangle m Let the x-coordinate of the geometric center point be y. rc R represents the minimum bounding rectangle m Let h be the y-coordinate of the geometric center point. r R represents the minimum bounding rectangle m The height of w r R represents the minimum bounding rectangle m Let the width be denoted by angle, and let angle represent the minimum bounding rectangle R. m The angle between the longer side and the horizontal direction, with the angle ranging from [0, 90], if max(w r ,h r ) / min(w r ,h r )>r rwh Then, for the first seal image I1, around the center point (x) rc ,y rc Rotate the angle by a factor such that the minimum bounding rectangle R is minimized. m The longer side is parallel to the horizontal line, resulting in the corrected stamp image I. r Otherwise, the first seal image I1 is directly used as the correction seal image Iᵣ. Step S14; In correcting the stamp image I r In the coordinates (x) rc -w r / 2,y rc -h r / 2) is the origin, and the extracted height is the minimum bounding rectangle R. m height h r The width is the minimum bounding rectangle R m Width w r The rectangular area graphic is used to obtain the second seal image I2.
3. The seal character recognition method according to claim 2, characterized in that: In step S2, the contour detection and ellipse fitting algorithm is used to extract the inner ring contour of the second seal image I2. The specific steps are as follows: Step S21: Use an image binarization algorithm to binarize the second seal image I2 to obtain the fourth seal binary image I. b4 ; Step S22: Use an edge detection algorithm to process the binary image I of the fourth seal. b4 Edge detection is performed to obtain the second edge image I. c2 A contour detection algorithm is used to analyze the second edge image I. c2 The contours in the image are detected and added to the second edge contour set C2; the contour with the largest area is taken from the second edge contour set C2 as the outer ring contour of the seal, and the fourth seal binary image I is processed. b4 Invert all pixels within the outer contour region of the seal to obtain the binary image I of the fifth seal. b5 ; Step S23: Use an edge detection algorithm to process the binary image I of the fifth seal. b5 Edge detection is performed to obtain the third edge image I. c3 A contour detection algorithm is used to analyze the third edge image I. c3 The contours in the middle are detected and added to the third edge contour set C3; the contour with the largest area is taken from the third edge contour set C3 as the inner ring contour of the seal.
4. The seal character recognition method according to claim 3, characterized in that: In step S31, based on the binary image I of the first seal... b1 The target text region is obtained by projection, and the y-coordinate value of the upper boundary of the target text region is calculated. s and the y-coordinate value of the lower boundary of the target text region. e To determine the text arrangement in the target text region of the third seal image I3, the specific steps are as follows: Step S311; For the binary image I of the first seal b1 Perform horizontal projection to obtain the first horizontal projection array P. h1 Let h s1 Represents the binary image I of the first seal b1 Height; Set the first text height threshold h t1 Set the height h of the first seal text area. a1 h a1 Let h be the height of the first seal text area. a1 The initial value is set to 0; the y-coordinate value of the upper boundary of the target text region is set. s y s As a variable, set the y-coordinate value of the upper boundary of the target text region. s The initial value is set to 0; the first effective projection threshold p1 is set; the first loop variable ia is set, and its initial value is set to 1, and P is set to 0. h1,ia Represents the first horizontal projection array P h1 The ia-th element; Step S3111; If ia>h s1 Then proceed to step S3118; Step S3112; If P h1,ia If ≤p1, then proceed to step S3116; Step S3113; Increase the height h of the first seal text area a1 The value increases by 1; Step S3114; if h a1 <h t1 Then proceed to step S3117; Step S3115; Let y s =ia-h t1 Proceed to step S3118; Step S3116; Increase the height h of the first seal text area a1 Set the value to 0; Step S3117: Increment the value of the first loop variable ia by 1, and proceed to step S3111; Step S3118; Complete the calculation of the y-coordinate value of the upper boundary of the target text region. s Calculation; Step S312; Set the first text gap height threshold h ts1 Set the spacing height h between the characters on the first seal. g1 h g1 Let h be the height of the spacing between the characters on the first seal. g1 The initial value is set to 0; the y-coordinate value of the lower boundary of the target text region is set. e y e As a variable, set the y-coordinate value of the lower boundary of the target text region. e The initial value is set to h. s1 Set the second effective projection threshold p2; set the second loop variable ib, and initialize the second loop variable ib to y. s +h t1 , let P h1,ib Represents the first horizontal projection array P h1 The ibth element; Step S3121; If ib > h s1 Then proceed to step S3128; Step S3122; If P h1,ib If p2 is reached, proceed to step S3126; Step S3123; Adjust the spacing height h between the characters on the first seal. g1 The value increases by 1; Step S3124; if h g1 <h ts1 Then proceed to step S3127; Step S3125; Let y e =ib-h ts1 Proceed to step S3128; Step S3126; Adjust the spacing height h between the characters on the first seal. g1 Set the value to 0; Step S3127: Increment the value of the second loop variable ib by 1, then proceed to step S3121; Step S3128; Complete the calculation of the lower boundary y-coordinate value of the target text region. e Calculation; Step S313; Set the first line text proportion threshold r t1 Set the first height ratio threshold r h1 Set the left boundary x of the first text region. l x l Set the right boundary x of the first text region as a variable. r x r Set the y-coordinate value of the lower boundary of the first text region as a variable. down y down Let I be a variable; determine the text arrangement of the target text region in the third seal image I3, the specific steps are as follows: Step S3131; Left boundary x of the first text region l and the right boundary x of the first text region r The calculation method is as follows: ; ; Step S3132; in the first binary image of the seal I b1 In, with (x l (0) is the origin, and the extraction height is h. s1 Width is r t1 *w s1 The rectangular region is used to obtain the binary image I of the sixth seal. b6 ; Step S3133; For the binary image I of the sixth seal b6 Perform horizontal projection to obtain the second horizontal projection array P. h2 ; Step S3134; Set the spacing height h between the characters on the second seal. g2 h g2 Let h be the height of the spacing between the characters on the second seal. g2 The initial value is set to 0; the third effective projection threshold p3 is set; the third loop variable ic is set, and its initial value is set to y. s , let P h2,ic Represents the second horizontal projection array P h2 The ic-th element; Step S31341; If ic > h s1 Then proceed to step S31348; Step S31342; If P h2,ic If p3 is reached, proceed to step S31346; Step S31343; Adjust the spacing height h between the characters on the second seal. g2 The value increases by 1; Step S31344; if h g2 ≤h ts1 Then proceed to step S31347; Step S31345; Let y down =ic-h ts1 Proceed to step S31348; Step S31346; Adjust the spacing height h between the characters on the second seal. g2 Set the value to 0; Step S31347: Increment the value of the third loop variable ic by 1, then proceed to step S31341; Step S31348: Complete the calculation of the y-coordinate value of the lower boundary of the text in the first text region. down Calculation; Step S314; if If the text in the target text region of the third seal image I3 is horizontally arranged, then the text in the target text region of the third seal image I3 is circularly arranged.
5. The seal character recognition method according to claim 4, characterized in that: In step S33, the binary image I of the first stamp is removed. b1 The content of the target text region in the Chinese and African languages is used to obtain the binary image I of the second seal. b2 The specific steps are as follows: Step S331: Use an edge detection algorithm to process the binary image I of the first seal. b1 Edge detection is performed to obtain the fourth edge image I. c4 A contour detection algorithm is used to analyze the fourth edge image I. c4 The contours in the set are detected and added to the fourth edge contour set C4. Step S332; For each edge contour C in the fourth edge contour set C4 4,i Calculate edge profile C 4,i The bounding rectangle, and the edge contour C 4,i and edge contour C 4,i The outer rectangles are combined to form edge contour rectangle units, and the edge contour rectangle units are added to the first edge contour rectangle unit set R1. Step S333; Let C noise Let C represent the set of interfering contours. noise Initialize to empty; let D represent the edge contour index set, and initialize the edge contour index set D to empty; set the first quantity threshold T1; let N c4 This represents the total number of elements in the fourth edge contour set C4; Set the fourth loop variable id, and initialize its value to 1. Let C... 4,id Let R represent the id-th edge contour in the fourth edge contour set C4. 1,id Let R represent the id-th edge contour rectangle element in the first edge contour rectangle element set R1. 1,id,w Represents the rectangular frame unit R of the edge contour 1,id Let R be the width of the rectangle. 1,id,h Represents the rectangular frame unit R of the edge contour 1,id The height of the rectangle; Step S3331; If id > N c4 Then proceed to step S3337; Step S3332; If the first stamp binary image I b1 The geometric center point is located at the id-th edge contour C in the fourth edge contour set C4. 4,id Internally, proceed to step S3335; Step S3333; If R 1,id,w / R 1,id,h If T1 is reached, proceed to step S3335. Step S3334; Proceed to step S3336; Step S3335; The id-th edge contour C of the fourth edge contour set C4 is... 4,id Add interference contour set C noise Add the fourth loop variable id to the edge contour index set D; Step S3336; Increment the value of the fourth loop variable id by 1, then proceed to step S3331; Step S3337; Process ends; Step S334: For each edge contour index Di in the edge contour index set D, find the edge contour rectangle cell R with edge contour index Di in the first edge contour rectangle cell set R1. 1,Di The edge outline rectangle unit R 1,Di Remove from the first edge contour rectangle frame unit set R1; sort the first edge contour rectangle frame unit set R1 according to the y-coordinate value of the rectangle center point of the edge contour rectangle frame unit from largest to smallest to obtain the second edge contour rectangle frame unit set R2; Step S335; Set the threshold T for irregular spacing width w Set the noise threshold t noi Set the height difference threshold h1; Set the maximum height difference h between text within the same line. m h m Let h be the maximum height difference between texts in the same row. m Set the initial value; set the y-coordinate value of the upper boundary of the text line. u y u As a variable, set the y-coordinate value of the upper boundary of the text line to y. u The initial value is set to -1; the y-coordinate value of the lower boundary of the text line is set. d y d As a variable, set the y-coordinate value of the lower boundary of the text line to y. d Set the initial value to -1; set the processing end flag f. stop f stop The variable will be the end-of-process marker f. stop Set the initial value of N to 0; let N R2 Let T represent the total number of elements in the second edge contour rectangle unit R2; s This represents the set of rectangular cells representing the outline of the text edges. The set T of rectangular cells representing the outline of the text edges is... s Initialize to empty; Set the fifth loop variable ie, and initialize its value to 1. Let R 2,ie Let R represent the ie-th edge contour rectangle element of the second edge contour rectangle element R2. 2,ie,x Represents the rectangular frame unit R of the edge contour 2,ie Let R be the x-coordinate of the center point of the rectangle. 2,ie,y Represents the rectangular frame unit R of the edge contour 2,ie The y-coordinate of the center point of the rectangle, R 2,ie,w Represents the rectangular frame unit R of the edge contour 2,ie The width of the rectangle, R 2,ie,h Represents the rectangular frame unit R of the edge contour 2,ie The height of the rectangle; Step S3351; If ie > N R2 or f stop If the value is greater than 0, proceed to step S3358; Step S3352; If R 2,ie,h <t noi And R 2,ie,w <t noi Then proceed to step S3357; Step S3353; If y d <0 or R 2,ie,y +R 2,ie,h / 2-y d ≤h m or y u -(R2 ,ie,y - R2 ,ie,h / 2)≤h m Then proceed to step S3355; Step S3354; Collect the set T of rectangular frames representing the outlines of the text lines. s Non-target text edge contours are added to the interference contour set C. noise The specific steps are as follows: Step S33541; Let N ts T represents the set of rectangular cells representing the outline of the text edges. s The number of elements, setting the first character count threshold n. t1 Let the second character count threshold be n. t2 ; Step S33542; If N ts <n t1 Then proceed to step S33545; Step S33543; Remove the rectangular frame unit set T of the text edge outline. s The invalid edge outline rectangle element in the text will be removed from the set T of line text edge outline rectangle elements. s Add the edge contour of the middle edge contour rectangle element to the set of disturbance contours C. noise ; Step S33544; Proceed to step S33546; Step S33545; Set the processing end marker f stop Set the value to 1; Step S33546; Process ends; Step S3355; The edge contour rectangle unit R 2,ie Add text edge outline rectangle cell set T s ; Step S3356; Update the y-coordinate value of the upper boundary of the text line. u and the y-coordinate value of the lower boundary of the text line. d The specific steps are as follows: Step S33561; If y d If ≥0, proceed to step S33563; Step S33562; Let h m =max(R 2,ie,h ,h1); Step S33563; Let y d =max(R 2,ie,y +R2 ,ie,h / 2,y d ); Step S33564; if y u If ≥0, proceed to step S33566; Step S33565; Let y u =min(R 2,ie,y - R 2,ie,h / 2, y d + R 2,ie,h Proceed to step S33567; Step S33566; Let y u =min(R 2,ie,y - R 2,ie,h / 2, y d + R 2,ie,h ,y u ); Step S33567; Complete the y-coordinate value of the upper boundary of the text line. u and the y-coordinate value of the lower boundary of the text line. d Update; Step S3357; Increment the value of the fifth loop variable ie by 1, then proceed to step S3351; Step S3358; End processing of the interference contour set C noise The collection; Step S336; Extract the set of interference contours C noise Each contour C noise,id , contour C noise,id The corresponding binary image I of the first seal b1 The pixels in the region are set to black to obtain the second stamp binary image I. b2 .
6. The seal character recognition method according to claim 5, characterized in that: In step S35, based on the binary image I of the first seal text line... tb1 By projecting the image onto the target text region, and then extracting the target text region from the unfolded image of the third seal image, we obtain the seal text image I. t The specific steps are as follows: Step S351; Set the y-coordinate value of the upper boundary of the target text region. ts y ts Set the y-coordinate value of the lower boundary of the target text region as a variable. te y te Set the x-coordinate value of the left boundary of the target text region as a variable. ts x ts Set the x-coordinate value of the right boundary of the target text region as a variable. te x te Let h be a variable; u Represents the binary image I of the first seal text line. tb1 The height; let w u Represents the binary image I of the first seal text line. tb1 The width; Step S352; For the binary image I of the first seal text line... tb1 Perform horizontal projection to obtain the third horizontal projection array P. h3 Set the fourth projection threshold p4; Set the height h of the second seal text area. a2 h a2 For variable h a2 Set the initial height of the second seal text area to 0; set the second text height threshold h. t2 ; Set the ninth loop variable ii, and initialize the ninth loop variable ii to 1. Let P h3,ii Represents the third-level projection array P h3 The iith element; Step S3521; if ii>h u Then proceed to step S3528; Step S3522; If P h3,ii If p4 is less than or equal to p4, proceed to step S3526. Step S3523; Increase the height h of the text area of the second seal. a2 The value increases by 1; Step S3524; if h a2 <h t2 Then proceed to step S3527; Step S3525; Let y ts =ii-h t2 Proceed to step S3528; Step S3526; Increase the height h of the text area of the second seal. a2 Set the value to 0; Step S3527; Increment the value of the ninth loop variable ii by 1, and proceed to step S3521; Step S3528; Complete the calculation of the y-coordinate value of the upper boundary of the target text region. ts Calculation; Step S353; Set variable h a3 This indicates the height of the text area of the third seal. The height h of the text area of the third seal is... a3 The initial value is set to 0; Set the tenth loop variable ij, and initialize the tenth loop variable ij to h. u , let P h3,ij Represents the third-level projection array P h3 The ij-th element; Step S3531; if ij <y ts Then proceed to step S3538; Step S3532; If P h3,ij If p4 is less than or equal to p4, proceed to step S3536. Step S3533; Increase the height h of the text area of the third seal. a3 The value increases by 1; Step S3534; if h a3 <h t2 Then proceed to step S3537; Step S3535; Let y te =ij+h t2 Proceed to step S3538; Step S3536; Increase the height h of the text area of the third seal. a3 Set the value to 0; Step S3537: Decrease the value of the tenth loop variable ij by 1, and proceed to step S3531; Step S3538; Complete the calculation of the lower boundary y-coordinate value of the target text region. te Calculation; Step S354; in the binary image I of the first seal text line. tb1 In the middle, with (0, y ts () is the origin, and the extracted height is y. te -y ts Width is w u The region is used to obtain the binary image I of the second seal text line. tb2 ; Step S355; Binary image I of the second seal text line tb2 Perform vertical projection to obtain the vertical projection array P. v Set the width of the first seal text area (w) a1 w a1 Let w be the width of the first seal text area. a1 The initial value is set to 0; Set the fifth projection threshold p5; set the target text width threshold w. t Set the eleventh loop variable ik, and initialize the eleventh loop variable ik to 1. Let P v,ik This represents the ik-th element of the vertical projection array Pv; Step S3551; If ik > w u Then proceed to step S3558; Step S3552; If P v,ik If ≤p5, proceed to step S3556; Step S3553; Increase the width w of the first seal text area a1 The value increases by 1; Step S3554; if w a1 <w t Then proceed to step S3557; Step S3555; Let x ts =ik-w t Proceed to step S3558; Step S3556; Increase the width w of the first seal text area a1 Set the value to 0; Step S3557; Increment the value of the eleventh loop variable ik by 1, and proceed to step S3551; Step S3558; Complete the x-coordinate value of the left boundary of the target text region. ts Calculation; Step S356; Set the width of the text area for the second seal. a2 w a2 For variable w a2 The width of the text area of the second seal is w a2 The initial value is set to 0; Set the twelfth loop variable il, and initialize the twelfth loop variable il to w. u , let P v,il This represents the il-th element of the vertical projection array Pv; Step S3561; If il <x ts Then proceed to step S3568; Step S3562; If P v,il If ≤p5, proceed to step S3566; Step S3563; Increase the width w of the text area of the second seal. a2 The value increases by 1; Step S3564; if w a2 <w t Then proceed to step S3567; Step S3565; Let x te =il+w t Proceed to step S3568; Step S3566; Increase the width w of the text area of the second seal. a2 Set the value to 0; Step S3567: Decrease the value of the twelfth loop variable il by 1, and proceed to step S3561; Step S3568; Complete the x-coordinate value of the right boundary of the target text region. te Calculation; Step S357; In the unfolded diagram of the third seal image, with (x ts ,y ts (x) is the origin, and the extraction width is x. te -x ts The height is y te -y ts The region yields the seal line text image I. t .
Citation Information
Patent Citations
Image recognition method and device, electronic equipment and computer readable medium
CN119049072A
Seal identification method and device for medical bills
CN120126149A