CN112699874A - Character recognition method and system for image in any rotation direction - Google Patents
Character recognition method and system for image in any rotation direction Download PDFInfo
- Publication number
- CN112699874A CN112699874A CN202011618735.2A CN202011618735A CN112699874A CN 112699874 A CN112699874 A CN 112699874A CN 202011618735 A CN202011618735 A CN 202011618735A CN 112699874 A CN112699874 A CN 112699874A
- Authority
- CN
- China
- Prior art keywords
- sampling
- result
- character recognition
- haar
- character
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 37
- 238000005070 sampling Methods 0.000 claims abstract description 54
- 230000009466 transformation Effects 0.000 claims abstract description 18
- 238000010606 normalization Methods 0.000 claims abstract description 17
- 239000013598 vector Substances 0.000 claims description 26
- 230000008569 process Effects 0.000 claims description 12
- 238000003860 storage Methods 0.000 claims description 12
- 239000000203 mixture Substances 0.000 claims description 2
- 238000010586 diagram Methods 0.000 description 8
- 238000004590 computer program Methods 0.000 description 7
- 238000004364 calculation method Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 230000004048 modification Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 238000006243 chemical reaction Methods 0.000 description 2
- 239000011159 matrix material Substances 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000005520 cutting process Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 238000011084 recovery Methods 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
Images
Landscapes
- Character Input (AREA)
- Character Discrimination (AREA)
Abstract
The invention provides a character recognition method and a system facing to images in any rotation direction, which sample a segmented character block with a fixed size in a polar coordinate mode; carrying out normalization processing and Haar transformation on the sampling data; comparing the result after the Haar transform with the result of the standard library, if the comparison result meets the requirement, successfully matching, and outputting matched characters; the invention can improve the recognition accuracy of the characters in the picture.
Description
Technical Field
The invention belongs to the technical field of image recognition, and particularly relates to a character recognition method and system for an image facing any rotation direction.
Background
The statements in this section merely provide background information related to the present disclosure and may not necessarily constitute prior art.
In most cases, characters in graphics need to be converted into characters in computers for editing and use, and therefore, characters in images need to be converted into editable characters through a software method.
The commonly used image-text conversion processing flow mainly comprises image input, preprocessing, inclination correction, character cutting, character recognition and layout recovery; the inventor knows that the conventional recognition method finally needs to compare characters with a standard word stock, but for images with rotation angles, the extracted characters also have rotation angles, and the problems of failed recognition and low recognition rate are easily caused for the rotation characters with any angles.
Disclosure of Invention
The invention provides a character recognition method and system facing to images in any rotation direction to solve the problems, and the character recognition method and system can improve the character recognition efficiency and accuracy rate of rotation.
According to some embodiments, the invention adopts the following technical scheme:
a character recognition method facing to images in any rotation direction comprises the following steps:
sampling the divided character blocks with fixed sizes in a polar coordinate mode;
carrying out normalization processing and Haar transformation on the sampling data;
and comparing the result after the Haar transform with the result of the standard library, if the comparison result meets the requirement, successfully matching, and outputting matched characters.
As an alternative embodiment, the specific process of sampling in polar coordinate mode includes: in a character block with a fixed size, taking the center of a character block picture as a circle center, sampling by using a radius value at a fixed interval, counting the number of black and white pixels in pixels covered by a sampling circle, and completing polar coordinate sampling.
As an alternative embodiment, the process of normalizing the sample data includes: and (3) converting the sampling result into the characteristic of the current image represented by a vector through calculating the percentage and normalization of black pixels by using the statistical result obtained by polar coordinate sampling.
As an alternative embodiment, the specific process of performing Haar transform on the normalized data includes: and inverting the sampling result to form a new group of vectors, iterating the Haar transformation for multiple times, and calculating the difference between every two pixels to generate a difference vector.
As an alternative embodiment, the Haar transform step is replaced with a gaussian mixture fit.
As an alternative embodiment, the specific process of comparing the result after the Haar transform with the result of the standard library includes calculating the euclidean distance between the difference vector and the result of the standard library, and if the euclidean distance is smaller than a preset threshold, the matching is successful.
A character recognition system for an image oriented in an arbitrary rotational direction, comprising:
the sampling module is configured to sample the divided character blocks with fixed sizes in a polar coordinate mode;
the processing module is configured to perform normalization processing and Haar transformation on the sampling data;
and the comparison module is configured to compare the result after the Haar transform with the result of the standard library, and if the comparison result meets the requirement, the matching is successful and the matched characters are output.
As an alternative embodiment, the sampling module is configured to perform sampling at fixed interval radius values with the center of the character block picture as the center of the circle in a character block with a fixed size, count the number of black and white pixels in the pixels covered by the sampled circle, and complete polar coordinate sampling.
As an alternative embodiment, the processing module includes a normalization processing module configured to normalize the sampled statistics by calculating the percentage of black pixels and normalizing to obtain a vector representing the feature of the current image.
As an alternative embodiment, the processing module includes a Haar transform module, and the specific process configured to perform Haar transform on the normalized data includes: and inverting the sampling result to form a new group of vectors, iterating the Haar transformation for multiple times, and calculating the difference between every two pixels to generate a difference vector.
A computer readable storage medium, wherein a plurality of instructions are stored, said instructions being adapted to be loaded by a processor of a terminal device and to execute the steps of said method for recognizing characters facing an image in an arbitrary rotation direction.
A terminal device comprising a processor and a computer readable storage medium, the processor being configured to implement instructions; the computer readable storage medium is used for storing a plurality of instructions, which are suitable for being loaded by a processor and executing the steps of the character recognition method facing the image with any rotation direction.
Compared with the prior art, the invention has the beneficial effects that:
the invention eliminates the influence of font rotation on identification by using polar coordinate sampling and circular symmetry characteristics, can realize identification of any rotating characters, and has high identification accuracy.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, are included to provide a further understanding of the invention, and are incorporated in and constitute a part of this specification, illustrate exemplary embodiments of the invention and together with the description serve to explain the invention and not to limit the invention.
FIG. 1 is a schematic view of a polar sampling mode;
fig. 2 is a schematic flow chart of the present embodiment.
The specific implementation mode is as follows:
the invention is further described with reference to the following figures and examples.
It is to be understood that the following detailed description is exemplary and is intended to provide further explanation of the invention as claimed. Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
It is noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of exemplary embodiments according to the invention. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, and it should be understood that when the terms "comprises" and/or "comprising" are used in this specification, they specify the presence of stated features, steps, operations, devices, components, and/or combinations thereof, unless the context clearly indicates otherwise.
A character recognition method facing to images in any rotation direction comprises the following steps:
sampling the divided character blocks with fixed sizes in a polar coordinate mode, calculating the percentage and normalization of black pixels, finally performing Haar transformation, calculating the difference between every two pixels to generate a new vector, comparing the result of Euclidean distance calculation of the difference vector with the result of a standard library, if the result is smaller than a defined threshold, successfully matching, and if the result is larger than the defined threshold, unsuccessfully matching.
Specifically, the steps are introduced as follows:
polar sampling
For inputting a divided character block of a fixed size, sampling is performed in polar coordinates to prevent the character block from being affected by the rotation of the font, and a specific sampling method is as shown in fig. 1, in a 32 × 32 picture, assuming that the unit distance of each pixel point is 1 and the center of the picture is the center of the picture, the sampling circle is set to be 1Sampling for radius, counting the number of black and white pixels in the pixel covered by the sampling circle to complete polar coordinate sampling, (b)i,wi) Where i is 0,1,2 … 15.
Through polar coordinate sampling, the influence of font rotation on identification is eliminated by utilizing the symmetry characteristic of a circle.
Sample conversion
The statistical result obtained by polar coordinate sampling is converted into a vector representing the characteristics [ n ] of the current image through calculating the percentage and normalization of black pixels0,n1,n2,…,n15]. Each value in the vector characterizes before black and white.
Haar transform
To ensure that the result after the Haar change is in the first quadrant, the result n is sampled0,n1,n2,…,n15]An inversion is made to become a new group of vectors, and the relationship with the original vector is as follows: [ r ] of0,r1,r2,…,r15]=[n15,n14,n13,…,n0]
After normalization, a vector with 16 numerical values is obtained, so 4 iterations are needed during Haar transformation; since the result after transformation contains the difference value of the pixel, the difference value can contain the relationship between the pixel and the pixel.
Standard library comparison
And comparing the data obtained after the Haar transformation with the result of the standard word stock, and according to the result of calculating the Euclidean distance, if the result is smaller than a defined threshold value, the matching is successful, and if the result is smaller than the defined threshold value, the matching is failed.
The calculation for the general euclidean distance is as follows:
the n-dimensional euclidean space is a set of points, each point X of which may be represented as (X [1] X [2] … X [ n ]), where X (i ═ 12 … n) is a real number, and the distance d (ab) between the i-th coordinate at which X is called, and two points a ═ a [1] a [2] … a [ n ]) and B ═ B [1] B [2] … B [ n ]) is defined as follows.
d(AB)=sqrt[∑((a-b)^2)](i=1,2…n)
To simplify the calculation, the d2 result can be used as the comparison result (reduction of the evolution).
In summary, as shown in fig. 2, the specific processing flow includes:
1. character input: the character segmentation of the previous stage is completed, a 32x32 pixel matrix is generated, each pixel point value is 1 (black) or 0 (white), and the character is required to be in the center of the picture;
2. polar coordinate sampling: sampling the 32x32 matrix in equal-length steps, and counting the number (bi, wi) of black and white points in each interval, wherein i is 0,1,2 … 15;
3. calculating black pixel proportion, and calculating pi-bi/bi + wi for each group (bi, wi), wherein i-0, 1,2 … 15;
4. normalization: for all pi, calculate ni pi/Σ pi, where i 0,2 … 15;
5. haar transform: the resulting vectors [ n0, n1, n2, …, n15] are fit by Haar transform, where the Harr transform is equal to the new vectors [ h0, h1, h2, …, h15 ].
6. Standard library comparison: and comparing the result of haar transformation with the results or parameters of all characters in the standard library in Euclidean distance, and considering the matching result with the minimum distance of the calculation result as the recognized character.
7. And outputting the result.
The following product examples are also provided:
a character recognition system for an image oriented in an arbitrary rotational direction, comprising:
the sampling module is configured to sample the divided character blocks with fixed sizes in a polar coordinate mode;
the processing module is configured to perform normalization processing and Haar transformation on the sampling data;
and the comparison module is configured to compare the result after the Haar transform with the result of the standard library, and if the comparison result meets the requirement, the matching is successful and the matched characters are output.
As an alternative embodiment, the sampling module is configured to perform sampling at fixed interval radius values with the center of the character block picture as the center of the circle in a character block with a fixed size, count the number of black and white pixels in the pixels covered by the sampled circle, and complete polar coordinate sampling.
As an alternative embodiment, the processing module includes a normalization processing module configured to normalize the sampled statistics by calculating the percentage of black pixels and normalizing to obtain a vector representing the feature of the current image.
As an alternative embodiment, the processing module includes a Haar transform module, and the specific process configured to perform Haar transform on the normalized data includes: and inverting the sampling result to form a new group of vectors, iterating the Haar transformation for multiple times, and calculating the difference between every two pixels to generate a difference vector.
A computer readable storage medium, wherein a plurality of instructions are stored, said instructions being adapted to be loaded by a processor of a terminal device and to execute the steps of said method for recognizing characters facing an image in an arbitrary rotation direction.
A terminal device comprising a processor and a computer readable storage medium, the processor being configured to implement instructions; the computer readable storage medium is used for storing a plurality of instructions, which are suitable for being loaded by a processor and executing the steps of the character recognition method facing the image with any rotation direction.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Although the embodiments of the present invention have been described with reference to the accompanying drawings, it is not intended to limit the scope of the present invention, and it should be understood by those skilled in the art that various modifications and variations can be made without inventive efforts by those skilled in the art based on the technical solution of the present invention.
Claims (10)
1. A character recognition method facing to images in any rotation direction is characterized in that: the method comprises the following steps:
sampling the divided character blocks with fixed sizes in a polar coordinate mode;
carrying out normalization processing and Haar transformation on the sampling data;
and comparing the result after the Haar transform with the result of the standard library, if the comparison result meets the requirement, successfully matching, and outputting matched characters.
2. The character recognition method of any rotation direction oriented image as claimed in claim 1, wherein: the specific process of sampling in a polar coordinate mode comprises the following steps: in a character block with a fixed size, taking the center of a character block picture as a circle center, sampling by using a radius value at a fixed interval, counting the number of black and white pixels in pixels covered by a sampling circle, and completing polar coordinate sampling.
3. The character recognition method of any rotation direction oriented image as claimed in claim 1, wherein: the process of normalizing the sampling data comprises the following steps: and (3) converting the sampling result into the characteristic of the current image represented by a vector through calculating the percentage and normalization of black pixels by using the statistical result obtained by polar coordinate sampling.
4. The character recognition method of any rotation direction oriented image as claimed in claim 1, wherein: the specific process of performing Haar transform on the normalized data comprises the following steps: and inverting the sampling result to form a new group of vectors, iterating the Haar transformation for multiple times, and calculating the difference between every two pixels to generate a difference vector.
5. The character recognition method of any rotation direction oriented image as claimed in claim 1, wherein: the specific process of comparing the result after the Haar transformation with the result of the standard library comprises the following steps of calculating the Euclidean distance between the difference vector and the result of the standard library, and if the Euclidean distance is smaller than a preset threshold value, successfully matching;
or, the Haar transform step is replaced by a Gaussian mixture fit.
6. A character recognition system facing to images in any rotation direction is characterized in that: the method comprises the following steps:
the sampling module is configured to sample the divided character blocks with fixed sizes in a polar coordinate mode;
the processing module is configured to perform normalization processing and Haar transformation on the sampling data;
and the comparison module is configured to compare the result after the Haar transform with the result of the standard library, and if the comparison result meets the requirement, the matching is successful and the matched characters are output.
7. The system of claim 6, wherein the character recognition system is oriented to any direction of rotation image, and further comprising: the sampling module is configured to sample in a character block with a fixed size by taking the center of a character block picture as a circle center and by taking a radius value at a fixed interval, count the number of black and white pixels in pixels covered by a sampling circle, and complete polar coordinate sampling.
8. The system of claim 6, wherein the character recognition system is oriented to any direction of rotation image, and further comprising: the processing module comprises a normalization processing module and a Haar transformation module, wherein the normalization processing module is configured to convert a sampling result into a characteristic of a current image represented by a vector through calculating the percentage and normalization of black pixels according to a statistical result obtained by sampling polar coordinates;
the Haar transform module is configured to perform Haar transform on the normalized data in a specific process including: and inverting the sampling result to form a new group of vectors, iterating the Haar transformation for multiple times, and calculating the difference between every two pixels to generate a difference vector.
9. A computer-readable storage medium characterized by: in which a plurality of instructions are stored, said instructions being adapted to be loaded by a processor of a terminal device and to carry out the steps of a method for text recognition of images oriented in arbitrary rotation directions according to any one of claims 1 to 5.
10. A terminal device is characterized in that: the system comprises a processor and a computer readable storage medium, wherein the processor is used for realizing instructions; a computer readable storage medium for storing a plurality of instructions adapted to be loaded by a processor and for performing the steps of a method for character recognition of an image oriented in an arbitrary direction of rotation according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011618735.2A CN112699874B (en) | 2020-12-30 | 2020-12-30 | Character recognition method and system for image in any rotation direction |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011618735.2A CN112699874B (en) | 2020-12-30 | 2020-12-30 | Character recognition method and system for image in any rotation direction |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112699874A true CN112699874A (en) | 2021-04-23 |
CN112699874B CN112699874B (en) | 2023-02-17 |
Family
ID=75512926
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011618735.2A Active CN112699874B (en) | 2020-12-30 | 2020-12-30 | Character recognition method and system for image in any rotation direction |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112699874B (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1549188A (en) * | 2003-05-13 | 2004-11-24 | 范科峰 | Estimation of irides image quality and status discriminating method based on irides image identification |
CN1928886A (en) * | 2006-06-27 | 2007-03-14 | 电子科技大学 | Iris identification method based on image segmentation and two-dimensional wavelet transformation |
CN105139042A (en) * | 2015-09-08 | 2015-12-09 | 携程计算机技术(上海)有限公司 | Image identification method and system |
CN106373143A (en) * | 2015-07-22 | 2017-02-01 | 中兴通讯股份有限公司 | Adaptive method and system |
US9589175B1 (en) * | 2014-09-30 | 2017-03-07 | Amazon Technologies, Inc. | Analyzing integral images with respect to Haar features |
US20180018451A1 (en) * | 2016-07-14 | 2018-01-18 | Magic Leap, Inc. | Deep neural network for iris identification |
CN110826444A (en) * | 2019-10-28 | 2020-02-21 | 北京影谱科技股份有限公司 | Facial expression recognition method and system based on Gabor filter |
CN111368643A (en) * | 2020-02-12 | 2020-07-03 | 杭州电子科技大学 | Escherichia coli dynamic growth monitoring method |
-
2020
- 2020-12-30 CN CN202011618735.2A patent/CN112699874B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1549188A (en) * | 2003-05-13 | 2004-11-24 | 范科峰 | Estimation of irides image quality and status discriminating method based on irides image identification |
CN1928886A (en) * | 2006-06-27 | 2007-03-14 | 电子科技大学 | Iris identification method based on image segmentation and two-dimensional wavelet transformation |
US9589175B1 (en) * | 2014-09-30 | 2017-03-07 | Amazon Technologies, Inc. | Analyzing integral images with respect to Haar features |
CN106373143A (en) * | 2015-07-22 | 2017-02-01 | 中兴通讯股份有限公司 | Adaptive method and system |
CN105139042A (en) * | 2015-09-08 | 2015-12-09 | 携程计算机技术(上海)有限公司 | Image identification method and system |
US20180018451A1 (en) * | 2016-07-14 | 2018-01-18 | Magic Leap, Inc. | Deep neural network for iris identification |
CN110826444A (en) * | 2019-10-28 | 2020-02-21 | 北京影谱科技股份有限公司 | Facial expression recognition method and system based on Gabor filter |
CN111368643A (en) * | 2020-02-12 | 2020-07-03 | 杭州电子科技大学 | Escherichia coli dynamic growth monitoring method |
Also Published As
Publication number | Publication date |
---|---|
CN112699874B (en) | 2023-02-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111401371B (en) | Text detection and identification method and system and computer equipment | |
CN108509915B (en) | Method and device for generating face recognition model | |
CN113140018B (en) | Method for training countermeasure network model, method for establishing word stock, device and equipment | |
CN112085701B (en) | Face ambiguity detection method and device, terminal equipment and storage medium | |
CN113569968B (en) | Model training method, target detection method, device, equipment and storage medium | |
CN110414502B (en) | Image processing method and device, electronic equipment and computer readable medium | |
US11302108B2 (en) | Rotation and scaling for optical character recognition using end-to-end deep learning | |
CN113379627A (en) | Training method of image enhancement model and method for enhancing image | |
CN110503682B (en) | Rectangular control identification method and device, terminal and storage medium | |
CN106257495A (en) | A kind of digit recognition method and device | |
CN113177479B (en) | Image classification method, device, electronic equipment and storage medium | |
WO2023284608A1 (en) | Character recognition model generating method and apparatus, computer device, and storage medium | |
CN113971830B (en) | Face recognition method, device, storage medium and electronic device | |
CN118155199A (en) | Bill identification method, bill identification device, computer equipment and storage medium | |
CN112906652B (en) | A method, device, electronic device and storage medium for recognizing face images | |
CN115294581A (en) | Method and device for identifying error characters, electronic equipment and storage medium | |
CN114140802B (en) | Text recognition method and device, electronic equipment and storage medium | |
CN115100659B (en) | Text recognition method, device, electronic equipment and storage medium | |
CN111353493A (en) | Text image direction correction method and device | |
CN112380169A (en) | Storage device, data processing method, device, apparatus, medium, and system | |
CN112699874B (en) | Character recognition method and system for image in any rotation direction | |
CN114881913B (en) | Image flaw detection method, device, electronic equipment and storage medium | |
CN115410281A (en) | Electronic signature identification method, device, equipment and storage medium | |
CN115082598A (en) | Text image generation method, text image training method, text image processing method and electronic equipment | |
CN114863442A (en) | Character recognition method, system, device and storage medium based on deep learning |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |