CN115188017A - Text recognition method, device, equipment and storage medium for circular seal - Google Patents
Text recognition method, device, equipment and storage medium for circular seal Download PDFInfo
- Publication number
- CN115188017A CN115188017A CN202210831806.XA CN202210831806A CN115188017A CN 115188017 A CN115188017 A CN 115188017A CN 202210831806 A CN202210831806 A CN 202210831806A CN 115188017 A CN115188017 A CN 115188017A
- Authority
- CN
- China
- Prior art keywords
- image
- stamp
- circular
- recognized
- text
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 64
- 230000009466 transformation Effects 0.000 claims abstract description 32
- 238000012545 processing Methods 0.000 claims abstract description 25
- 238000001514 detection method Methods 0.000 claims description 57
- 238000013507 mapping Methods 0.000 claims description 18
- 238000004590 computer program Methods 0.000 claims description 16
- 238000012937 correction Methods 0.000 claims description 11
- 238000010606 normalization Methods 0.000 claims description 10
- 238000012549 training Methods 0.000 claims description 10
- 238000013145 classification model Methods 0.000 claims description 9
- 238000006243 chemical reaction Methods 0.000 claims description 8
- 230000001131 transforming effect Effects 0.000 claims 1
- 238000004891 communication Methods 0.000 description 9
- 238000010586 diagram Methods 0.000 description 7
- 239000000463 material Substances 0.000 description 4
- 230000006870 function Effects 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000003708 edge detection Methods 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 102100032202 Cornulin Human genes 0.000 description 1
- 101000920981 Homo sapiens Cornulin Proteins 0.000 description 1
- 206010061274 Malocclusion Diseases 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 239000011521 glass Substances 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000001953 sensory effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/40—Document-oriented image-based pattern recognition
- G06V30/42—Document-oriented image-based pattern recognition based on the type of document
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/44—Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/82—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/10—Character recognition
- G06V30/19—Recognition using electronic means
- G06V30/191—Design or setup of recognition systems or techniques; Extraction of features in feature space; Clustering techniques; Blind source separation
- G06V30/19147—Obtaining sets of training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/10—Character recognition
- G06V30/19—Recognition using electronic means
- G06V30/191—Design or setup of recognition systems or techniques; Extraction of features in feature space; Clustering techniques; Blind source separation
- G06V30/19173—Classification techniques
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Computation (AREA)
- Computing Systems (AREA)
- Health & Medical Sciences (AREA)
- Software Systems (AREA)
- General Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- General Engineering & Computer Science (AREA)
- Molecular Biology (AREA)
- Mathematical Physics (AREA)
- Data Mining & Analysis (AREA)
- Computational Linguistics (AREA)
- Biophysics (AREA)
- Databases & Information Systems (AREA)
- Medical Informatics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Image Analysis (AREA)
Abstract
The invention discloses a text recognition method, a text recognition device, text recognition equipment and a storage medium for a circular seal. The method comprises the following steps: acquiring an image to be recognized, wherein the image to be recognized comprises a stamp text to be recognized; carrying out image processing on an image to be identified to obtain a standard circular stamp image; based on a thin plate spline transformation algorithm, carrying out image transformation on the standard circular stamp image to obtain a target strip-shaped image; the method has the advantages that the text recognition result is obtained by performing the text recognition on the text of the stamp to be recognized in the target bar-shaped image, the problems of inaccurate text recognition result and low recognition efficiency of the circular stamp caused by the omission and incomplete characters of the method for recognizing the single character in the circular stamp can be solved, and the text recognition accuracy and the recognition efficiency of the circular stamp can be improved.
Description
Technical Field
The invention relates to the technical field of text recognition, in particular to a text recognition method, a text recognition device, text recognition equipment and a storage medium for a circular seal.
Background
In real life, a seal is stamped on a plurality of document materials, text information extracted from the seal can be used for storing and retrieving document materials, or the document materials can be stamped incorrectly, so that the text in the seal is very necessary to be identified.
Generally, the adopted seal is circular, the text on the seal is a bent text, and a certain angle inclination exists between each single character, so that the difficulty in text extraction and identification of the circular official seal is increased. At present, a common method for stamp text recognition is to position a stamp by using stamp characteristics, then detect single characters in the stamp in sequence by using a character detection algorithm, and perform character recognition on each character.
When the seal is fuzzy or incomplete due to ink loss of the seal, the problems of relatively serious missing detection and incomplete characters exist in the conventional character detection algorithm, so that the text recognition result of the circular seal is inaccurate and the recognition efficiency is not high.
Disclosure of Invention
The invention provides a text recognition method, a text recognition device, text recognition equipment and a storage medium for a circular seal, which are used for solving the problems of inaccurate text recognition results and low recognition efficiency of the circular seal caused by omission and incomplete characters in a method for recognizing a single character in the circular seal, and improving the text recognition accuracy and the recognition efficiency of the circular seal.
According to an aspect of the present invention, there is provided a text recognition method for a circular stamp, including:
acquiring an image to be recognized, wherein the image to be recognized comprises: a circular stamp image containing a stamp text to be identified;
performing image processing on the image to be identified to obtain a standard circular stamp image;
based on a thin plate spline conversion algorithm, carrying out image conversion on the standard circular stamp image to obtain a target strip image;
and performing text recognition on the stamp text to be recognized in the target bar-shaped image to obtain a text recognition result.
According to another aspect of the present invention, there is provided a text recognition apparatus for a circular stamp, including:
the image acquisition module is used for acquiring an image to be identified, and the image to be identified comprises: a circular stamp image containing a stamp text to be identified;
the image processing module is used for carrying out image processing on the image to be identified to obtain a standard circular stamp image;
the image transformation module is used for carrying out image transformation on the standard circular stamp image based on a thin plate spline transformation algorithm to obtain a target strip image;
and the text recognition module is used for performing text recognition on the stamp text to be recognized in the target bar-shaped image to obtain a text recognition result.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the method for recognizing text of a circular stamp according to any embodiment of the present invention.
According to another aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for causing a processor to implement the method for recognizing text of a circular stamp according to any one of the embodiments of the present invention when the computer instructions are executed.
According to the technical scheme of the embodiment of the invention, the image to be identified is obtained, and comprises the following steps: a circular stamp image containing a stamp text to be identified; carrying out image processing on an image to be identified to obtain a standard circular stamp image; based on a thin plate spline transformation algorithm, carrying out image transformation on the standard circular stamp image to obtain a target strip-shaped image; the method has the advantages that the text recognition result is obtained by performing the text recognition on the text of the stamp to be recognized in the target bar-shaped image, the problems of inaccurate text recognition result and low recognition efficiency of the circular stamp caused by the omission and incomplete characters of the method for recognizing the single character in the circular stamp are solved, and the beneficial effects of improving the text recognition accuracy and the recognition efficiency of the circular stamp are achieved.
It should be understood that the statements in this section are not intended to identify key or critical features of the embodiments of the present invention, nor are they intended to limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flowchart of a method for recognizing a text of a circular stamp according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for recognizing a text of a circular stamp according to a second embodiment of the present invention;
FIG. 3 is a schematic diagram of a circular stamp image to be recognized obtained by image detection of the image to be recognized;
FIG. 4 is a schematic view of a target circular stamp image obtained by angle correction of a circular stamp image to be recognized;
FIG. 5 is a flowchart of a text recognition method for a circular stamp according to a third embodiment of the present invention;
FIG. 6 is a schematic diagram of coordinate mapping of matching point pairs of a to-be-recognized stamp text and an initial bar image of a standard circular stamp image;
FIG. 7 is a schematic structural diagram of a text recognition device for a circular stamp according to a third embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device implementing the text recognition method for a circular stamp according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," "original" or "target" and the like in the description and claims of the present invention and the above-described drawings are used for distinguishing similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Moreover, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example one
Fig. 1 is a flowchart of a method for recognizing a text in a circular stamp according to an embodiment of the present invention, where the method is applicable to a situation of recognizing a text in a circular stamp, and the method may be executed by a text recognition device of a circular stamp, and the text recognition device of a circular stamp may be implemented in a form of hardware and/or software, and the text recognition device of a circular stamp may be configured in an electronic device. As shown in fig. 1, the method includes:
s110, obtaining an image to be recognized, wherein the image to be recognized comprises: a circular stamp image containing a stamp text to be identified.
The image to be recognized is an image which is waiting to be recognized and contains a circular stamp image, and the image to be recognized can contain one or more circular stamps. Since a stamp is generally used for stamping on a document material, the image to be recognized includes, in addition to: the stamp text to be identified may also include background information such as document characters or signatures.
The text of the seal to be identified is the text of seal cutting on the circular seal contained in the image to be identified; the stamp text to be recognized may be a number, a word (chinese, english or a word in any language) or a symbol, and generally does not include: and (4) shape graphs such as five-pointed star, triangle or other custom graphs.
And S120, performing image processing on the image to be recognized to obtain a standard circular stamp image.
The standard circular stamp image refers to a circular stamp image with uniform size and angle.
Specifically, in the embodiment of the present invention, the image processing operation of the image to be recognized may include operations such as circular stamp detection, image edge detection, image rotation, and image size normalization. The specific method of image processing operation described above is not limiting to the practice of the present invention.
Illustratively, based on characteristic information such as edge characteristics and geometric characteristics of the circular stamp, stamp detection is performed on an input image to be recognized to obtain an image of the stamp to be recognized contained in the image to be recognized, and size transformation and angle transformation are performed on the image of the stamp to be recognized to obtain a standard circular stamp image.
And S130, performing image transformation on the standard circular stamp image based on a thin plate spline transformation algorithm to obtain a target strip image.
The target bar image may be understood as an image obtained by expanding a standard circular stamp image into a bar shape.
Specifically, a Thin Plate Spline (TPS) transformation algorithm belongs to a non-rigid deformation, and pixels of a stamp text to be recognized in a standard circular stamp image can be interpolated point to point into a blank bar image to obtain a target bar image based on a certain coordinate mapping rule through the TPS transformation algorithm, so that a curved text in the standard circular stamp image is unfolded into a bar text.
And S140, performing text recognition on the to-be-recognized stamp text in the target bar-shaped image to obtain a text recognition result.
Specifically, the text recognition method for the text of the stamp to be recognized is not limited, and for example, the text recognition of the text of the stamp to be recognized can be realized by using a sequence-based recognition RNN (radio network communication), namely a CRNN (CrNN algorithm).
The method has the advantages that the text recognition result can be obtained by directly recognizing the text of the stamp to be recognized in the target bar-shaped image through the text, each text character in the circular stamp image does not need to be sequentially recognized, the problems of missing detection and incomplete characters possibly existing in text recognition are solved, and the text recognition efficiency is improved.
According to the technical scheme of the embodiment of the invention, the image to be identified is obtained, and the image to be identified comprises the following components: a circular stamp image containing a stamp text to be identified; performing image processing on an image to be recognized to obtain a standard circular stamp image; based on a thin plate spline transformation algorithm, carrying out image transformation on the standard circular stamp image to obtain a target strip-shaped image; the method has the advantages that the text recognition result is obtained by performing text recognition on the text of the stamp to be recognized in the target bar-shaped image, the problems of inaccurate text recognition result and low recognition efficiency of the circular stamp caused by missing detection and incomplete characters in the method for recognizing a single character in the circular stamp can be solved, and the text recognition accuracy and the recognition efficiency of the circular stamp are improved.
Example two
Fig. 2 is a flowchart of a text recognition method for a circular stamp according to a second embodiment of the present invention, in which step "S120" of the first embodiment, an image to be recognized is processed to obtain a standard circular stamp image "is further detailed in this embodiment. As shown in fig. 2, the method includes:
s210, obtaining an image to be recognized, wherein the image to be recognized comprises a stamp text to be recognized.
S220, carrying out image detection on the image to be recognized to obtain the circular stamp image to be recognized in each target detection frame.
The circular stamp image to be recognized can be understood as the circular stamp image to be recognized detected in the image to be recognized. It is understood that if a plurality of circular stamp images exist in the image to be recognized, the circular stamp image to be recognized may be one, a plurality of or all of the circular stamp images included in the image to be recognized.
Specifically, the image detection of the image to be recognized may include: and detecting the target and the edge of the circular stamp. The image containing the circular seal in each target detection frame is obtained through target detection of the circular seal, and because the target detection frames are not strictly tangent to the boundary of the circular seal, redundancy possibly exists between the boundary of the target frames and the circular outline, the image containing the circular seal in each target detection frame can be further subjected to edge detection to obtain the image containing the circular seal to be recognized, and the noise interference outside the circular ring of the seal is reduced.
Because a stamp image often contains document characters and other interference noise points, the detection effect of the conventional stamp detection method based on the characteristics of the edge characteristics, the brightness characteristics, the contour characteristics and the like of the stamp is not robust under the conditions of stamp overlapping, character interference and the like, and the algorithm has poor anti-interference performance, so that the detection result is inaccurate.
In order to solve the above problem, the present embodiment may use lightweight network yolox-s to perform stamp target detection, for example. The specific method for detecting the target of the circular stamp of the image to be recognized can be as follows: as shown in fig. 3, the target detection of the circular stamp is performed on the acquired image to be recognized, so as to obtain N target detection frames. And for each detection target frame, respectively extending the distance of 0.1 time of the width and the height of the target detection frame outwards in the x direction and the y direction by using the center of the target detection frame to obtain a new target detection frame, and acquiring a stamp image in the new target detection frame.
For example, the method for detecting the edge of the circular stamp of the image to be recognized may be: and performing circle detection on the stamp image in each target detection frame by adopting Hofmann circle detection.
And S230, carrying out angle correction on the circular stamp image to be recognized to obtain a target circular stamp image.
Specifically, the detected stamp directions of the circular stamp image to be recognized are random, and the stamp directions of the circular stamp image to be recognized need to be unified into a positive direction, so that the text recognition of the text of the stamp to be recognized in the circular stamp image to be recognized is facilitated subsequently.
The direction of the stamp can be determined by the direction of the middle character of the stamp text to be recognized in the stamp image, and if the middle character of the stamp text to be recognized is in the positive direction, the circular stamp image to be recognized can be considered to be in the positive direction, that is, the angle to be corrected of the circular stamp image to be recognized is zero. Therefore, the circular stamp image to be recognized needs to be rotated to realize angle correction, so that the circular stamp image to be recognized is corrected into a target circular stamp image with a zero angle. For example, the angle of the circular stamp image to be recognized is corrected to obtain a target circular stamp image as shown in fig. 4.
S240, carrying out size normalization on the target circular stamp image to obtain a standard circular stamp image.
Because the sizes of the seals may be different, or the size of the image to be recognized, which contains the circular seal image, may be different from that of the original seal due to different acquisitions, the size of the target circular seal image is also different, and the size normalization of the target circular seal image can be performed to obtain a standard circular seal image with a uniform size.
Optionally, the size normalization of the target circular stamp image is performed to obtain a standard circular stamp image, which includes:
determining the circle center coordinate and the outer ring radius of the target circular seal image;
and normalizing the target circular seal image according to the circle center coordinate and the outer ring radius to obtain a standard circular seal image with a preset size.
Specifically, the size normalization of the target circular stamp image may be performed in the following manner: the center of a circle and the radius of an outer ring of the circular stamp (i.e. the radius of the circular outline of the circular stamp) in the target circular stamp image are determined, and the size of the target circular stamp image is normalized to a standard circular stamp image of a uniform preset size according to the center of the circle and the radius of the outer ring, for example, the preset size may be 300 × 300.
And S250, carrying out image transformation on the standard circular stamp image based on a thin plate spline transformation algorithm to obtain a target strip image.
And S260, performing text recognition on the to-be-recognized stamp text in the target bar-shaped image to obtain a text recognition result.
According to the technical scheme of the embodiment of the invention, the image to be recognized is obtained, and the image to be recognized comprises the seal text to be recognized; carrying out image detection on the image to be recognized to obtain a circular seal image to be recognized in each target detection frame; carrying out angle correction on the circular seal image to be recognized to obtain a target circular seal image; carrying out size normalization on the target circular seal image to obtain a standard circular seal image; based on a thin plate spline conversion algorithm, carrying out image conversion on the standard circular stamp image to obtain a target strip image; the method has the advantages that the text recognition result is obtained by performing the text recognition on the text of the stamp to be recognized in the target bar-shaped image, the problems of inaccurate text recognition result and low recognition efficiency of the circular stamp caused by the omission and incomplete characters of the method for recognizing the single character in the circular stamp can be solved, the interference information of the circular stamp image in the image to be recognized is reduced, and the text recognition accuracy and the recognition efficiency of the circular stamp are improved.
Optionally, in step S230, performing angle correction on the circular stamp image to be recognized to obtain a target circular stamp image, including:
s231, carrying out classification detection on the circular seal image to be recognized through an angle detection classification model to obtain a target angle class of the circular seal image to be recognized; the angle detection classification model is obtained by iteratively training a classification detection model through a target circular stamp image sample set; and the target circular stamp image sample in the target circular stamp image sample set is obtained by rotating the initial circular stamp image sample with the angle to be corrected being zero by taking a preset unit angle as a step length.
The angle detection classification model is obtained by iteratively training a classification detection model through a target circular stamp image sample set, and is used for performing classification detection on the circular stamp image to be recognized to determine a target angle category to which the angle of the circular stamp image to be recognized belongs. The classification detection model may be an efficinet b0 classification network model.
Because the circular angle range is 0-360 degrees and the range is too large, the regression training is directly carried out on the classification detection model, the model is not easy to converge, and the model training calculated amount is large. Therefore, in this embodiment, a stamp angle correction algorithm is provided, which is characterized in that 360 degrees are classified into a plurality of angle classes according to a preset unit angle, and an efficinet b0 classification network model is used to perform angle classification on an input circular stamp image to be recognized, where the preset unit angle may be determined according to a convergence rate of model training or a calculated amount of model training. For example, the preset unit angle is 15 degrees, 360 degrees are classified into 24 angle classes of 0-23 according to 15 degrees as one angle class. The angle corresponding to each angle category is the serial number of the angle category multiplied by a preset unit angle.
Specifically, an initial circular stamp image sample with an angle to be corrected being zero is rotated for one circle by taking a preset unit angle as a step length to obtain target circular stamp image samples of various angle types, and the target circular stamp image sample set is formed by the plurality of target circular stamp image samples and the marked actual angle types.
Illustratively, the step of iteratively training the classification detection model through the target circular stamp image sample set may include: acquiring an initial circular seal image sample set; the angle to be corrected of the initial circular stamp image sample in the initial circular stamp image sample set is zero; acquiring a target circular seal image sample obtained by rotating the initial circular seal image sample by taking a preset unit angle as a step length, wherein the target circular seal sample image is marked with an actual angle type corresponding to a rotation angle; forming a target circular stamp image sample set according to the target circular stamp image samples of the marking angle categories; inputting a target circular stamp sample image of a target image sample set into a classification detection model to obtain a prediction angle class; training parameters of a classification detection model according to an objective function formed by the prediction angle class and the actual angle class; and returning to the step of inputting the target circular stamp sample image of the target image sample set into the classification detection model to obtain the predicted angle class until the angle detection classification model is obtained.
S232, determining the angle corresponding to the target angle type as the angle to be corrected of the circular stamp image to be recognized.
Specifically, the circular seal image to be recognized is classified and detected through the angle detection classification model, and after the target angle category of the circular seal image to be recognized is obtained, the angle of the circular seal image to be recognized can be determined to be according to the target angle category and the preset unit angle: and the serial number of the target angle category is multiplied by a preset unit angle, so that the angle to be corrected is determined to be the same angle of the circular seal image to be recognized in the opposite direction. For example, if the serial number of the target angle category of the circular stamp image to be recognized is 1, and the preset unit angle is 15 degrees, the angle of the circular stamp image to be recognized is +15 degrees, and the angle to be corrected is-15 degrees.
It can be understood that the angle of the circular stamp image to be recognized and the angle to be corrected are opposite numbers, and the clockwise direction can be set as a forward angle, or the counterclockwise direction can be set as a forward angle.
And S233, performing angle rotation on the circular stamp image to be recognized according to the angle to be corrected to obtain a target circular stamp image.
Specifically, after the angle to be corrected of the circular stamp image to be recognized is determined, the angle of the circular stamp image to be recognized can be reset to zero by performing angular rotation on the circular stamp image to be recognized according to the angle to be corrected, that is, the direction of the circular stamp image to be recognized is in the forward direction.
EXAMPLE III
Fig. 5 is a flowchart of a text recognition method for a circular stamp according to a third embodiment of the present invention, where step S130 of the first embodiment or step S250 of the second embodiment is further refined by performing image transformation on a standard circular stamp image based on a thin-plate spline transformation algorithm to obtain a target bar image. As shown in fig. 5, the method includes:
s310, obtaining an image to be recognized, wherein the image to be recognized comprises a stamp text to be recognized.
And S320, processing the image to be recognized to obtain a standard circular stamp image.
S330, acquiring preset key points selected on the standard circular seal image, and forming matching point pairs corresponding to the preset key points; each group of matching point pairs comprises: and presetting coordinates of the key points and coordinates of matching points corresponding to the key points in the initial bar-shaped image.
The preset key points can be understood as key points which are selected from the standard circular stamp image and can represent main information in the standard circular stamp image. Because the information of the circular stamp image is mainly concentrated on the stamp text to be recognized which is positioned on the inner circle of the circumference, the preset key points can be selected from the stamp text to be recognized of the standard circular stamp image, such as the starting point and the end point of the stamp text to be recognized, and any point on the inner circle and the outer circle of the stamp text to be recognized. Of course, in order to reduce the deformation of the stamp text to be recognized in the bar-shaped image, the center of the standard circular stamp image can be selected as one of the preset key points.
The initial bar image can be understood as a bar image with a pixel point having a pixel value of zero, and the initial bar image is used for inserting the pixel value of the pixel point of the mapped standard circular stamp image.
Specifically, the input of the thin plate spline transformation algorithm is matching point pairs of a plurality of pixel points in the standard circular stamp image and the initial bar-shaped image, and the output is coordinate mapping of each pixel point of the standard circular stamp image and the initial bar-shaped image. Therefore, the preset key points selected on the to-be-recognized stamp text of the standard circular stamp image can be obtained from the preset key points selected on the to-be-recognized stamp text of the standard circular stamp image, the coordinates of the matching points of the preset key points in the initial bar image are determined, and a group of matching point pairs is formed according to the coordinates of each preset key point and the coordinates of the corresponding matching point.
And S340, inputting the matching point pairs into a thin plate spline conversion algorithm, and determining the mapping relation of pixel point coordinates of the stamp text to be recognized of the standard circular stamp image and the initial bar-shaped image.
Specifically, each group of formed matching point pairs is input into a thin plate spline transformation algorithm to obtain a pixel point coordinate mapping relation between the standard circular stamp image and the initial strip-shaped image, namely a coordinate mapped in the initial strip-shaped image by a coordinate corresponding to each pixel point in the standard circular stamp image.
And S350, mapping each pixel point of the to-be-identified stamp text of the standard circular stamp image into the initial bar-shaped image according to the pixel point coordinate mapping relation to form a target bar-shaped image.
Specifically, the pixel values of all the pixel points of the to-be-recognized stamp text of the standard circular stamp image are inserted into the corresponding matching points in the initial bar-shaped image according to the pixel point coordinate mapping relation, so that the to-be-recognized stamp text of the standard circular stamp image is converted into the initial bar-shaped image.
And S360, performing text recognition on the to-be-recognized stamp text in the target bar image to obtain a text recognition result.
According to the embodiment of the invention, the image to be identified is obtained, and the image to be identified comprises the seal text to be identified; and carrying out image processing on the image to be identified to obtain a standard circular stamp image. Acquiring preset key points selected on a to-be-recognized stamp text of a standard circular stamp image to form matching point pairs corresponding to the preset key points; the matching point pairs comprise: coordinates of the preset key points and coordinates of matching points corresponding to the preset key points in the initial bar-shaped image are preset; inputting each matching point pair into a thin plate spline conversion algorithm, and determining a pixel point coordinate mapping relation between a stamp text to be recognized of the standard circular stamp image and the initial bar-shaped image; mapping each pixel point of the seal text to be recognized of the standard circular seal image into the initial bar-shaped image according to the pixel point coordinate mapping relation to form a target bar-shaped image; the method has the advantages that the text recognition result is obtained by performing text recognition on the text of the stamp to be recognized in the target bar-shaped image, the problems of inaccurate text recognition result and low recognition efficiency of the circular stamp caused by omission and incomplete characters in the method for recognizing a single character in the circular stamp can be solved, the interference information of the image of the circular stamp in the image to be recognized is reduced, and the text recognition accuracy and the recognition efficiency of the circular stamp are improved.
Optionally, the matching point pairs include at least two of the following:
a first matching point pair consisting of an outer ring starting point of the stamp text to be identified in the standard circular stamp image and a first vertex of the initial bar-shaped image;
a second matching point pair consisting of an outer ring end point of the stamp text to be identified in the standard circular stamp image and a second vertex of the initial bar-shaped image; the first vertex and the second vertex form a first long edge of the initial strip-shaped image;
a third matching point pair formed by the outer ring midpoint of the stamp text to be identified in the standard circular stamp image and the first long edge midpoint of the initial bar-shaped image;
and a fourth matching point pair formed by the inner circle midpoint of the stamp text to be recognized in the standard circular stamp image and the second long edge midpoint of the initial bar-shaped image.
Specifically, as shown in fig. 6, the mapping relationship between the coordinates of the pixel points of the stamp text to be recognized of the standard circular stamp image and the initial bar image can be determined by four sets of the first matching point pair, the second matching point pair, the third matching point pair and the fourth matching point pair, so as to determine the target bar image.
Optionally, as can be seen from fig. 6, the width of the initial bar-shaped image is a difference between an outer ring radius and an inner ring radius of the stamp text to be recognized in the standard circular stamp image; the length of the initial bar-shaped image is the arc length of the outer ring starting point and the outer ring end point of the to-be-recognized stamp text in the standard circular stamp image.
Example four
Fig. 7 is a schematic structural diagram of a text recognition device for a circular stamp according to a fourth embodiment of the present invention. As shown in fig. 7, the apparatus includes: an image acquisition module 410, an image processing module 420, an image transformation module 430 and a text recognition module 440;
the image obtaining module 410 is configured to obtain an image to be identified, where the image to be identified includes: a circular stamp image containing a stamp text to be identified;
the image processing module 420 is configured to perform image processing on the image to be identified to obtain a standard circular stamp image;
the image transformation module 430 is used for carrying out image transformation on the standard circular stamp image based on a thin plate spline transformation algorithm to obtain a target strip image;
and the text recognition module 440 is configured to perform text recognition on the stamp text to be recognized in the target bar image to obtain a text recognition result.
Optionally, the image processing module 420 includes:
the image detection unit is used for carrying out image detection on the image to be recognized to obtain the circular stamp image to be recognized in each target detection frame;
the angle correction unit is used for carrying out angle correction on the circular seal image to be recognized to obtain a target circular seal image;
and the normalization unit is used for normalizing the target circular seal image to obtain a standard circular seal image.
Optionally, the angle correction unit is specifically configured to:
classifying and detecting the circular seal image to be recognized through an angle detection classification model to obtain a target angle class of the circular seal image to be recognized; the angle detection classification model is obtained by iteratively training a classification detection model through a target circular stamp image sample set; the target circular stamp image samples in the target circular stamp image sample set are obtained by rotating an initial circular stamp image sample with the angle to be corrected being zero by taking a preset unit angle as a step length;
determining the angle corresponding to the target angle category as the angle to be corrected of the circular stamp image to be recognized;
and performing angle rotation on the circular seal image to be identified according to the angle to be corrected to obtain a target circular seal image.
Optionally, the normalization unit is specifically configured to:
determining the circle center coordinate and the outer ring radius of the target circular seal image;
and normalizing the target circular seal image according to the circle center coordinate and the outer ring radius to obtain a standard circular seal image with a preset size.
Optionally, the image transformation module 430 includes:
acquiring preset key points selected on the standard circular stamp image to form a matching point pair of each preset key point; the matching point pairs include: the coordinates of the preset key points and the coordinates of the matching points corresponding to the preset key points in the initial bar-shaped image;
inputting each matching point pair into a thin plate spline transformation algorithm, and determining a pixel point coordinate mapping relation between a seal text to be identified of the standard circular seal image and the initial strip image;
and mapping each pixel point of the to-be-recognized seal text of the standard circular seal image into the initial bar-shaped image according to the pixel point coordinate mapping relation to form a target bar-shaped image.
Optionally, the matching point pairs include:
a first matching point pair consisting of an outer ring starting point of the stamp text to be identified in the standard circular stamp image and a first vertex of the initial bar-shaped image;
a second matching point pair formed by an outer ring end point of the stamp text to be recognized in the standard circular stamp image and a second vertex of the initial bar-shaped image; the first vertex and the second vertex form a first long side of the initial bar image;
a third matching point pair formed by the outer ring midpoint of the stamp text to be identified in the standard circular stamp image and the first long edge midpoint of the initial strip-shaped image;
and a fourth matching point pair formed by the middle point of the inner ring of the stamp text to be recognized in the standard circular stamp image and the middle point of the second long edge of the initial strip-shaped image.
Optionally, the width of the initial bar-shaped image is a difference value between an outer ring radius and an inner ring radius of a to-be-recognized stamp text in the standard circular stamp image; the length of the initial bar-shaped image is the arc length of the outer ring starting point and the outer ring end point of the seal text to be recognized in the standard circular seal image.
The text recognition device of the circular stamp provided by the embodiment of the invention can execute the text recognition method of the circular stamp provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
EXAMPLE five
FIG. 8 illustrates a schematic diagram of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 8, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, and the like, wherein the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data necessary for the operation of the electronic apparatus 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to the bus 14.
A number of components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, or the like; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
In some embodiments, the method of text recognition of a circular stamp may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the above-described method of text recognition of a circular stamp may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the text recognition method of the circular stamp by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Computer programs for implementing the methods of the present invention can be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above, reordering, adding or deleting steps, may be used. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solution of the present invention can be achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (10)
1. A text recognition method of a circular stamp is characterized by comprising the following steps:
acquiring an image to be recognized, wherein the image to be recognized comprises: a circular stamp image containing a stamp text to be identified;
performing image processing on the image to be identified to obtain a standard circular stamp image;
based on a thin plate spline conversion algorithm, carrying out image conversion on the standard circular stamp image to obtain a target strip image;
and performing text recognition on the stamp text to be recognized in the target bar-shaped image to obtain a text recognition result.
2. The method according to claim 1, wherein the image processing of the image to be recognized to obtain a standard circular stamp image comprises:
carrying out image detection on the image to be recognized to obtain a circular seal image to be recognized in each target detection frame;
carrying out angle correction on the circular seal image to be recognized to obtain a target circular seal image;
and carrying out size normalization on the target circular seal image to obtain a standard circular seal image.
3. The method according to claim 2, wherein the angle correction of the to-be-recognized circular stamp image to obtain the target circular stamp image comprises:
classifying and detecting the circular stamp image to be recognized through an angle detection classification model to obtain a target angle category of the circular stamp image to be recognized; the angle detection classification model is obtained by iteratively training a classification detection model through a target circular seal image sample set; the target circular stamp image sample in the target circular stamp image sample set is obtained by rotating an initial circular stamp image sample with a to-be-corrected angle of zero by taking a preset unit angle as a step length;
determining the angle corresponding to the target angle category as the angle to be corrected of the circular stamp image to be recognized;
and performing angle rotation on the circular seal image to be recognized according to the angle to be corrected to obtain a target circular seal image.
4. The method of claim 2, wherein said normalizing the size of said target circular stamp image to obtain a standard circular stamp image comprises:
determining the circle center coordinate and the outer ring radius of the target circular stamp image;
and carrying out size normalization processing on the target circular seal image according to the circle center coordinate and the outer ring radius to obtain a standard circular seal image with a preset size.
5. The method of claim 1, wherein image transforming the standard circular stamp image to obtain a target bar image based on a thin-plate spline transformation algorithm comprises:
acquiring preset key points selected on the standard circular stamp image to form matching point pairs corresponding to the preset key points; the matching point pairs include: the coordinates of the preset key points and the coordinates of the matching points corresponding to the preset key points in the initial bar-shaped image;
inputting each matching point pair into a thin plate spline transformation algorithm, and determining a pixel point coordinate mapping relation between a seal text to be identified of the standard circular seal image and the initial strip image;
and mapping each pixel point of the seal text to be recognized of the standard circular seal image into the initial bar-shaped image according to the pixel point coordinate mapping relation to form a target bar-shaped image.
6. The method of claim 5, wherein the pairs of matching points comprise at least two of:
a first matching point pair consisting of an outer ring starting point of the stamp text to be identified in the standard circular stamp image and a first vertex of the initial bar-shaped image;
a second matching point pair formed by an outer ring end point of the stamp text to be recognized in the standard circular stamp image and a second vertex of the initial bar-shaped image; the first vertex and the second vertex form a first long side of the initial bar image;
a third matching point pair formed by the middle point of the outer ring of the stamp text to be recognized in the standard circular stamp image and the middle point of the first long edge of the initial bar-shaped image;
and a fourth matching point pair formed by the inner circle midpoint of the to-be-recognized stamp text in the standard circular stamp image and the second long edge midpoint of the initial bar-shaped image.
7. The method according to claim 6, characterized in that the width of the initial bar image is the difference between the outer and inner ring radii of the stamp text to be recognized in the standard circular stamp image; the length of the initial bar-shaped image is the arc length of the outer ring starting point and the outer ring end point of the seal text to be recognized in the standard circular seal image.
8. A text recognition device for a circular stamp, comprising:
the image acquisition module is used for acquiring an image to be identified, and the image to be identified comprises: a circular stamp image containing a stamp text to be identified;
the image processing module is used for carrying out image processing on the image to be identified to obtain a standard circular stamp image;
the image transformation module is used for carrying out image transformation on the standard circular stamp image based on a thin plate spline transformation algorithm to obtain a target strip image;
and the text recognition module is used for performing text recognition on the stamp text to be recognized in the target bar-shaped image to obtain a text recognition result.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the method of text recognition of a circular stamp according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that it stores computer instructions for causing a processor to implement a method for text recognition of a circular stamp according to any one of claims 1 to 7 when executed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210831806.XA CN115188017A (en) | 2022-07-14 | 2022-07-14 | Text recognition method, device, equipment and storage medium for circular seal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210831806.XA CN115188017A (en) | 2022-07-14 | 2022-07-14 | Text recognition method, device, equipment and storage medium for circular seal |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115188017A true CN115188017A (en) | 2022-10-14 |
Family
ID=83518633
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210831806.XA Pending CN115188017A (en) | 2022-07-14 | 2022-07-14 | Text recognition method, device, equipment and storage medium for circular seal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115188017A (en) |
-
2022
- 2022-07-14 CN CN202210831806.XA patent/CN115188017A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11120254B2 (en) | Methods and apparatuses for determining hand three-dimensional data | |
WO2018010657A1 (en) | Structured text detection method and system, and computing device | |
WO2019129032A1 (en) | Remote sensing image recognition method and apparatus, storage medium and electronic device | |
US10885321B2 (en) | Hand detection method and system, image detection method and system, hand segmentation method, storage medium, and device | |
EP3846122A2 (en) | Method and apparatus for generating background-free image, device, and medium | |
CN114429633B (en) | Text recognition method, training method and device of model, electronic equipment and medium | |
CN113627439A (en) | Text structuring method, processing device, electronic device and storage medium | |
WO2024040856A1 (en) | Defect detection method and apparatus, and electronic device and storage medium | |
CN113610809B (en) | Fracture detection method, fracture detection device, electronic equipment and storage medium | |
CN112507956B (en) | Signal lamp identification method and device, electronic equipment, road side equipment and cloud control platform | |
CN115311469A (en) | Image labeling method, training method, image processing method and electronic equipment | |
CN114445825A (en) | Character detection method and device, electronic equipment and storage medium | |
CN116309963B (en) | Batch labeling method and device for images, electronic equipment and storage medium | |
WO2024174726A1 (en) | Handwritten and printed text detection method and device based on deep learning | |
CN115188017A (en) | Text recognition method, device, equipment and storage medium for circular seal | |
CN117333443A (en) | Defect detection method and device, electronic equipment and storage medium | |
CN113344890B (en) | Medical image recognition method, recognition model training method and device | |
CN116935368A (en) | Deep learning model training method, text line detection method, device and equipment | |
CN113947195A (en) | Model determination method and device, electronic equipment and memory | |
CN115809687A (en) | Training method and device for image processing network | |
CN115436899B (en) | Millimeter wave radar detection data processing method, device, equipment and storage medium | |
CN117746069B (en) | Graph searching model training method and graph searching method | |
CN118196812A (en) | Seal identification method and device, electronic equipment and storage medium | |
CN116663591A (en) | Image processing method, device, equipment and storage medium | |
CN114092698A (en) | Target information processing method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |