CN113837119A - Method and equipment for recognizing confusable characters based on gray level images - Google Patents

Method and equipment for recognizing confusable characters based on gray level images Download PDF

Info

Publication number
CN113837119A
CN113837119A CN202111142126.9A CN202111142126A CN113837119A CN 113837119 A CN113837119 A CN 113837119A CN 202111142126 A CN202111142126 A CN 202111142126A CN 113837119 A CN113837119 A CN 113837119A
Authority
CN
China
Prior art keywords
character
gray
image
gradient
value
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
Application number
CN202111142126.9A
Other languages
Chinese (zh)
Inventor
郑颖
刘武
王璇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fuzhou Symbol Information Technology Co ltd
Original Assignee
Fuzhou Symbol Information Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Fuzhou Symbol Information Technology Co ltd filed Critical Fuzhou Symbol Information Technology Co ltd
Priority to CN202111142126.9A priority Critical patent/CN113837119A/en
Publication of CN113837119A publication Critical patent/CN113837119A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)

Abstract

The invention relates to a method and equipment for recognizing confusable characters based on gray level images, wherein the method comprises the following steps of: inputting an original image, identifying the character type in the image through a character identification engine, judging whether the character belongs to a confusable character, and if the character belongs to the confusable character, performing correction processing; the correction process includes the steps of: acquiring a gray level image of the character, traversing the gray level value of each pixel point in the gray level image, and calculating the gradient value of each pixel point based on the gray level difference value of each pixel point and the adjacent pixel points; selecting a gradient value as a gradient threshold value, and calculating the gray average value of pixel points exceeding the gradient threshold value as a gray threshold value; setting pixel points with gray values larger than a gray threshold value in the gray image as black points and setting pixel points with gray values smaller than the gray threshold value as white points according to the gray threshold value to generate a binary image; and correcting the character type of the character according to the shape contour of the character in the binary image.

Description

Method and equipment for recognizing confusable characters based on gray level images
Technical Field
The invention relates to a method and equipment for recognizing confusable characters based on gray level images, and belongs to the technical field of image processing and character recognition.
Background
Currently, there are roughly 3 types of machine-readable codes used internationally, 2 lines by 44 character types for passports, 2 lines by 36 character types for identification cards, and 3 lines by 30 character types. At present, the machine-readable codes of these certificates are mainly recognized and read by using OCR recognition technology, and the machine-readable codes on these certificates contain the relevant identity information of the certificate holders, which generally includes data such as certificate numbers, nationality, birth year and month, names, etc. The corresponding checking algorithms are used for checking the correctness of the OCR recognition result in the information machine reading code areas of the certificate holder, nationality, birth year and month and the like, but the related checking algorithms are not usually available for the name of the certificate holder and the information part selected and filled by each country, so that the identification error of the information data which is not checked is easily caused, and manual proofreading and manual correction are needed. Although the accuracy of recognition can be improved by manual correction, manual correction is a time-consuming and labor-consuming process, and the recognition speed needs to be improved.
In a practical application scenario, an electronic device may cause irregular grayscale jump of a captured image due to various environmental factors, which may easily cause recognition confusion between characters having similar local forms, such as P and F in the letter type of the name part of a bearer.
Disclosure of Invention
In order to solve the problems in the prior art, the invention provides a method for recognizing confusable characters based on a gray level image, which is used for re-judging and correcting the confusable characters by searching the form contour corresponding to the character image and carrying out secondary judgment on the form contour based on the gray level image of the original character, so that the recognition error rate of the confusable characters in the OCR recognition process is reduced, the time consumption of manual proofreading and correction is reduced, and the OCR recognition efficiency is improved.
The technical scheme of the invention is as follows:
the first technical scheme is as follows:
a method for recognizing confusable characters based on gray level images comprises the following steps:
performing primary identification; inputting an original image, identifying the character type in the image through a character identification engine, and judging whether the character belongs to a confusable character according to the character type, wherein the confusable character is a character which is similar to the character and easy to be identified by mistake on the character pattern; if the characters belong to the characters easy to be confused, correction processing is carried out; if not, skipping, reserving the identification result, and not performing correction processing;
the correction process includes the steps of:
acquiring pixel point gradients of the character images; acquiring a gray level image of the character, traversing the gray level value of each pixel point in the gray level image, and calculating the gradient value of each pixel point based on the gray level difference value of each pixel point and the adjacent pixel points;
calculating a gray threshold; counting the gradient values of all the pixel points, selecting one gradient value as a gradient threshold value, and calculating the gray average value of the pixel points exceeding the gradient threshold value as a gray threshold value;
carrying out binarization on the image; setting pixel points with the gray values larger than the gray threshold value in the gray image as black points and setting pixel points with the gray values smaller than the gray threshold value as white points according to the gray threshold value to generate a binary image;
correcting characters; according to the morphological contour of the character in the binary image, the edge change condition of the target pixel point of the binary contour image is obtained, and the type of the character is determined according to which morphological feature of the character is met by the edge change condition.
Further, the specific steps of traversing the gray value of each pixel point in the gray image and calculating the gradient value of each pixel point based on the gray difference value of each pixel point and the adjacent pixel point thereof are as follows:
selecting a pixel point in a target character image to be corrected as an origin of coordinates, and establishing a horizontal rectangular coordinate system;
recording the gray value corresponding to the pixel point as P (x, y);
calculating the gradient value G of each pixel point according to the following formula:
Figure BDA0003284347140000031
further, the specific steps of counting the gradient values of all the pixel points, selecting one gradient value as a gradient threshold, and calculating the average gray level of the pixel points exceeding the gradient threshold as a gray level threshold are as follows:
counting the gradient values of all the pixel points, and obtaining the number of the pixel points corresponding to each gradient value;
taking the gradient value corresponding to the total pixel point number exceeding 25% as a gradient threshold value;
and counting the gray values of all the pixels with gradient values larger than the gradient threshold value, and taking the average value as the gray threshold value.
Further, the specific steps of character correction are as follows:
setting an array, and sequentially recording the x coordinates of the last white point pixel point of each row in the gray level image into the array;
drawing a change curve according to the change of the x coordinate in the array;
and correcting the character type in the gray image according to the outline of the change curve.
The second technical scheme is as follows:
an apparatus for recognizing confusing characters based on a grayscale image, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps when executing the program:
performing primary identification; inputting an original image, identifying the character type in the image through a character identification engine, and judging whether the character belongs to a confusable character according to the character type, wherein the confusable character is a character which is similar to the character and easy to be identified by mistake on the character pattern; if the characters belong to the characters easy to be confused, correction processing is carried out; if not, skipping, reserving the identification result, and not performing correction processing;
the correction process includes the steps of:
acquiring pixel point gradients of the character images; acquiring a gray level image of the character, traversing the gray level value of each pixel point in the gray level image, and calculating the gradient value of each pixel point based on the gray level difference value of each pixel point and the adjacent pixel points;
calculating a gray threshold; counting the gradient values of all the pixel points, selecting one gradient value as a gradient threshold value, and calculating the gray average value of the pixel points exceeding the gradient threshold value as a gray threshold value;
carrying out binarization on the image; setting pixel points with the gray values larger than the gray threshold value in the gray image as black points and setting pixel points with the gray values smaller than the gray threshold value as white points according to the gray threshold value to generate a binary image;
correcting characters; according to the morphological contour of the character in the binary image, the edge change condition of the target pixel point of the binary contour image is obtained, and the type of the character is determined according to which morphological feature of the character is met by the edge change condition.
Further, the specific steps of traversing the gray value of each pixel point in the gray image and calculating the gradient value of each pixel point based on the gray difference value of each pixel point and the adjacent pixel point thereof are as follows:
selecting a pixel point in a target character image to be corrected as an origin of coordinates, and establishing a horizontal rectangular coordinate system;
recording the gray value corresponding to the pixel point as P (x, y);
calculating the gradient value G of each pixel point according to the following formula:
Figure BDA0003284347140000051
further, the specific steps of counting the gradient values of all the pixel points, selecting one gradient value as a gradient threshold, and calculating the average gray level of the pixel points exceeding the gradient threshold as a gray level threshold are as follows:
counting the gradient values of all the pixel points, and obtaining the number of the pixel points corresponding to each gradient value;
taking the gradient value corresponding to the total pixel point number exceeding 25% as a gradient threshold value;
and counting the gray values of all the pixels with gradient values larger than the gradient threshold value, and taking the average value as the gray threshold value.
Further, the specific steps of character correction are as follows:
setting an array, and sequentially recording the x coordinates of the last white point pixel point of each row in the gray level image into the array;
drawing a change curve according to the change of the x coordinate in the array;
and correcting the character type in the gray image according to the outline of the change curve.
The invention has the following beneficial effects:
1. according to the method and the device for recognizing the confusing characters based on the gray level image, whether the character type belongs to the confusing characters or not and whether the possibility of misreading exists or not are judged, once the possibility of misreading exists, binarization is carried out on the outline based on the gray level image of the character, the outline corresponding to the character is found out, and the character is judged again according to the morphological characteristics of the outline, so that the recognition error rate among the confusing characters can be reduced, the time consumption of manual correction is reduced, and the OCR recognition efficiency is improved.
2. The invention relates to a method and equipment for identifying confusable characters based on a gray level image.
3. According to the method and the device for recognizing the confusable character based on the gray level image, the change curve is drawn through the position of the pixel point of which the last white point is set in each line of the gray level image, so that the outline form of the character can be vividly represented, and the efficiency and the accuracy of character recognition are improved.
Drawings
FIG. 1 is a flow chart of an embodiment of the present invention;
FIG. 2 is an exemplary diagram of a grayscale image in an embodiment of the invention;
FIG. 3 is a diagram illustrating an exemplary binarized image of a character P according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating an exemplary binarized image of a character F according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating an exemplary variation of a character P according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating an exemplary variation of a character F according to an embodiment of the present invention.
Detailed Description
The invention is described in detail below with reference to the figures and the specific embodiments.
The first embodiment is as follows:
referring to fig. 1, a method for recognizing confusable characters based on a gray image, comprising the steps of:
performing primary identification; inputting an original image, recognizing the character type in the original image by using a character recognition engine, for example, OCR technology and a neural network model (for example, a deep learning network model for object detection which is relatively mature at present, such as fast-RCNN, SSD and Yolo, etc.), and judging whether the character belongs to a confusable character according to the character type, where the confusable character is defined as a character which is similar to a font and easy to be recognized by mistake, and after being recognized by the character recognition engine, the possible probabilities of the two characters are similar, such as P and F, L and I, etc., and if the recognition probabilities of the two characters are similar, the characters belong to the confusable character, the confusable character can be previously entered into a system, the system judges whether the recognized character belongs to the confusable character, if the recognized character belongs to the confusable character, a correction process is performed, if the recognized character does not belong to the confusable character, skipping, reserving the recognition result, not performing correction processing, and directly outputting the recognition result of the character.
In this embodiment, based on the gray-scale image of the original character, the morphological contour corresponding to the character image is searched, and the morphological contour is secondarily determined to re-determine and correct the confusable character, so that the recognition error rate of the confusable character in the OCR recognition process is reduced, the time consumed by manual proofreading and correction is reduced, and the OCR recognition efficiency is improved, wherein the correction process includes the following steps:
referring to fig. 2, in a gray-scale image, there is obvious gray-scale jump between upper and lower adjacent pixels and between left and right adjacent pixels of a pixel at the boundary contour of a general image, so that the image can be binarized according to the gray-scale gradient difference between the adjacent pixels to obtain a contour binary image;
firstly, acquiring the gradient of pixel points relative to adjacent pixel points, acquiring a gray level image of the character, traversing the gray level value of each pixel point in the gray level image, and calculating the gradient value of each pixel point based on the gray level difference value of each pixel point and the adjacent pixel points;
and calculating a gray threshold, wherein the gray value variation range of each pixel point in the gray image is 0-255, so that the gray gradient difference range between the pixel points is also 0-255, preparing an array T with the size of 256, initializing the array T to 0, and counting the number of the pixel points corresponding to each gradient value. Counting gradient values of all pixel points, wherein the gradient values are larger at the boundary, namely the position with obvious gray level jump, in a general image, so as to obtain a rough binary contour map;
referring to fig. 3 and 4, binarizing the image, setting the pixel points with gray values greater than the gray threshold value in the gray image as black points (i.e., setting the pixel value as 0) and setting the pixel points with gray values less than the gray threshold value as white points (i.e., setting the pixel value as 255) according to the gray threshold value, and generating the binarized image, where fig. 3 is the binarized image of the character P and fig. 4 is the binarized image of the character F.
Correcting the characters, namely determining the character types of the characters according to the shape contours of the characters in the binary image; if the character type identified by the binary image is inconsistent with the character type identified by the character identification engine, correcting, and replacing the character type identified by the binary image with the originally identified character type; if the recognized character types are consistent, no processing is performed.
In the embodiment, after the character type of the image is determined by using the character recognition engine, whether the character type belongs to characters easy to confuse and whether the possibility of misreading exists is further determined, once a large possibility of misreading exists, binarization is performed on the outline based on the gray level image of the character, the outline corresponding to the character is found, and the character is determined again according to the morphological characteristics of the outline, so that the recognition error rate among the characters easy to confuse can be reduced, the time consumption of manual correction is reduced, and the efficiency of OCR recognition is improved.
Example two:
further, the specific steps of traversing the gray value of each pixel point in the gray image and calculating the gradient value of each pixel point based on the gray difference value of each pixel point and the adjacent pixel point thereof are as follows:
selecting a pixel point in a target character image to be corrected as an origin of coordinates, and establishing a horizontal rectangular coordinate system; as shown in fig. 2, taking a pixel point at the upper left corner of an image as an origin of coordinates, taking a horizontal direction to the right as an x positive direction, taking a vertical direction to the down as a y positive direction, recording the width of the image as w and the height as h, and counting the gradient difference corresponding to the pixel point (x, y) in the original image within the range of 1-w-2 in the x direction and within the range of 1-h-2 in the y direction in order to calculate the gray difference between the upper and lower adjacent pixel points and the left and right adjacent pixel points of each pixel point in the original image;
and recording the gray value corresponding to the pixel point as P (x, y), wherein x belongs to [1, w-2], y belongs to [1, h-2 ].
The corresponding gradient G (x, y) calculation formula includes, but is not limited to:
Figure BDA0003284347140000091
the obtained corresponding gradient G is counted, TG=TG+1(G∈[0,255])。
Further, the specific steps of selecting a gradient value as a gradient threshold value and calculating the average gray value of the pixel points exceeding the gradient threshold value as a gray threshold value are as follows:
and calculating the gradient value of each pixel point in the range, and counting the gradient values of (w-2) × (h-2) pixel points in total to obtain the number of the pixel points corresponding to each gradient value. Since the gray level jump at the boundary contour is obvious, i.e. the corresponding ladderThe value is larger, so the higher value of the gradient obtained by statistics is taken as a gradient threshold value, the statistical summation is started by the number of pixel points corresponding to the highest value of the gradient, and the gradient value corresponding to more than 25 percent of the total number of the pixel points is taken as a gradient threshold value Gn(n∈[0,255]) (ii) a With 25% as a threshold, the complete contour shape of the character can be obtained well, i.e. at least the number of contour points is ensured to exceed 1/4 of the total number of pixel points of the character image. And the threshold value can better highlight the morphological characteristics of the character.
Figure BDA0003284347140000101
According to the selected gradient threshold, once the gradient value G (x, y) corresponding to a certain point in the gradient image is larger than the gradient threshold, the point (x, y) in the original gray image can be considered to be possibly at the boundary contour position, the gray value P (x, y) of the pixel points corresponding to the possible boundary contour positions is calculated and counted, and the average value is taken as the gray threshold Pn:
Figure BDA0003284347140000102
Wherein P (x, y) satisfies the condition G (x, y)>GnAnd m is the number of pixel points meeting the condition.
Further, the concrete steps of correcting the character type of the character according to the shape contour of the character in the binary image are as follows:
preparing an array with the size of binary image height h, and sequentially recording the x coordinates of the pixel points with the last white point of each line in the gray level image into the array;
recording the position of the last pixel white point corresponding to each line of the image according to the negative direction of a y axis by the lower right corner (w-1, h-1) of a binary image with the image width of w and the height of h to obtain an x coordinate change drawing change curve in the array;
referring to fig. 5 and 6, fig. 5 is a graph showing the variation of the character P, fig. 6 is a graph showing the variation of the character F, and in the position of the last pixel white point corresponding to each line obtained by recording, if within the range of the image height h, recording is performedOf the last pixel white point { x }0,x1,x2,.....,xh-1The character is judged to be F if the character shows a clear trend of increasing, then decreasing and then increasing, namely two peaks appear and a trough is included between the two peaks. If only one peak appears, the letter P can be considered without the valley between the peaks.
Example three:
an apparatus for recognizing confusing characters based on a grayscale image, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps when executing the program:
performing primary identification; inputting an original image, recognizing character types in the original image through an OCR technology and a neural network model (for example, a deep learning network model for target detection which is relatively mature at present, such as fast-RCNN, SSD, Yolo and the like), judging whether the character belongs to an easily confused character according to the character types, wherein the easily confused character is defined as a character which is similar to a character pattern and easy to be recognized by mistake, and after being recognized by a character recognition engine, the possible probabilities of the two characters are similar, such as P, F, L, I and the like, and once the recognition probabilities of the two characters are similar, the characters belong to the easily confused character, the easily confused character can be recorded into a system in advance, the system judges whether the recognized character belongs to the easily confused character, if the character belongs to the easily confused character, correction processing is carried out, if the character does not belong to the easily confused character, skipping is carried out, and a recognition result is kept, the recognition result of the character is directly output without correction processing.
In this embodiment, based on the gray-scale image of the original character, the morphological contour corresponding to the character image is searched, and the morphological contour is secondarily determined to re-determine and correct the confusable character, so that the recognition error rate of the confusable character in the OCR recognition process is reduced, the time consumed by manual proofreading and correction is reduced, and the OCR recognition efficiency is improved, wherein the correction process includes the following steps:
referring to fig. 2, in a gray-scale image, there is obvious gray-scale jump between upper and lower adjacent pixels and between left and right adjacent pixels of a pixel at the boundary contour of a general image, so that the image can be binarized according to the gray-scale gradient difference between the adjacent pixels to obtain a contour binary image;
firstly, acquiring the gradient of pixel points relative to adjacent pixel points, acquiring a gray level image of the character, traversing the gray level value of each pixel point in the gray level image, and calculating the gradient value of each pixel point based on the gray level difference value of each pixel point and the adjacent pixel points;
and calculating a gray threshold, wherein the gray value variation range of each pixel point in the gray image is 0-255, so that the gray gradient difference range between the pixel points is also 0-255, preparing an array T with the size of 256, initializing the array T to 0, and counting the number of the pixel points corresponding to each gradient value. Counting gradient values of all pixel points, wherein the gradient values are larger at the boundary, namely the position with obvious gray level jump, in a general image, so as to obtain a rough binary contour map;
referring to fig. 3 and 4, binarizing the image, setting the pixel points with gray values greater than the gray threshold value in the gray image as black points (i.e., setting the pixel value as 0) and setting the pixel points with gray values less than the gray threshold value as white points (i.e., setting the pixel value as 255) according to the gray threshold value, and generating the binarized image, where fig. 3 is the binarized image of the character P and fig. 4 is the binarized image of the character F.
Correcting the characters, namely determining the character types of the characters according to the shape contours of the characters in the binary image; if the character type identified by the binary image is inconsistent with the character type identified by the character identification engine, correcting, and replacing the character type identified by the binary image with the originally identified character type; if the recognized character types are consistent, no processing is performed.
In the embodiment, after the character type of the image is determined by using the character recognition engine, whether the character type belongs to characters easy to confuse and whether the possibility of misreading exists is further determined, once a large possibility of misreading exists, binarization is performed on the outline based on the gray level image of the character, the outline corresponding to the character is found, and the character is determined again according to the morphological characteristics of the outline, so that the recognition error rate among the characters easy to confuse can be reduced, the time consumption of manual correction is reduced, and the efficiency of OCR recognition is improved.
Example four:
further, the specific steps of traversing the gray value of each pixel point in the gray image and calculating the gradient value of each pixel point based on the gray difference value of each pixel point and the adjacent pixel point thereof are as follows:
selecting a pixel point in a target character image to be corrected as an origin of coordinates, and establishing a horizontal rectangular coordinate system; as shown in fig. 2, taking a pixel point at the upper left corner of an image as an origin of coordinates, taking a horizontal direction to the right as an x positive direction, taking a vertical direction to the down as a y positive direction, recording the width of the image as w and the height as h, and counting the gradient difference corresponding to the pixel point (x, y) in the original image within the range of 1-w-2 in the x direction and within the range of 1-h-2 in the y direction in order to calculate the gray difference between the upper and lower adjacent pixel points and the left and right adjacent pixel points of each pixel point in the original image;
and recording the gray value corresponding to the pixel point as P (x, y), wherein x belongs to [1, w-2], y belongs to [1, h-2 ].
The corresponding gradient G (x, y) calculation formula includes, but is not limited to:
Figure BDA0003284347140000131
the obtained corresponding gradient G is counted, TG=TG+1(G∈[0,255])。
Further, the specific steps of selecting a gradient value as a gradient threshold value and calculating the average gray value of the pixel points exceeding the gradient threshold value as a gray threshold value are as follows:
and calculating the gradient value of each pixel point in the range, and counting the gradient values of (w-2) × (h-2) pixel points in total to obtain the number of the pixel points corresponding to each gradient value. Since the gray level jump at the boundary contour is obvious, i.e. the corresponding gradient value is large, the statistically obtained gradient takes a higher value as the gradient threshold, here the gradient threshold isCounting and summing the number of pixel points corresponding to the highest value of the degree, and taking the gradient value corresponding to more than 25% of the total number of the pixel points as a gradient threshold value Gn(n∈[0,255])。
Figure BDA0003284347140000141
According to the selected gradient threshold, once the gradient value G (x, y) corresponding to a certain point in the gradient image is larger than the gradient threshold, the point (x, y) in the original gray image can be considered to be possibly at the boundary contour position, the gray value P (x, y) of the pixel points corresponding to the possible boundary contour positions is calculated and counted, and the average value is taken as the gray threshold Pn:
Figure BDA0003284347140000142
Wherein P (x, y) satisfies the condition G (x, y)>GnAnd m is the number of pixel points meeting the condition.
Further, the concrete steps of correcting the character type of the character according to the shape contour of the character in the binary image are as follows:
preparing an array with the size of binary image height h, and sequentially recording the x coordinates of the pixel points with the last white point of each line in the gray level image into the array;
recording the position of the last pixel white point corresponding to each line of the image according to the negative direction of a y axis by the lower right corner (w-1, h-1) of a binary image with the image width of w and the height of h to obtain an x coordinate change drawing change curve in the array;
referring to fig. 5 and 6, fig. 5 is a variation of the character P, fig. 6 is a variation of the character F, and of the positions of the last pixel white point corresponding to each line obtained by recording, if within the range of the image height h, the position { x } of the last pixel white point is recorded0,x1,x2,.....,xh-1The character is judged to be F if the character shows a clear trend of increasing, then decreasing and then increasing, namely two peaks appear and a trough is included between the two peaks. If only one peak appears, there is no peakThe case where a valley is included in a space can be regarded as the letter P.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes performed by the present specification and drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (8)

1. A method for correcting confusable characters based on a grayscale image, comprising the steps of:
performing primary identification; inputting an original image, identifying the character type in the image through a character identification engine, and judging whether the character belongs to a confusable character according to the character type, wherein the confusable character is a character which is similar to the character and easy to be identified by mistake on the character pattern; if the characters belong to the characters easy to be confused, correction processing is carried out; if not, skipping, reserving the identification result, and not performing correction processing;
the correction process includes the steps of:
acquiring pixel point gradients of the character images; acquiring a gray level image of the character, traversing the gray level value of each pixel point in the gray level image, and calculating the gradient value of each pixel point based on the gray level difference value of each pixel point and the adjacent pixel points;
calculating a gray threshold; counting the gradient values of all the pixel points, selecting one gradient value as a gradient threshold value, and calculating the gray average value of the pixel points exceeding the gradient threshold value as a gray threshold value;
carrying out binarization on the image; setting pixel points with the gray values larger than the gray threshold value in the gray image as black points and setting pixel points with the gray values smaller than the gray threshold value as white points according to the gray threshold value to generate a binary image;
correcting characters; according to the morphological contour of the character in the binary image, the edge change condition of the target pixel point of the binary contour image is obtained, and the type of the character is determined according to which morphological feature of the character is met by the edge change condition.
2. The method of claim 1, wherein the step of traversing the gray level of each pixel in the gray level image and calculating the gradient value of each pixel based on the gray level difference between each pixel and its neighboring pixels comprises:
selecting a pixel point in a target character image to be corrected as an origin of coordinates, and establishing a horizontal rectangular coordinate system;
recording the gray value corresponding to the pixel point as P (x, y);
calculating the gradient value G of each pixel point according to the following formula:
Figure FDA0003284347130000021
3. the method for recognizing confusing characters based on gray level images according to claim 2, wherein the specific steps of counting the gradient values of all the pixel points, selecting one gradient value as a gradient threshold, and calculating the average gray level value of the pixel points exceeding the gradient threshold as the gray level threshold are as follows:
counting the gradient values of all the pixel points, and obtaining the number of the pixel points corresponding to each gradient value;
taking the gradient value corresponding to the total pixel point number exceeding 25% as a gradient threshold value;
and counting the gray values of all the pixels with gradient values larger than the gradient threshold value, and taking the average value as the gray threshold value.
4. The method for recognizing confusing characters according to claim 2, which is characterized by comprising the following specific steps of:
setting an array, and sequentially recording the x coordinates of the last white point pixel point of each row in the gray level image into the array;
drawing a change curve according to the change of the x coordinate in the array;
and correcting the character type in the gray image according to the outline of the change curve.
5. An apparatus for recognizing confusing characters based on a gray scale image, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the program to perform the steps of:
performing primary identification; inputting an original image, identifying the character type in the image through a character identification engine, and judging whether the character belongs to a confusable character according to the character type, wherein the confusable character is a character which is similar to the character and easy to be identified by mistake on the character pattern; if the characters belong to the characters easy to be confused, correction processing is carried out; if not, skipping, reserving the identification result, and not performing correction processing;
the correction process includes the steps of:
acquiring pixel point gradients of the character images; acquiring a gray level image of the character, traversing the gray level value of each pixel point in the gray level image, and calculating the gradient value of each pixel point based on the gray level difference value of each pixel point and the adjacent pixel points;
calculating a gray threshold; counting the gradient values of all the pixel points, selecting one gradient value as a gradient threshold value, and calculating the gray average value of the pixel points exceeding the gradient threshold value as a gray threshold value;
carrying out binarization on the image; setting pixel points with the gray values larger than the gray threshold value in the gray image as black points and setting pixel points with the gray values smaller than the gray threshold value as white points according to the gray threshold value to generate a binary image;
correcting characters; according to the morphological contour of the character in the binary image, the edge change condition of the target pixel point of the binary contour image is obtained, and the type of the character is determined according to which morphological feature of the character is met by the edge change condition.
6. The apparatus of claim 5, wherein the step of traversing the gray level of each pixel in the gray level image and calculating the gradient value of each pixel based on the gray level difference between each pixel and its neighboring pixels comprises:
selecting a pixel point in a target character image to be corrected as an origin of coordinates, and establishing a horizontal rectangular coordinate system;
recording the gray value corresponding to the pixel point as P (x, y);
calculating the gradient value G of each pixel point according to the following formula:
Figure FDA0003284347130000041
7. the apparatus for recognizing confusing characters according to claim 6, wherein the specific steps of counting the gradient values of all the pixels, selecting one gradient value as the gradient threshold, and calculating the average gray value of the pixels exceeding the gradient threshold as the gray threshold are as follows:
counting the gradient values of all the pixel points, and obtaining the number of the pixel points corresponding to each gradient value;
taking the gradient value corresponding to the total pixel point number exceeding 25% as a gradient threshold value;
and counting the gray values of all the pixels with gradient values larger than the gradient threshold value, and taking the average value as the gray threshold value.
8. The apparatus for recognizing confusing characters according to claim 6, wherein the specific steps of character correction are as follows:
setting an array, and sequentially recording the x coordinates of the last white point pixel point of each row in the gray level image into the array;
drawing a change curve according to the change of the x coordinate in the array;
and correcting the character type in the gray image according to the outline of the change curve.
CN202111142126.9A 2021-09-28 2021-09-28 Method and equipment for recognizing confusable characters based on gray level images Pending CN113837119A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111142126.9A CN113837119A (en) 2021-09-28 2021-09-28 Method and equipment for recognizing confusable characters based on gray level images

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111142126.9A CN113837119A (en) 2021-09-28 2021-09-28 Method and equipment for recognizing confusable characters based on gray level images

Publications (1)

Publication Number Publication Date
CN113837119A true CN113837119A (en) 2021-12-24

Family

ID=78966922

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111142126.9A Pending CN113837119A (en) 2021-09-28 2021-09-28 Method and equipment for recognizing confusable characters based on gray level images

Country Status (1)

Country Link
CN (1) CN113837119A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114926839A (en) * 2022-07-22 2022-08-19 富璟科技(深圳)有限公司 Image identification method based on RPA and AI and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114926839A (en) * 2022-07-22 2022-08-19 富璟科技(深圳)有限公司 Image identification method based on RPA and AI and electronic equipment
CN114926839B (en) * 2022-07-22 2022-10-14 富璟科技(深圳)有限公司 Image identification method based on RPA and AI and electronic equipment

Similar Documents

Publication Publication Date Title
CN111814722A (en) Method and device for identifying table in image, electronic equipment and storage medium
CN110119741B (en) Card image information identification method with background
CN108596166A (en) A kind of container number identification method based on convolutional neural networks classification
CN108108734B (en) License plate recognition method and device
CN108197644A (en) A kind of image-recognizing method and device
JP2002133426A (en) Ruled line extracting device for extracting ruled line from multiple image
JP2014153820A (en) Character segmentation device and character segmentation method
CN110598566A (en) Image processing method, device, terminal and computer readable storage medium
CN111737478B (en) Text detection method, electronic device and computer readable medium
CN111178290A (en) Signature verification method and device
CN112507782A (en) Text image recognition method and device
CN111598104B (en) License plate character recognition method and system
CN111340023A (en) Text recognition method and device, electronic equipment and storage medium
CN109389110B (en) Region determination method and device
CN113903024A (en) Handwritten bill numerical value information identification method, system, medium and device
CN111814673A (en) Method, device and equipment for correcting text detection bounding box and storage medium
CN112541504A (en) Method for detecting single character target in text
CN111126266B (en) Text processing method, text processing system, equipment and medium
CN111626145A (en) Simple and effective incomplete form identification and page-crossing splicing method
CN113837119A (en) Method and equipment for recognizing confusable characters based on gray level images
CN114241463A (en) Signature verification method and device, computer equipment and storage medium
CN112036294B (en) Method and device for automatically identifying paper form structure
CN112597868A (en) Test paper identification and correction method based on no positioning point
CN109726722B (en) Character segmentation method and device
CN113537216B (en) Dot matrix font text line inclination correction method and device

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