CN114743207A - Bill image recognition method and device - Google Patents

Bill image recognition method and device Download PDF

Info

Publication number
CN114743207A
CN114743207A CN202210320570.3A CN202210320570A CN114743207A CN 114743207 A CN114743207 A CN 114743207A CN 202210320570 A CN202210320570 A CN 202210320570A CN 114743207 A CN114743207 A CN 114743207A
Authority
CN
China
Prior art keywords
target
determining
characters
image
boundary
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
CN202210320570.3A
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.)
Shenzhen Yihua Computer Co Ltd
Original Assignee
Shenzhen Yihua Computer 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 Shenzhen Yihua Computer Co Ltd filed Critical Shenzhen Yihua Computer Co Ltd
Priority to CN202210320570.3A priority Critical patent/CN114743207A/en
Publication of CN114743207A publication Critical patent/CN114743207A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Character Input (AREA)

Abstract

The embodiment of the invention provides a bill image identification method and a bill image identification device, wherein the method comprises the following steps: firstly calling a preset template, matching the preset template with a bill image to obtain an initial to-be-recognized area of the bill image, wherein the initial to-be-recognized area comprises a plurality of characters, generating external rectangles aiming at the outlines of the characters when the characters are determined to comprise printed characters, then determining a target external rectangle from the external rectangles of the characters, performing horizontal projection and vertical projection aiming at the target external rectangle to obtain the boundary of the printed characters, determining the area formed by the boundary as the target to-be-recognized area of the bill image, and finally recognizing the printed characters of the target to-be-recognized area. The method and the device are suitable for image recognition of various bills, have strong universality and stability, can solve the problem of interception errors of the area to be recognized caused by non-standard printing equipment and operation, improve the accuracy of OCR recognition and improve the efficiency of algorithm execution.

Description

Bill image recognition method and device
Technical Field
The invention relates to the technical field of image recognition, in particular to a bill image recognition method and a bill image recognition device.
Background
OCR (Optical Character Recognition) refers to a process in which an electronic device examines a Character printed on paper, determines its shape by detecting dark and light patterns, and then translates the shape into a computer text using a Character Recognition method.
Before OCR recognition, a target area where a printing element to be recognized on a bill is located needs to be determined, and the current general mode is to intercept a fixed area, then carry out binarization, then ask for a connected domain, ask for an external rectangle through the connected domain, and the external rectangle is used as the target area, so that subsequent OCR recognition is carried out.
However, because the printing device is unstable in printing or the bill placement is not standardized, the printed content may shift up and down or left and right, which results in that the printed content cannot be accurately printed in the designated area, and therefore, the fixed area for capturing is prone to cause position capturing errors. In addition, the connected domain searching is used, and the intercepted area is too large or too small due to the interference of factors such as transverse lines, ink, background textures and the like in the area, so that the accuracy of subsequent OCR recognition is influenced.
Disclosure of Invention
In view of the above problems, an embodiment of the present invention provides a method for identifying a bill image, so as to solve the problem of an interception error of an area to be identified due to an irregular printing device and operation.
The embodiment of the invention also provides a bill image recognition device so as to ensure the implementation of the method.
The embodiment of the invention discloses a bill image identification method, which comprises the following steps:
calling a preset template, and matching the preset template with the bill image to obtain an initial to-be-identified area of the bill image; the initial region to be recognized comprises a plurality of characters;
when the plurality of characters are determined to comprise the printed characters, generating a circumscribed rectangle aiming at the outlines of the plurality of characters, and determining a target circumscribed rectangle from the circumscribed rectangles of the plurality of characters;
performing horizontal projection and vertical projection on the target circumscribed rectangle to obtain the boundary of the printed characters, and determining the region formed by the boundary as a target to-be-identified region of the bill image;
and identifying the printed characters of the target area to be identified.
Optionally, the acquiring the bill image includes a print character, the preset template includes a preset character, and the matching the preset template with the bill image to obtain an initial to-be-identified area of the bill image includes:
determining a target preset character matched with the printed character;
determining the position of the target preset character as the position of the printed character;
shifting the position of the printed character to obtain an initial position to be identified;
and generating an initial region to be identified of the bill image according to the initial position to be identified.
Optionally, the method further comprises:
carrying out binarization on the bill images under different light sources and different color channels to obtain a plurality of first binary images;
respectively counting the number of pixel points with target pixel values in each row of the initial region to be identified aiming at the plurality of first binary images;
if the number of the pixel points is larger than a first number threshold, determining the row where the number of the pixel points is located as an effective row;
determining the row number of continuous effective rows;
if the number of lines is greater than a second number threshold, determining that the plurality of characters includes a print character;
if the number of lines is not greater than a second number threshold, determining that the plurality of characters does not include a printed character.
Optionally, the method further comprises:
acquiring a binarization threshold value with a plurality of pixel values decreasing progressively;
adopting the binarization threshold values with the plurality of pixel values decreasing progressively to carry out binarization on the bill image respectively to obtain a plurality of second binary value images;
selecting a second binary image from the plurality of second binary images as a target binary image according to the sequence of the pixel values from large to small;
generating a circumscribed rectangle for the outlines of the plurality of characters, comprising:
and executing the step of generating a circumscribed rectangle for the outlines of the characters by adopting the target binary image.
Optionally, the determining a target circumscribed rectangle from the circumscribed rectangles of the plurality of characters includes:
determining a height of a circumscribed rectangle of the plurality of characters;
and determining the circumscribed rectangle with the height within the first preset range as a target circumscribed rectangle.
Optionally, the performing horizontal projection and vertical projection on the target circumscribed rectangle to obtain the boundary of the printed character includes:
traversing each line of the target circumscribed rectangle based on horizontal projection, and determining a plurality of pairs of upper and lower boundaries;
determining target upper and lower boundaries from the plurality of pairs of upper and lower boundaries;
traversing each column between the upper and lower boundaries of the target based on the vertical projection, and determining a plurality of pairs of left and right boundaries;
determining a target left-right boundary from the plurality of pairs of left-right boundaries;
the determining the area formed by the boundary as the target area to be identified of the bill image comprises the following steps:
and determining the area formed by the upper and lower boundaries of the target and the left and right boundaries of the target as the target to-be-identified area of the bill image.
Optionally, the determining the target upper and lower boundaries from the plurality of pairs of upper and lower boundaries includes:
determining the height of each pair of upper and lower boundaries;
determining an upper boundary and a lower boundary with the height within a second preset range as an upper boundary and a lower boundary of the target;
the determining a target left-right boundary from the plurality of pairs of left-right boundaries comprises:
determining the width of each pair of left and right boundaries;
and determining the left and right boundaries with the width within the third preset range as target left and right boundaries.
Optionally, the method further comprises:
and when the target circumscribed rectangle, the target upper and lower boundaries or the target left and right boundaries do not exist, selecting a next second binary image from the plurality of second binary images as a target binary image according to the sequence of pixel values from large to small.
The embodiment of the invention also discloses a bill image recognition device, which comprises:
the initial region to be identified obtaining module is used for calling a preset template, matching the preset template with the bill image and obtaining an initial region to be identified of the bill image; the initial region to be recognized comprises a plurality of characters;
a target circumscribed rectangle determination module, configured to, when it is determined that the plurality of characters include a print character, generate a circumscribed rectangle for the outlines of the plurality of characters, and determine a target circumscribed rectangle from the circumscribed rectangles of the plurality of characters;
the target to-be-recognized area determining module is used for performing horizontal projection and vertical projection on the target circumscribed rectangle to obtain the boundary of the printed characters, and determining an area formed by the boundary as a target to-be-recognized area of the bill image;
and the identification module is used for identifying the printed characters of the target area to be identified.
Optionally, the ticket image includes printed characters, the preset template includes preset characters, and the initial region to be recognized obtaining module includes:
the matching sub-module is used for determining a target preset character matched with the printing character;
the position determining submodule is used for determining the position of the target preset character as the position of the printed character;
the offset submodule is used for offsetting the position of the printed character to obtain an initial position to be identified;
and the initial region to be identified generating submodule is used for generating the initial region to be identified of the bill image according to the initial position to be identified.
Optionally, the apparatus further comprises:
the first binary image obtaining module is used for carrying out binarization on the bill images under different light sources and different color channels to obtain a plurality of first binary images;
the pixel point number counting module is used for counting the number of pixel points with target pixel values in each row of the initial region to be identified respectively according to the plurality of first binary images;
the effective line determining module is used for determining the line where the pixel number is located as an effective line if the pixel number is larger than a first number threshold;
the line number determining module is used for determining the line number of continuous effective lines;
a first print character determination module configured to determine that the plurality of characters includes a print character if the number of lines is greater than a second number threshold;
a second print character determination module to determine that the plurality of characters do not include a print character if the number of lines is not greater than a second number threshold.
Optionally, the apparatus further comprises:
a binarization threshold value obtaining module, configured to obtain a binarization threshold value at which a plurality of pixel values decrease progressively;
a second binary image obtaining module, configured to perform binarization on the bill image respectively by using the binarization threshold values with decreasing pixel values to obtain a plurality of second binary images;
the first target binary image selecting module is used for selecting one second binary image from the plurality of second binary images as a target binary image according to the sequence of pixel values from large to small;
the target circumscribed rectangle determining module comprises:
and the circumscribed rectangle generation submodule is used for executing the step of generating the circumscribed rectangle aiming at the outlines of the characters by adopting the target binary image.
Optionally, the target bounding rectangle determining module includes:
a height determination submodule of the circumscribed rectangle for determining the height of the circumscribed rectangle of the plurality of characters;
and the target circumscribed rectangle determining submodule is used for determining the circumscribed rectangle with the height within a first preset range as the target circumscribed rectangle.
Optionally, the target to-be-recognized region determining module includes:
the first traversal submodule is used for traversing each line of the target circumscribed rectangle based on horizontal projection and determining a plurality of pairs of upper and lower boundaries;
a target upper and lower boundary determining submodule for determining a target upper and lower boundary from the plurality of pairs of upper and lower boundaries;
the second traversal submodule is used for traversing each column between the upper boundary and the lower boundary of the target based on vertical projection and determining a plurality of pairs of left and right boundaries;
a target left-right boundary determining submodule for determining a target left-right boundary from the plurality of pairs of left-right boundaries;
the target area to be identified determining module comprises:
and the target area to be recognized determining submodule is used for determining an area formed by the upper and lower boundaries of the target and the left and right boundaries of the target as the target area to be recognized of the bill image.
Optionally, the target left-right boundary determining submodule includes:
a height determining unit for upper and lower boundaries for determining the height of each pair of upper and lower boundaries;
the target upper and lower boundary determining unit is used for determining an upper and lower boundary with the height within a second preset range as a target upper and lower boundary;
the target left-right boundary determining submodule includes:
a left and right boundary width determination unit for a first height determination submodule for determining the width of each pair of left and right boundaries;
and the target left-right boundary determining unit is used for determining the left-right boundary with the width within a third preset range as the target left-right boundary.
Optionally, the apparatus further comprises:
and the second target binary image selecting module is used for selecting the next second binary image from the plurality of second binary images as the target binary image according to the sequence of pixel values from large to small when the target circumscribed rectangle, the target upper and lower boundaries, or the target left and right boundaries do not exist.
The embodiment of the invention also discloses electronic equipment which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory finish mutual communication through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the method according to the embodiment of the present invention when executing the program stored in the memory.
Also disclosed is a computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform a method according to an embodiment of the invention.
Compared with the prior art, the embodiment of the invention has the following advantages:
in the embodiment of the invention, a preset template is called first, the preset template is matched with a bill image to obtain an initial to-be-recognized area of the bill image, wherein the initial to-be-recognized area comprises a plurality of characters, when the plurality of characters are determined to comprise printed characters, external rectangles are generated according to the outlines of the plurality of characters, then a target external rectangle is determined from the external rectangles of the plurality of characters, horizontal projection and vertical projection are carried out according to the target external rectangle to obtain the boundary of the printed characters, then the area formed by the boundary is determined as the target to-be-recognized area of the bill image, and finally the printed characters of the target to-be-recognized area are recognized. The method and the device are suitable for image recognition of various bills, have strong universality and stability, can solve the problem of interception errors of the area to be recognized caused by non-standard printing equipment and operation, improve the accuracy of OCR recognition and improve the efficiency of algorithm execution.
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.
FIGS. 1A-1B are schematic intercepting diagrams of an area to be identified in the prior art;
FIG. 2 is a flowchart illustrating steps of a method for identifying a document image according to an embodiment of the present invention;
FIG. 3 is a schematic view of a ticket image provided by an embodiment of the present invention;
FIG. 4 is a schematic diagram of template matching provided by an embodiment of the present invention;
FIGS. 5A-5B are first binary graphs provided by an embodiment of the present invention;
FIG. 6 is a schematic diagram of a circumscribed rectangle provided in an embodiment of the present invention;
FIGS. 7A to 7C are diagrams showing the effects provided by the embodiment of the present invention;
FIG. 8 is a block diagram of a bill image recognition process provided by an embodiment of the invention;
fig. 9 is a block diagram of a bill image recognition apparatus according to an embodiment of the present invention.
Detailed Description
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 some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the work of recovering bills such as checks, deposit slips, incoming bills and the like and reimbursing the bills, workers need to check the printed information on the bill surface, and manual checking needs to consume a large amount of time, so that the efficiency is low and errors are easy to occur.
OCR can solve the problem that the efficiency is low and the mistake is easy to occur in manual checking well. Generally, before OCR recognition, an area to be recognized needs to be intercepted on a bill so that OCR recognizes characters in the area to be recognized.
Referring to fig. 1A to 1B, schematic intercepting diagrams of a to-be-identified area in the prior art are shown, where in fig. 1A, due to unstable printing of a printing device or irregular bill placement, printed contents may shift up and down, shift left and right, and thus cannot be accurately printed in a designated area, and therefore, a fixed area intercepted easily causes position intercepting errors, see areas a1 to A3 in fig. 1A. In addition, since the irrelevant factors such as the horizontal line, the ink, and the background texture exist on the ticket surface in fig. 1B, the cut area is too large or too small by using the connected domain search because the area is interfered by the irrelevant factors such as the horizontal line, the ink, and the background texture, which is shown in fig. 1B as areas B1 to B3. It can be seen that both of the above situations affect the accuracy of subsequent OCR recognition.
Aiming at the problems that interception is easy to make mistakes due to directly intercepting a fixed area, ticket faces are easy to be interfered due to other irrelevant factors and the like in the prior art, the embodiment of the invention provides a ticket image identification method, which can be suitable for image identification of various tickets, has strong universality and stability, can solve the problem that interception of an area to be identified is made mistakes due to the fact that printing equipment and operation are not standard, improves the accuracy of OCR identification, and improves the efficiency of algorithm execution.
Referring to fig. 2, a flowchart illustrating steps of a bill image recognition method according to an embodiment of the present invention is shown, where the method specifically includes the following steps:
step 201, calling a preset template, and matching the preset template with the bill image to obtain an initial to-be-identified area of the bill image; the initial region to be recognized includes a plurality of characters.
The embodiment of the invention can be applied to bill equipment, bills to be identified can be placed on the bill equipment, and the bill equipment can scan the bills so as to obtain the bill images of the bills. The bill image can be a white light image obtained by scanning under white light, and the bill device can set the white light image as a gray image, so that the subsequent template matching step can be performed on the gray image.
As an example, referring to fig. 3, a schematic diagram of a ticket image provided by an embodiment of the present invention is shown, where the ticket image may include elements such as printed characters, horizontal lines, ink, background texture, and the like, where the printed characters may be "house name", "account number", "amount", "XX bank", "XX stamp", and the like, and the printed characters may be "xiaohua", "111111111111111111", "one thousand yuan", "1000.00", and the like.
Therefore, the embodiment of the present invention may call a preset template, and by matching the preset template with the ticket image, an initial region to be recognized of the ticket image may be obtained, where the initial region to be recognized may include a plurality of characters, the characters may include printed characters and printed characters, and the initial region to be recognized may also include elements such as a horizontal line, ink, and background texture.
In an optional embodiment of the present invention, the ticket image includes printed characters, the preset template includes preset characters, and step 201 may include the following sub-steps:
a substep S11 of determining a target preset character matching the printed character;
a substep S12 of determining the position of the target preset character as the position of the printed character;
substep S13, offsetting the position of the printed character to obtain an initial position to be identified;
and a substep S14, generating an initial region to be identified of the bill image according to the initial position to be identified.
In the embodiment of the present invention, the bill image may include a plurality of printed characters, and the image research of a large number of bills may be performed for various types of bills, such as bills of checks, deposit slips, incoming bills, and the like, and also for the same type of bills published by different companies and different banks, such as deposit slips published by different banks, so as to set a plurality of preset templates. A plurality of preset templates can be adopted to match various bill images, so that an initial area to be identified of the bill images can be obtained.
As an example, a plurality of preset templates may be sequentially invoked in a preset order, and each preset template may include one or more preset characters. Referring to fig. 4, a schematic diagram of template matching provided by the embodiment of the present invention is shown, where M1 to M3 are preset characters, and M1 'to M3' are print characters, respectively. The embodiment of the invention can determine the target preset character matched with the printing character on the bill image, and then can determine the position of the target preset character as the position of the printing character. For example, the preset character M1 is matched with the typographical character M1 ', the preset character M2 is matched with the typographical character M2', and the preset character M3 is matched with the typographical character M3 ', so that the position of the preset character M1 can be determined as the position of the typographical character M1', the position of the preset character M2 can be determined as the position of the typographical character M2 ', and the position of the preset character M3 can be determined as the position of the typographical character M3'. It should be noted that, if there is no target preset character matching the print character, the preset template may be recalled until the target preset character matching the print character is determined.
In the embodiment of the present invention, the relative positions of the print characters and the print characters on the ticket image may be fixed, thereby setting the positional deviation information. The position offset information may include an offset distance and an offset direction. After the position of the printed character is obtained, the position of the printed character can be shifted according to the shift distance and the shift direction, so that an initial position to be recognized can be obtained, and then an initial region to be recognized of the bill image can be generated according to the initial position to be recognized.
As an example, as shown in fig. 4, after the positions of the printed characters M1 'to M3' are obtained, the positions M1 'to M3' of the printed characters may be shifted by X pixel points in the right direction according to the position shift information, so that the initial positions to be recognized may be obtained, and then the initial regions to be recognized of the document image may be generated with the initial positions to be recognized as the center points, see C1 to C3 regions in fig. 4. It should be noted that the initial region to be recognized is generally relatively large, and therefore, even if the printing device is unstable in printing or the bill placement is not standard, and the printed characters are shifted up and down and left and right, the initial region to be recognized in the embodiment of the present invention also covers the complete printed characters.
In an optional embodiment of the invention, the method may further comprise:
carrying out binarization on the bill images under different light sources and different color channels to obtain a plurality of first binary images; respectively counting the number of pixel points with target pixel values in each row of the initial region to be identified aiming at the plurality of first binary images; if the number of the pixel points is larger than a first number threshold, determining the row where the number of the pixel points is located as an effective row; determining the row number of continuous effective rows; if the number of lines is greater than a second number threshold, determining that the plurality of characters includes a print character; if the number of lines is not greater than a second number threshold, determining that the plurality of characters does not include a printed character.
In practice there may be blank tickets or invalid tickets lacking some content on the ticket, such as a blank deposit slip or a filling out of a missing username on the deposit slip. In order to avoid OCR recognition of these invalid tickets, it may be determined whether there are print characters in the initial area to be recognized after the initial area to be recognized is obtained.
In practical application, white light images are interfered by shading, so that elements are easy to be identified without the white light images, and the error probability is high. Therefore, the embodiment of the invention can detect the elements by combining the characteristics of different light sources and different color channels, thereby reducing the possibility of error detection of the elements.
In the implementation of the invention, the bill image can be set to the scanned image under different light sources and different color channels, wherein the light sources can include white light and infrared light, and the color channels can include red (R), green (G) and blue (B). The invention can acquire the white light image and the infrared image of the bill image and then select different color channels according to different bills.
Taking the deposit receipt as an example, a green channel of a white light image of the deposit receipt can be selected, an infrared image of the deposit receipt is cleaner, a color channel does not need to be selected, and then binarization can be performed on the white light image and the infrared image of the green channel respectively to obtain a plurality of first binary images. Referring to fig. 5A to 5B, first binary graphs provided by an embodiment of the invention are shown, where fig. 5A is the first binary graph of the white light graph of the green channel, and fig. 5B is the first binary graph of the infrared graph. Therefore, the first binary image in fig. 5A has more interference of shading, and the printed characters of the first binary image in fig. 5B are much more diluted, and the embodiment of the present invention respectively uses the first binary image of the white light image and the first binary image of the infrared image of the green channel to determine whether the plurality of characters in the initial region to be recognized include the printed characters.
In the implementation of the invention, the bill image can comprise pixel values of 0-255, the number of pixel points corresponding to each pixel value can be counted firstly, and then the first 30% of the pixel values are selected from the pixel points as the first pixel value threshold. In order to find the optimal threshold value, appropriate adjustment can be performed according to different bills, for example, a certain offset can be subtracted on the basis of the first pixel value threshold value, and the optimal second pixel value threshold value is obtained through adjustment, so that the bill image can be binarized by using the second pixel value threshold value.
Specifically, assuming that the size of the bill image is 100 × 100, the total number of the pixels is 10000, and 30% of the pixels obtained by calculation are 3000, and the number of the pixels is accumulated from the maximum pixel value of 255 until the first 30% of the pixel values are found. Assuming that the number of pixels of the pixel value 255 is 1000, the number of pixels of the pixel value 254 is 1000, the number of pixels of the pixel value 253 is 1000, and the number of accumulated pixels is 3000, the next pixel value 252 is the first 30% of the pixel value, the pixel value 252 is used as a first pixel value threshold, and then a certain offset is subtracted on the basis of the first pixel value threshold 252 to obtain an optimal second pixel value threshold. Assuming that the second pixel value threshold is 250, the bill image may be binarized by using the second pixel value threshold 250 to obtain a first binary image, for example, the pixel value greater than or equal to the second pixel value threshold 250 is set as white, and the pixel value smaller than the second pixel value threshold 250 is set as black, so that the obtained first binary image presents a black-and-white effect, wherein white pixel points form a text part, and black pixel points form a background part.
In the implementation of the present invention, in each row of the initial region to be identified, the number of pixels having the target pixel value may be counted. When the number of the pixel points is larger than the first number threshold, the row where the number of the pixel points is located can be determined as an effective row; when the number of the pixel points is not greater than the first number threshold, the row in which the number of the pixel points is located can be determined as an invalid row. Then, the number of rows of consecutive active rows may be counted, and when the number of rows of active rows is greater than a second number threshold, it may be determined that the plurality of characters includes a print character; when the number of lines of the active lines is not greater than the second number threshold, it may be determined that the plurality of characters does not include a print character.
Specifically, the first binary image has only two pixel values, i.e., white (255) and black (0), and the white pixel points form a text portion and the black pixel points form a background portion, so that the white pixel values can be used as target pixel values. Assuming that the first number threshold is set to 50, and there are 20 white pixels in the 1 st line, 30 white pixels in the 2 nd line, and 51 white pixels in the 3 rd line in the initial region to be recognized, the 3 rd line may be regarded as an active line, and the 1 st line and the 2 nd line may be regarded as an inactive line. Then, the number of lines of the continuous effective lines may be counted, and assuming that the second number threshold is 8 lines and all of the 3 rd to 13 th lines in the initial region to be recognized are effective lines, it may be determined that the plurality of characters in the initial region to be recognized include print characters.
Step 202, when the plurality of characters are determined to comprise the printed characters, generating a circumscribed rectangle aiming at the outlines of the plurality of characters, and determining a target circumscribed rectangle from the circumscribed rectangles of the plurality of characters.
In the implementation of the present invention, when it is determined that the plurality of characters in the initial region to be recognized include the print character, a circumscribed rectangle may be generated for the outlines of the plurality of characters using a binary image of an infrared image of the document image, and then a target circumscribed rectangle may be determined from the circumscribed rectangles of the plurality of characters. Referring to fig. 6, a schematic diagram of a circumscribed rectangle provided by an embodiment of the present invention is shown, where fig. 6 is a second binary diagram of an infrared diagram, in an initial recognition of the second binary diagram, based on a contour search method, a contour of each character may be obtained, then a circumscribed rectangle may be generated for the contours of a plurality of characters, see the circumscribed rectangles a to g in fig. 6, and then a target circumscribed rectangle may be determined from the circumscribed rectangles a to g, so as to perform a subsequent projection step using the target circumscribed rectangle.
In an optional embodiment of the invention, the method may further comprise:
acquiring a binarization threshold value with a plurality of pixel values decreasing progressively; adopting the binarization threshold values with the plurality of pixel values decreasing progressively to carry out binarization on the bill image respectively to obtain a plurality of second binary value images; and selecting one second binary image from the plurality of second binary images as a target binary image according to the sequence of the pixel values from large to small.
In the implementation of the invention, a plurality of binarization threshold values with decreasing pixel values can be preset, after the printed characters exist in the initial region to be identified, the binarization threshold values can be obtained, and then the binarization threshold values can be adopted to carry out binarization on the infrared images of the bill images respectively, so that a series of second-value images can be obtained. For example, 10 different binarization threshold values, such as 200, 198, 196, 194, 192, 190, 188, 186, 184, and 182, are preset, and then the 10 different binarization threshold values may be used to perform binarization on the infrared image of the bill image, respectively, so as to obtain a series of second binary images.
In an alternative embodiment of the present invention, the step 202 may comprise the following sub-steps:
and a substep S21 of executing the step of generating circumscribed rectangles for the outlines of the plurality of characters by using the target binary image.
In the implementation of the present invention, after obtaining the plurality of second binary images, one second binary image may be selected from the plurality of second binary images as a target binary image according to a descending order of pixel values, and then the step of generating the circumscribed rectangle for the outlines of the plurality of characters may be performed by using the target binary image. For example, the second binary image corresponding to the largest pixel value (e.g., 200) may be used as the target binary image, and when no qualified target bounding rectangle, target upper and lower boundaries, or target left and right boundaries can be found subsequently, the process may return to this step, the second binary image corresponding to the largest pixel value (e.g., 198) may be used as the target binary image, and then the target binary image is used to perform the outline-generating bounding rectangle step … … for a plurality of characters, and so on, until a qualified target bounding rectangle, target upper and lower boundaries, or target left and right boundaries is found.
In an alternative embodiment of the present invention, the step 202 may comprise the following sub-steps:
a substep S31 of determining a height of a circumscribed rectangle of the plurality of characters;
and a sub-step S32 of determining the circumscribed rectangle whose height is within the first preset range as the target circumscribed rectangle.
In the implementation of the present invention, a first preset range may be preset, after performing contour search on each character, a plurality of circumscribed rectangles may be obtained, see the circumscribed rectangles a to g in fig. 6, and then a target circumscribed rectangle may be determined from the circumscribed rectangles of the plurality of characters by using the first preset range. Specifically, the height of each circumscribed rectangle may be determined first, and when the height of the circumscribed rectangle is within a first preset range, the circumscribed rectangle may be determined as a target circumscribed rectangle, see the target circumscribed rectangles b to e in fig. 6; when the height of the circumscribed rectangle is not within the first preset range, the circumscribed rectangle is over-large or under-small, such as the circumscribed rectangles of the noise points a and g and the circumscribed rectangle of the transverse line f, and the circumscribed rectangles can be filtered.
And 203, performing horizontal projection and vertical projection on the target circumscribed rectangle to obtain the boundary of the printed character, and determining the area formed by the boundary as the target to-be-identified area of the bill image.
In the embodiment of the invention, horizontal projection can be used for searching the upper boundary and the lower boundary of the printed character, vertical projection can be used for searching the left boundary and the right boundary of the printed character, and the upper boundary, the lower boundary, the left boundary and the right boundary of the printed character can be obtained by performing horizontal projection and vertical projection on the target circumscribed rectangle, so that the area formed by the upper boundary, the lower boundary, the left boundary and the right boundary can be determined as the target area to be identified of the bill image.
In an alternative embodiment of the present invention, the step 203 may comprise the following sub-steps:
a substep S41, traversing each line of the target circumscribed rectangle based on horizontal projection, and determining a plurality of pairs of upper and lower boundaries;
a substep S42 of determining target upper and lower boundaries from the plurality of pairs of upper and lower boundaries;
substep S43, traversing each column between the upper and lower boundaries of the object based on the vertical projection, determining a plurality of pairs of left and right boundaries;
and a substep S44 of determining a target left-right boundary from the plurality of pairs of left-right boundaries.
In a specific implementation, in a target circumscribed rectangle, each line can be traversed from top to bottom through horizontal projection, when a certain line is traversed and white pixel points exist, the line can be recorded as a starting line of a printed character, the traversal is continued, when a certain line is traversed and no white pixel points exist, a previous line of the line can be recorded as an ending line of the printed character, then the starting line and the ending line can be determined as a pair of upper and lower boundaries, and then the target upper and lower boundaries can be determined from the plurality of pairs of upper and lower boundaries.
In a specific implementation, after the upper and lower boundaries of the target are found, the pixel values of the pixel points in the region outside the upper and lower boundaries of the target may be cleared first to eliminate interference. In the upper and lower boundaries of the target, each column can be traversed from left to right through vertical projection, when a certain column is traversed and white pixel points exist, the column can be recorded as a starting column of the printed characters, the traversal is continued, when the certain column is traversed and the white pixel points do not exist, the previous column of the column can be recorded as an ending column of the printed characters, then the starting column and the ending column can be determined as a pair of left and right boundaries, and then the left and right boundaries of the target can be determined from the plurality of pairs of left and right boundaries.
In an alternative embodiment of the present invention, the sub-step S42 may include the following sub-steps:
substep S421, determining the height of each pair of upper and lower boundaries;
substep S422, determining the upper and lower boundaries with the height within the second preset range as the upper and lower boundaries of the target;
in a specific implementation, a second preset range may be preset, multiple pairs of upper and lower boundaries may be obtained after performing horizontal projection on each target circumscribed rectangle, and then the upper and lower boundaries of the target may be determined from the multiple pairs of upper and lower boundaries by using the second preset range. Specifically, the height of each pair of upper and lower boundaries may be determined first, and when the height of the upper and lower boundaries is within a second preset range, the upper and lower boundaries may be determined as the target upper and lower boundaries; when the height of the upper and lower boundaries is not within the second preset range, it is indicated that the distance between the upper and lower boundaries is too large or too small, which do not correspond to the height of the printed characters, and the upper and lower boundaries may be filtered.
In an alternative embodiment of the present invention, the sub-step S44 may include the following sub-steps:
a substep S441 of determining the width of each pair of left and right boundaries;
in the substep S442, the left and right boundaries having the width within the third preset range are determined as the target left and right boundaries.
In a specific implementation, a third preset range may be preset, a plurality of pairs of left and right boundaries may be obtained after vertical projection is performed on each pair of upper and lower target boundaries, and then the target left and right boundaries may be determined from the plurality of pairs of left and right boundaries by using the third preset range. Specifically, the width of each pair of left and right boundaries may be determined first, and when the width of the left and right boundaries is within a third preset range, the left and right boundaries may be determined as the target left and right boundaries; when the width of the left and right boundaries is not within the third preset range, it is described that the distance between the left and right boundaries is too large or too small, and these do not conform to the width of the printed characters, then the next second binary image may be selected from the plurality of second binary images as the target binary image, and the step of generating the circumscribed rectangle for the outlines of the plurality of characters may be executed again.
In an optional embodiment of the invention, the method may further comprise:
and when the target circumscribed rectangle, the target upper and lower boundaries or the target left and right boundaries do not exist, selecting a next second binary image from the plurality of second binary images as a target binary image according to the sequence of pixel values from large to small.
In a specific implementation, when no target circumscribed rectangle meeting the condition is found, or when no target upper and lower boundaries meeting the condition are found, or when no target left and right boundaries meeting the condition are found, then a next second binary image can be selected from the plurality of second binary images as a target binary image according to the sequence of pixel values from large to small, and the step of generating circumscribed rectangles according to the outlines of the plurality of characters is executed again by using the target binary image until the target circumscribed rectangle meeting the condition, the target upper and lower boundaries and the target left and right boundaries are found, so that a fine target region to be identified can be obtained.
In an alternative embodiment of the present invention, the step 203 may comprise the following sub-steps:
and a substep S51, determining the region formed by the upper and lower boundaries of the target and the left and right boundaries of the target as the target to-be-identified region of the bill image.
In the embodiment of the invention, after the upper and lower boundaries and the left and right boundaries of the target are obtained, the region formed by the upper and lower boundaries and the left and right boundaries of the target can be determined as the target to-be-identified region of the bill image. Referring to fig. 7A to 7C, effect display diagrams provided by the embodiment of the invention are shown, where fig. 7A corresponds to fig. 1A, fig. 7B corresponds to fig. 1B, fig. 7C corresponds to fig. 4, and fig. 1A to 1B show a cut region to be identified in the prior art. Therefore, compared with the areas to be recognized A1-A3 and B1-B3 intercepted in the prior art, the areas to be recognized A1 'to A3' and B1 'to B3' intercepted in the embodiment of the present invention are finer, and in addition, compared with the initial areas to be recognized C1-C3 intercepted initially in the embodiment of the present invention, the areas to be recognized C1 'to C3' intercepted finally in the embodiment of the present invention are also finer.
And 204, identifying the printed characters of the target area to be identified.
In the embodiment of the invention, the bill equipment can comprise an OCR module, after the target to-be-recognized area is obtained, because the target to-be-recognized area not only contains complete printed characters, but also eliminates the interference of irrelevant factors such as transverse lines, printing ink, background textures and the like, the OCR module can be adopted to recognize the printed characters in the target to-be-recognized area, so that the problem of error interception of the to-be-recognized area caused by the nonstandard printing equipment and operation can be solved, the accuracy of OCR recognition is improved, and the algorithm execution efficiency is improved.
In the embodiment of the invention, a preset template is called first, the preset template is matched with a bill image to obtain an initial to-be-recognized area of the bill image, wherein the initial to-be-recognized area comprises a plurality of characters, when the plurality of characters are determined to comprise printed characters, external rectangles are generated according to the outlines of the plurality of characters, then a target external rectangle is determined from the external rectangles of the plurality of characters, horizontal projection and vertical projection are carried out according to the target external rectangle to obtain the boundary of the printed characters, then the area formed by the boundary is determined as the target to-be-recognized area of the bill image, and finally the printed characters of the target to-be-recognized area are recognized. The method and the device are suitable for image recognition of various bills, have strong universality and stability, can solve the problem of interception errors of the area to be recognized caused by non-standard printing equipment and operation, improve the accuracy of OCR recognition and improve the efficiency of algorithm execution.
In order to enable those skilled in the art to better understand the embodiment of the present invention, referring to fig. 8, a flowchart of a bill image recognition process provided by the embodiment of the present invention is shown, and the bill image recognition process is specifically described with reference to the following examples:
step 801, acquiring a bill image; the ticket image includes a plurality of printed characters;
step 802, sequentially calling a plurality of preset templates according to a preset sequence; each preset template comprises one or more preset characters;
step 803, matching a preset template with the bill image;
step 804, judging whether a target preset character matched with the printed character exists or not;
step 805, if yes, determining the position of the target preset character as the position of a printed character, shifting the position of the printed character to obtain a position to be identified for printing the initial, and then generating a region to be identified for printing the initial according to the position to be identified for printing the initial; if not, return to step 802;
806, setting the bill images into an infrared image and white light images of different color channels, and carrying out binarization on the infrared image and the white light images of the different color channels to obtain a plurality of first binary images;
step 807, adopting a plurality of first binary images to judge whether the initial area to be identified has printing characters;
step 808, if yes, acquiring a plurality of binarization threshold values with the pixel values decreasing progressively, setting the bill image as an infrared image, and binarizing the infrared image by adopting the binarization threshold values with the pixel values decreasing progressively to obtain a plurality of second binary images; if not, return to step 806;
step 809, selecting a target binary image from the plurality of second binary images according to the sequence of the pixel values from large to small;
step 810, carrying out contour searching by adopting a target binary image, and generating circumscribed rectangles of a plurality of characters aiming at the contours of the plurality of characters in the initial region to be recognized;
step 811, judging whether a target circumscribed rectangle meeting a first preset range exists in circumscribed rectangles of the characters;
step 812, if the target external rectangle exists, performing horizontal projection on the target external rectangle to generate a plurality of pairs of upper and lower boundaries; if not, return to step 809;
step 813, determining whether there is a target upper and lower boundary satisfying a second preset range from the plurality of pairs of upper and lower boundaries;
step 814, if yes, performing vertical projection on the upper and lower boundaries of the target to generate a plurality of pairs of left and right boundaries; if not, return to step 809;
step 815, judging whether a target left and right boundary meeting a third preset range exists in the multiple pairs of left and right boundaries;
step 816, if the target identification area exists, determining an area formed by the upper boundary, the lower boundary and the left boundary and the right boundary of the target as the target area to be identified; if not, return to step 809;
and 817, identifying the printed characters of the target area to be identified.
Referring to fig. 9, a block diagram of a structure of a bill image recognition apparatus provided in an embodiment of the present invention is shown, which may specifically include the following modules:
an initial region to be recognized obtaining module 901, configured to call a preset template, match the preset template with the ticket image, and obtain an initial region to be recognized of the ticket image; the initial region to be recognized comprises a plurality of characters;
a target circumscribed rectangle determining module 902, configured to, when it is determined that the plurality of characters include a print character, generate a circumscribed rectangle for the outlines of the plurality of characters, and determine a target circumscribed rectangle from the circumscribed rectangles of the plurality of characters;
a target to-be-recognized area determining module 903, configured to perform horizontal projection and vertical projection on the target circumscribed rectangle to obtain a boundary of the printed character, and determine an area formed by the boundary as a target to-be-recognized area of the ticket image;
and the identifying module 904 is configured to identify the printed characters in the target area to be identified.
In an optional embodiment of the present invention, the ticket image includes printed characters, the preset template includes preset characters, and the initial region to be recognized obtaining module 901 may include:
the matching sub-module is used for determining a target preset character matched with the printing character;
the position determining submodule is used for determining the position of the target preset character as the position of the printed character;
the offset submodule is used for offsetting the position of the printed character to obtain an initial position to be identified;
and the initial region to be identified generation submodule is used for generating an initial region to be identified of the bill image according to the initial position to be identified.
In an optional embodiment of the present invention, the apparatus may further comprise:
the first binary image obtaining module is used for carrying out binarization on the bill images under different light sources and different color channels to obtain a plurality of first binary images;
the pixel point number counting module is used for counting the number of pixel points with target pixel values in each row of the initial region to be identified respectively according to the plurality of first binary images;
the effective line determining module is used for determining the line where the pixel number is located as an effective line if the pixel number is greater than a first number threshold;
the line number determining module is used for determining the line number of continuous effective lines;
a first print character determination module configured to determine that the plurality of characters includes a print character if the number of lines is greater than a second number threshold;
a second print character determination module to determine that the plurality of characters do not include a print character if the number of lines is not greater than a second number threshold.
In an optional embodiment of the present invention, the apparatus may further comprise:
a binarization threshold value obtaining module, configured to obtain a binarization threshold value at which a plurality of pixel values decrease progressively;
a second binary image obtaining module, configured to perform binarization on the bill image respectively by using the binarization threshold values where the pixel values decrease progressively, so as to obtain a plurality of second binary images;
the first target binary image selecting module is used for selecting one second binary image from the plurality of second binary images as a target binary image according to the sequence of pixel values from large to small;
the target bounding rectangle determining module 902 may include:
and the circumscribed rectangle generation submodule is used for executing the step of generating the circumscribed rectangle aiming at the outlines of the characters by adopting the target binary image.
In an optional embodiment of the present invention, the target bounding rectangle determining module 902 may include:
a height determination submodule of the circumscribed rectangle for determining the height of the circumscribed rectangle of the plurality of characters;
and the target circumscribed rectangle determining submodule is used for determining the circumscribed rectangle with the height within a first preset range as the target circumscribed rectangle.
In an optional embodiment of the present invention, the target to-be-recognized region determining module 903 may include:
the first traversal submodule is used for traversing each line of the target circumscribed rectangle based on horizontal projection and determining a plurality of pairs of upper and lower boundaries;
a target upper and lower boundary determining submodule for determining a target upper and lower boundary from the plurality of pairs of upper and lower boundaries;
the second traversal submodule is used for traversing each column between the upper boundary and the lower boundary of the target based on vertical projection and determining a plurality of pairs of left and right boundaries;
a target left-right boundary determining submodule for determining a target left-right boundary from the plurality of pairs of left-right boundaries;
the target to-be-recognized region determining module 903 may include:
and the target area to be recognized determining submodule is used for determining an area formed by the upper and lower boundaries of the target and the left and right boundaries of the target as the target area to be recognized of the bill image.
In an optional embodiment of the present invention, the target left-right boundary determining sub-module may include:
a height determining unit for upper and lower boundaries for determining the height of each pair of upper and lower boundaries;
the target upper and lower boundary determining unit is used for determining an upper and lower boundary with the height within a second preset range as a target upper and lower boundary;
the target left-right boundary determination submodule may include:
a left and right boundary width determination unit for a first height determination submodule for determining the width of each pair of left and right boundaries;
and the target left and right boundary determining unit is used for determining left and right boundaries with the width within a third preset range as the target left and right boundaries.
In an optional embodiment of the present invention, the apparatus may further comprise:
and the second target binary image selecting module is used for selecting the next second binary image from the plurality of second binary images as the target binary image according to the sequence of pixel values from large to small when the target circumscribed rectangle, the target upper and lower boundaries, or the target left and right boundaries do not exist.
In the embodiment of the invention, a preset template is called first, the preset template is matched with a bill image, an initial to-be-recognized area of the bill image is obtained, wherein the initial to-be-recognized area comprises a plurality of characters, when the plurality of characters are determined to comprise printed characters, circumscribed rectangles are generated according to the outlines of the plurality of characters, then a target circumscribed rectangle is determined from the circumscribed rectangles of the plurality of characters, horizontal projection and vertical projection are carried out according to the target circumscribed rectangle, the boundary of the printed characters is obtained, an area formed by the boundary is determined as the target to-be-recognized area of the bill image, and finally the printed characters of the target to-be-recognized area are recognized. The method and the device are suitable for image recognition of various bills, have strong universality and stability, can solve the problem of interception errors of the area to be recognized caused by non-standard printing equipment and operation, improve the accuracy of OCR recognition and improve the efficiency of algorithm execution.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
Preferably, an embodiment of the present invention further provides an electronic device, including: the processor, the memory, and the computer program stored in the memory and capable of running on the processor, when being executed by the processor, implement each process of the above bill image identification method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
The embodiment of the invention also provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when being executed by a processor, the computer program realizes each process of the bill image identification method embodiment, and can achieve the same technical effect, and in order to avoid repetition, the details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the technical solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one type of logical functional division, and other divisions may be realized in practice, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention or a part thereof which substantially contributes to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a U disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily think of the changes or substitutions within the technical scope of the present invention, and shall cover the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (11)

1. A bill image recognition method is characterized by comprising the following steps:
calling a preset template, and matching the preset template with the bill image to obtain an initial to-be-identified area of the bill image; the initial region to be recognized comprises a plurality of characters;
when it is determined that the plurality of characters include a print character, generating a circumscribed rectangle for the outlines of the plurality of characters, and determining a target circumscribed rectangle from the circumscribed rectangles of the plurality of characters;
performing horizontal projection and vertical projection on the target circumscribed rectangle to obtain the boundary of the printed characters, and determining the region formed by the boundary as a target to-be-identified region of the bill image;
and identifying the printed characters of the target area to be identified.
2. The method of claim 1, wherein the ticket image comprises printed characters, the preset template comprises preset characters, and the matching the preset template with the ticket image to obtain an initial region to be identified of the ticket image comprises:
determining a target preset character matched with the printed character;
determining the position of the target preset character as the position of the printed character;
shifting the position of the printed character to obtain an initial position to be identified;
and generating an initial region to be identified of the bill image according to the initial position to be identified.
3. The method of claim 1, further comprising:
carrying out binarization on the bill images under different light sources and different color channels to obtain a plurality of first binary images;
respectively counting the number of pixel points with target pixel values in each row of the initial region to be identified aiming at the plurality of first binary images;
if the number of the pixel points is larger than a first number threshold, determining the row where the number of the pixel points is located as an effective row;
determining the row number of continuous effective rows;
if the number of lines is greater than a second number threshold, determining that the plurality of characters includes a print character;
if the number of lines is not greater than a second number threshold, determining that the plurality of characters does not include a printed character.
4. The method of claim 1, further comprising:
acquiring a binarization threshold value with a plurality of pixel values decreasing progressively;
adopting the binarization threshold values with the plurality of pixel values decreasing progressively to carry out binarization on the bill image respectively to obtain a plurality of second binary value images;
selecting a second binary image from the plurality of second binary images as a target binary image according to the sequence of the pixel values from large to small;
generating a circumscribed rectangle for the outlines of the plurality of characters, comprising:
and executing the step of generating a circumscribed rectangle for the outlines of the characters by adopting the target binary image.
5. The method of claim 1, wherein determining a target bounding rectangle from the bounding rectangles of the plurality of characters comprises:
determining a height of a circumscribed rectangle of the plurality of characters;
and determining the circumscribed rectangle with the height within the first preset range as a target circumscribed rectangle.
6. The method according to claim 4, wherein the horizontally projecting and vertically projecting the target bounding rectangle to obtain the boundary of the printed character comprises:
traversing each line of the target circumscribed rectangle based on horizontal projection, and determining a plurality of pairs of upper and lower boundaries;
determining target upper and lower boundaries from the plurality of pairs of upper and lower boundaries;
traversing each column between the upper and lower boundaries of the target based on the vertical projection, and determining a plurality of pairs of left and right boundaries;
determining a target left-right boundary from the plurality of pairs of left-right boundaries;
the determining the area formed by the boundary as the target area to be identified of the bill image comprises the following steps:
and determining the area formed by the upper and lower boundaries of the target and the left and right boundaries of the target as the target area to be identified of the bill image.
7. The method of claim 6, wherein said determining a target upper and lower boundary from said plurality of pairs of upper and lower boundaries comprises:
determining the height of each pair of upper and lower boundaries;
determining an upper boundary and a lower boundary with the height within a second preset range as an upper boundary and a lower boundary of the target;
the determining a target left-right boundary from the plurality of pairs of left-right boundaries comprises:
determining the width of each pair of left and right boundaries;
and determining left and right boundaries with the width within a third preset range as target left and right boundaries.
8. The method of claim 7, further comprising:
and when the target circumscribed rectangle, the target upper and lower boundaries or the target left and right boundaries do not exist, selecting a next second binary image from the plurality of second binary images as a target binary image according to the sequence of pixel values from large to small.
9. A document image recognition apparatus, comprising:
the initial region to be identified obtaining module is used for calling a preset template, matching the preset template with the bill image and obtaining an initial region to be identified of the bill image; the initial region to be recognized comprises a plurality of characters;
a target circumscribed rectangle determination module, configured to, when it is determined that the plurality of characters include a print character, generate a circumscribed rectangle for the outlines of the plurality of characters, and determine a target circumscribed rectangle from the circumscribed rectangles of the plurality of characters;
the target to-be-recognized area determining module is used for performing horizontal projection and vertical projection on the target circumscribed rectangle to obtain the boundary of the printed characters, and determining an area formed by the boundary as a target to-be-recognized area of the bill image;
and the identification module is used for identifying the printed characters of the target area to be identified.
10. An electronic device, comprising: processor, memory and a computer program stored on the memory and executable on the processor, which computer program, when executed by the processor, carries out the steps of the document image recognition method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that a computer program is stored thereon, which computer program, when being executed by a processor, carries out the steps of a document image recognition method according to one of claims 1 to 8.
CN202210320570.3A 2022-03-29 2022-03-29 Bill image recognition method and device Pending CN114743207A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210320570.3A CN114743207A (en) 2022-03-29 2022-03-29 Bill image recognition method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210320570.3A CN114743207A (en) 2022-03-29 2022-03-29 Bill image recognition method and device

Publications (1)

Publication Number Publication Date
CN114743207A true CN114743207A (en) 2022-07-12

Family

ID=82277876

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210320570.3A Pending CN114743207A (en) 2022-03-29 2022-03-29 Bill image recognition method and device

Country Status (1)

Country Link
CN (1) CN114743207A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115050015A (en) * 2022-08-15 2022-09-13 恒银金融科技股份有限公司 Method for accurately dividing character area of financial bill account

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115050015A (en) * 2022-08-15 2022-09-13 恒银金融科技股份有限公司 Method for accurately dividing character area of financial bill account
CN115050015B (en) * 2022-08-15 2023-09-12 恒银金融科技股份有限公司 Accurate segmentation method for character area of financial bill account

Similar Documents

Publication Publication Date Title
CN107016363B (en) Bill image management device, bill image management system, and bill image management method
EP2545499B1 (en) Text enhancement of a textual image undergoing optical character recognition
CN104200210B (en) A kind of registration number character dividing method based on component
CA2650180C (en) Image binarization using dynamic sub-image division
EP2682901A1 (en) Text string cut-out method and text string cut-out device
US20040170324A1 (en) Boundary detection method between areas having different features in image data
CN110378351B (en) Seal identification method and device
JP2018120445A (en) Car number recognition apparatus
CN112906695A (en) Form recognition method adapting to multi-class OCR recognition interface and related equipment
CN114743207A (en) Bill image recognition method and device
CN113888756A (en) Method for determining effective area parameters, image acquisition method and test system
CN110210467B (en) Formula positioning method of text image, image processing device and storage medium
US9332154B2 (en) Image binarization using dynamic sub-image division
US7480410B2 (en) Image recognition method and apparatus for the same method
US8472078B2 (en) Image processing apparatus for determining whether a region based on a combined internal region is a table region
CN111814780B (en) Bill image processing method, device, equipment and storage medium
CN111445402B (en) Image denoising method and device
JP2017174031A (en) Image processing apparatus and image processing program
CN115410191A (en) Text image recognition method, device, equipment and storage medium
CN113283416A (en) Character outline recognition method and device, electronic equipment and machine readable medium
CN112183574A (en) File authentication and comparison method and device, terminal and storage medium
CN108230538B (en) Paper money identification method, device, equipment and storage medium
CN111882572A (en) One-dimensional code detection method and device, storage medium and electronic equipment
JP2988401B2 (en) Stamp recognition device
CN112163581B (en) License plate letter recognition method, system, device 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