CN110895849A - Method and device for cutting and positioning crown word number, computer equipment and storage medium - Google Patents

Method and device for cutting and positioning crown word number, computer equipment and storage medium Download PDF

Info

Publication number
CN110895849A
CN110895849A CN201811072862.XA CN201811072862A CN110895849A CN 110895849 A CN110895849 A CN 110895849A CN 201811072862 A CN201811072862 A CN 201811072862A CN 110895849 A CN110895849 A CN 110895849A
Authority
CN
China
Prior art keywords
character
target
binarization
image
crown word
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
CN201811072862.XA
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
Shenzhen Yihua Time Technology Co Ltd
Shenzhen Yihua Financial Intelligent Research Institute
Original Assignee
Shenzhen Yihua Computer Co Ltd
Shenzhen Yihua Time Technology Co Ltd
Shenzhen Yihua Financial Intelligent Research Institute
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, Shenzhen Yihua Time Technology Co Ltd, Shenzhen Yihua Financial Intelligent Research Institute filed Critical Shenzhen Yihua Computer Co Ltd
Priority to CN201811072862.XA priority Critical patent/CN110895849A/en
Publication of CN110895849A publication Critical patent/CN110895849A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07DHANDLING OF COINS OR VALUABLE PAPERS, e.g. TESTING, SORTING BY DENOMINATIONS, COUNTING, DISPENSING, CHANGING OR DEPOSITING
    • G07D7/00Testing specially adapted to determine the identity or genuineness of valuable papers or for segregating those which are unacceptable, e.g. banknotes that are alien to a currency
    • G07D7/004Testing specially adapted to determine the identity or genuineness of valuable papers or for segregating those which are unacceptable, e.g. banknotes that are alien to a currency using digital security elements, e.g. information coded on a magnetic thread or strip
    • G07D7/0047Testing specially adapted to determine the identity or genuineness of valuable papers or for segregating those which are unacceptable, e.g. banknotes that are alien to a currency using digital security elements, e.g. information coded on a magnetic thread or strip using checkcodes, e.g. coded numbers derived from serial number and denomination
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/148Segmentation of character regions
    • G06V30/153Segmentation of character regions using recognition of characters or words
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Character Input (AREA)
  • Character Discrimination (AREA)

Abstract

The application relates to a crown word number cutting and positioning method, which comprises the following steps: acquiring a target image containing crown word number information, wherein the crown word number information comprises a plurality of characters; performing first binarization processing on the target image to obtain a binarized image; acquiring a positioning template matched with the crown word number information; determining a target character area of each character in the crown word number information in the target image according to the positioning template and the binary image; and carrying out second binarization processing on the target character area to obtain a cutting area of the corresponding character. The crown word number cutting positioning method can still obtain cutting positioning with high accuracy even under the condition that fouling exists. In addition, a crown word number cutting and positioning device, computer equipment and a storage medium are also provided.

Description

Method and device for cutting and positioning crown word number, computer equipment and storage medium
Technical Field
The invention relates to the technical field of computers, in particular to a crown word number cutting and positioning method and device, computer equipment and a storage medium.
Background
The serial number is a symbol for counting the number of paper money and marking the uniqueness of the paper money, and the identification of the serial number has important significance for the market circulation of the paper money. In the identification process of the crown word number, the cutting of the crown word number is very important, the cutting positioning is needed before the cutting, and the cutting positioning accuracy directly influences the cutting accuracy.
Because the area of the crown word number in circulation of the paper money can be polluted, the traditional crown word number positioning technology has low positioning accuracy on the polluted crown word number, and the subsequent cutting accuracy is low.
Disclosure of Invention
Therefore, it is necessary to provide a crown word number cutting and positioning method, device, computer device and storage medium for solving the problem of low positioning accuracy and improving the accuracy of cutting and positioning.
In a first aspect, an embodiment of the present invention provides a crown word number cutting and positioning method, where the method includes:
acquiring a target image containing crown word number information, wherein the crown word number information comprises a plurality of characters;
performing first binarization processing on the target image to obtain a binarized image;
acquiring a positioning template matched with the crown word number information;
determining a target character area of each character in the crown word number information in the target image according to the positioning template and the binary image;
and carrying out second binarization processing on the target character area to obtain a cutting area of the corresponding character.
In one embodiment, the determining, in the target image, a target character region of each character in the crown word number information according to the positioning template and the binarized image includes: positioning a binarization character area of each character in the crown word number information in the binarization image according to the positioning template; and determining a corresponding target character area in the target image according to the binarization character area.
In one embodiment, the locating a binarized character region of each character in the crown word number information in the binarized image according to the locating template includes: moving the positioning template in the binarized image to obtain the current position of the positioning template in the binarized image; calculating the number of first target pixel points contained in the positioning template and the number of second target pixel points contained in the frame of the positioning template at the current position; calculating to obtain a score corresponding to the current position of the positioning template according to the number of the first target pixel points and the number of the second target pixel points; and taking the position with the maximum score as the target position of the positioning template, and positioning a binarization character area of each character in the prefix number information according to the target position.
In one embodiment, the positioning template comprises: a character frame corresponding to each character, the character frame being determined according to the character size and an interval between characters; the positioning of the binarization character area of each character in the crown word number information in the binarization image according to the positioning template comprises the following steps: and determining a binarization character area corresponding to each character in the crown word number information in a binarization image according to a character frame contained in the positioning template.
In one embodiment, the performing a second binarization process on the target character region to obtain a cut region of a corresponding character includes: determining a binarization gray level threshold value corresponding to each target character area according to a preset binarization percentage; performing second binarization processing on the corresponding target character area according to the binarization gray threshold value to obtain a target binarization character area; and performing indentation according to target pixel points forming the characters in the target binarization character area to obtain a cutting area corresponding to each character.
In one embodiment, the indenting according to the target pixel points forming the characters in the target binarization character region to obtain a cutting region corresponding to each character includes: performing horizontal projection and vertical projection according to target pixel points forming the character to obtain a horizontal indentation range and a vertical indentation range; and indenting the target binarization character area according to the horizontal indentation range and the vertical indentation range to obtain a cutting area corresponding to each character.
In one embodiment, the acquiring the target image containing the information of the crown word number includes: intercepting a target area image containing crown word number information from the target image; the first binarization processing is performed on the target image to obtain a binarized image, and the method comprises the following steps: and carrying out first binarization processing on the target area image to obtain a binarization image corresponding to the target area image.
In a second aspect, an embodiment of the present invention provides a crown word number cutting and positioning device, where the device includes:
the image acquisition module is used for acquiring a target image containing crown word number information, and the crown word number information comprises a plurality of characters;
the image binarization module is used for carrying out first binarization processing on the target image to obtain a binarization image;
the template acquisition module is used for acquiring a positioning template matched with the crown word number information;
the determining module is used for determining a target character area of each character in the crown word number information in the target image according to the positioning template and the binary image;
and the character area binarization module is used for carrying out second binarization processing on the target character area to obtain a cutting area of the corresponding character.
In one embodiment, the determining module is further configured to locate a binarized character region of each character in the crown word number information in the binarized image according to the locating template; and determining a corresponding target character area in the target image according to the binarization character area.
In one embodiment, the determining module comprises: a current position obtaining module, configured to move the positioning template in the binarized image, and obtain a current position of the positioning template in the binarized image; the point number calculating module is used for calculating the number of first target pixel points contained in the positioning template and the number of second target pixel points contained in the frame of the positioning template at the current position; the score calculating module is used for calculating a score corresponding to the current position of the positioning template according to the number of the first target pixel points and the number of the second target pixel points; and the character area positioning module is used for positioning a binarization character area of each character in the crown word number information according to the target position by taking the position with the maximum score as the target position of the positioning template.
In one embodiment, positioning the template comprises: a character frame corresponding to each character, the character frame being determined according to the character size and an interval between characters; the determining module is further used for determining a binarization character area corresponding to each character in the crown word number information in the binarization image according to the character frame contained in the positioning template.
In one embodiment, the character region binarization module is further configured to determine a binarization grayscale threshold corresponding to each target character region according to a preset binarization percentage; performing second binarization processing on the corresponding target character area according to the binarization gray threshold value to obtain a target binarization character area; and performing indentation according to target pixel points forming the characters in the target binarization character area to obtain a cutting area corresponding to each character.
In one embodiment, the character region binarization module is further configured to perform horizontal projection and vertical projection according to target pixel points forming the character to obtain a horizontal indentation range and a vertical indentation range; and indenting the target binarization character area according to the horizontal indentation range and the vertical indentation range to obtain a cutting area corresponding to each character.
In one embodiment, the image obtaining module is further configured to intercept a target area image containing crown word number information from the target image; the image binarization module is further used for carrying out first binarization processing on the target area image to obtain a binarization image corresponding to the target area image.
The present invention also provides a computer-readable storage medium storing a computer program which, when executed by a processor, causes the processor to perform the steps of:
acquiring a target image containing crown word number information, wherein the crown word number information comprises a plurality of characters;
performing first binarization processing on the target image to obtain a binarized image;
acquiring a positioning template matched with the crown word number information;
determining a target character area of each character in the crown word number information in the target image according to the positioning template and the binary image;
and carrying out second binarization processing on the target character area to obtain a cutting area of the corresponding character.
The invention also provides a computer device comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of:
acquiring a target image containing crown word number information, wherein the crown word number information comprises a plurality of characters;
performing first binarization processing on the target image to obtain a binarized image;
acquiring a positioning template matched with the crown word number information;
determining a target character area of each character in the crown word number information in the target image according to the positioning template and the binary image;
and carrying out second binarization processing on the target character area to obtain a cutting area of the corresponding character.
According to the crown word number cutting and positioning method, device, computer equipment and storage medium, a first binarization processing is carried out on a target image containing crown word number information to obtain a binarization image, then a positioning template is obtained, a target character area of each character in the crown word number information is positioned in the target image according to the positioning template and the binarization image, and then a second binarization processing is carried out on each target character area to obtain a cutting area corresponding to each character. The target character area is located in the target image through the locating template and the binarization image, then the second binarization processing is carried out on each target character area, and the characters can be better distinguished from the background area by carrying out binarization on the target character area, so that a more accurate cutting area can be obtained, and high-accuracy cutting location can be obtained even under the condition of fouling.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the structures shown in the drawings without creative efforts.
FIG. 1 is a flow chart of a method for crown word size cutting positioning in one embodiment;
FIG. 2A is a diagram illustrating a target image before binarization in one embodiment;
FIG. 2B is a diagram illustrating a binarized image after binarization in an embodiment;
FIG. 3 is a schematic illustration of a locating template in one embodiment;
FIG. 4 is a flow diagram of a method for locating coordinates of a character region in one embodiment;
FIG. 5 is a diagram illustrating an embodiment of a locating template including a plurality of borders;
FIG. 6A is a diagram illustrating a character region before indentation in one embodiment;
FIG. 6B is a diagram illustrating an indented character region in one embodiment;
fig. 7 is a diagram illustrating recognition effects in one embodiment.
FIG. 8 is a block diagram of a crown cutting positioning device according to an embodiment;
FIG. 9 is a block diagram of the structure of a determination module in one embodiment;
FIG. 10 is a diagram showing an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
As shown in fig. 1, a crown word number cutting and positioning method is proposed, which may be applied to both a terminal and a server, and this embodiment is exemplified by being applied to a terminal. The crown word number cutting and positioning method specifically comprises the following steps:
step 102, a target image containing crown word number information is obtained, wherein the crown word number information comprises a plurality of characters.
The information of the crown word number refers to a specific crown word number, and the crown word number has unique identification. Generally, a crown word number includes a plurality of characters, which may be letters, numbers, or symbols. The target image is an image containing information on the prefix number. In one embodiment, the region where the crown-size information is located may be cut out from the banknote image containing the crown-size, and then the cut-out region may be used as the target image. The target image may be a color image or a grayscale image.
In one embodiment, after the target image is acquired, the method further includes preprocessing the target image, where the preprocessing includes: and (5) carrying out gray scale processing. The target image is converted into a grayscale image.
And 104, performing first binarization processing on the target image to obtain a binarized image.
The binarization processing refers to a process of dividing pixel points on an image into two types, wherein the two types are respectively represented by different gray values. For example, the gray value of one type of pixel point may be set to 0, and the other type may be set to 255, so that the whole image has a distinct visual effect of only black and white. The purpose of binarization is to distinguish the target subject to be identified (e.g. the crown word size) from the background. In order to distinguish from the subsequent binarization, it is referred to as "first binarization processing" herein. Fig. 2 is a schematic diagram illustrating the effect before and after binarization in an embodiment, where fig. 2A is a target image before binarization, and fig. 2B is a binarized image after binarization. Since noise may be present in the image, the target subject may not be well distinguished from the background after binarization.
In one embodiment, the binarization process may be implemented as follows: setting a critical gray value, setting the gray value of the pixel point with the gray value greater than the critical gray value as the maximum gray value (for example, 255), and setting the gray value of the pixel point with the gray value not greater than the critical gray value as the minimum gray value (for example, 0), thereby realizing binarization.
And step 106, acquiring a positioning template matched with the crown word number information.
The positioning template is used for positioning the position of the crown word number information. In one embodiment, the location template is determined based on the number of characters in the crown word number information, the character interval, and the character size. The character size includes a character width and a character height. For example, if the number of characters is 6, the height of the character is 20 pixels, and the interval between the characters is 25 pixels, the location template may be set to have a height of 22 pixels and a length of 25 × 6, which is 150 pixels. In another embodiment, the location template is composed of a plurality of character boxes, each character corresponds to a character box, the size of the character box is determined according to the character size and the character interval, for example, the character height is 20 pixels, the character interval is 25 pixels, the height of the character box is set to 22 pixels, and the width of the character box is set to 25 pixels. If there are 6 characters, the location template contains 6 character boxes accordingly. As shown in fig. 3, which is a schematic diagram of the location template in one embodiment, the width of the character frame is 25 pixels, and the height of the character frame is 22 pixels. By arranging the positioning template according to the intervals among the characters, even under the condition that the full-coverage characteristic region is stained, as long as the character intervals of the crown word numbers exist, the region where the crown word numbers are located can be well identified, and the target position of the positioning template can be well positioned.
In one embodiment, a plurality of positioning templates are preset, and different positioning templates are used for different types of crown word numbers. And presetting a positioning template corresponding to the current crown word number type, and directly acquiring the corresponding positioning template after acquiring the binary image containing the crown word number information.
And 108, determining a target character area of each character in the crown word number information in the target image according to the positioning template and the binary image.
The target character area refers to a character area corresponding to each character in the prefix number information in the target image. One character corresponds to one target character region. For example, if there are 6-bit characters in the prefix number information, there are 6 target character areas accordingly. In one embodiment, the binarized character region of each character in the crown word number information is first located in the binarized image according to the locating template, and then the target character region of each character in the crown word number information is determined in the target image according to the corresponding relationship between the binarized image and the target image. The binarized character area has a one-to-one correspondence with the target character area. Locating the binarized character region is actually locating the position of the binarized character region.
In one embodiment, a target area matched with the positioning template can be searched in the binarized image through the positioning template, the target area contains each character, and the binarized character area of each character in the binarized image can be determined according to the characteristics between the characters, for example, according to the interval between the characters.
And 110, performing second binarization processing on the target character area to obtain a cutting area of the corresponding character.
The binarization processing is performed for each target character area corresponding to each character, and is referred to as "second binarization processing" herein for distinguishing from the first binarization processing described above. The first binarization processing is different from the second binarization processing, the binarization areas of the first binarization processing and the second binarization processing are different, the second binarization processing aims at a target character area corresponding to the character, and a proper gray critical value can be better selected for the target character area aiming at the target character area, so that the character can be better distinguished from a background area, the cutting area can be better determined, and the accuracy of subsequent recognition is improved.
In one embodiment, the gray value of each pixel point in the target character region is obtained, a preset binarization percentage is obtained, the binarization percentage is used for determining a binarization critical gray value, and the critical gray value is determined according to the gray value of each pixel point in the target character region and the preset binarization percentage. In one embodiment, the binarization percentage is determined based on the percentage of the character in the entire target character area. And sequencing the gray values of the pixel points of the target character region from small to large, taking the pixel gray value corresponding to the preset binarization percentage as a critical gray value, and then carrying out binarization according to the critical gray value. For example, assuming that the binarization percentage is 20%, the gray value of the darkest 20% of the pixels is used as the critical gray value. The characters can be better distinguished from the background by binarizing the target character region.
According to the crown word number cutting and positioning method, a binarization image is obtained by performing binarization processing on a target image containing crown word number information, then a positioning template is obtained, a target character area of each character in the crown word number information is positioned in the target image according to the positioning template and the binarization image, and then binarization processing is performed on each target character area respectively to obtain a cutting area corresponding to each character. The target character area is located in the target image through the locating template and the binarization image, then binarization processing is carried out on each target character area, and the characters can be better distinguished from the background area by carrying out binarization according to the target character area, so that a more accurate cutting area can be obtained, and high-accuracy cutting location can be obtained even under the condition of fouling.
In one embodiment, the determining a target character region of each character in the crown word number information in the target image according to the positioning template and the binarized image includes: positioning a binarization character area of each character in the crown word number information in the binarization image according to the positioning template; and determining a corresponding target character area in the target image according to the binarization character area.
The positioning template is used for positioning the position of the crown word number information in the binary image. The positioning template is determined according to the number of characters, the character interval and the size of the characters in the information of the prefix number. After the position of the crown word number information is determined, the binary character area of each character in the crown word number information can be determined. In one embodiment, the located binarized character region is represented by coordinates of the binarized character region, which are used to uniquely locate one character region. Assuming that the character area is a rectangular area, the coordinates of the character area include: the coordinates of the character area, i.e., the coordinates of the upper and lower borders of the rectangle, and the coordinates of the left and right borders of the rectangle. If the character area is a circular area, the coordinates of the character area include: the coordinates of the dots and the size of the radius. Because the binarized image and the target image are in one-to-one correspondence, the corresponding target character area in the target image can be determined after the binarized character area is determined, and particularly, the corresponding target character area can be searched in the target image through the coordinates of the binarized character area.
As shown in fig. 4, in one embodiment, locating the binarized character area of each character in the crown word number information in the binarized image according to the locating template includes:
and 108A, moving the positioning template in the binary image to obtain the current position of the positioning template in the binary image.
The positioning template is moved in the binary image, the position coordinates of each position are obtained, the matching degree of each position and the positioning template is calculated, the target position matched with the positioning template is obtained, and the coordinates of the character area of each character are determined. The current position refers to the position of the current time positioning template in the binary image. The localization template moves in the binarized image with time, so the current position varies with time.
And 108B, calculating the number of first target pixel points contained in the positioning template and the number of second target pixel points contained in the frame of the positioning template at the current position.
The target pixel points are pixel points having the same gray value as the pixel points of the target subject to be identified. After binarization is performed, the pixel points are divided into two types, one type is a target pixel point, and the other type is a non-target pixel point (namely a background). For example, if the gray-scale value of a pixel point of the target subject (character) is 255, all pixels with the gray-scale value of 255 are target pixel points. The positioning template refers to a template with a certain shape and size, and comprises: and (5) a frame. The number of target pixel points included within (not including) the frame of the localization template and the number of target pixel points included on the frame are counted, and for the sake of distinction, the number is referred to as "first target pixel point" and "second target pixel point".
And 108C, calculating to obtain a score corresponding to the current position of the positioning template according to the number of the first target pixel points and the number of the second target pixel points.
And the score corresponding to the current position represents the matching degree of the positioning template and the current position. The larger the score value, the higher the degree of matching. In one embodiment, the difference between the first target pixel point number and the second target pixel point number may be directly taken as the score corresponding to the current position. For the positioning template, in principle, if the position is relatively accurate, the number of target pixels on the frame is as small as possible, and the number of target pixels in the frame is as large as possible. In another embodiment, the positioning template includes a plurality of frames, and because different frames correspond to different noise influences, the weight of each frame may be set, and after the target pixel point number of each frame is obtained through calculation, the second target pixel point number corresponding to the total frame is obtained through calculation in a weighted summation manner. As shown in fig. 5, in one embodiment, the positioning template includes a plurality of frames, wherein the solid lines are horizontal frames and the dotted lines are vertical frames.
And 108D, taking the position with the maximum score as a target position of the positioning template, and positioning a binarization character area of each character in the crown word number information according to the target position.
After the score corresponding to each position is obtained through calculation, the position with the maximum score is used as a target position matched with the positioning template, and after the target position is determined, the coordinates of the binarization character area of each character in the crown word number information can be determined.
In another embodiment, the positioning template includes a plurality of character frames, after the position with the highest score is determined, in order to further ensure the positioning accuracy of the positioning template, the number of target pixel points included in each character frame is calculated respectively, when the number of target pixel points meets the preset point range, the position with the highest score is considered to be in line with the requirement, the position with the highest score is taken as the target position, and when the number of target pixel points does not meet the preset point range, the positioning is not accurate, and the positioning needs to be performed again.
In one embodiment, positioning the template comprises: a character frame corresponding to each character, the character frame being determined according to a size of the character and an interval between the characters; positioning a binarization character area of each character in the crown word number information according to the target position, comprising: and determining a binary character area corresponding to each character in the crown word number information in the binary image according to a character frame contained in the positioning template.
The character box is a box for determining the position of a character. The position of each character is determined by a character box, which is determined according to the size of the character and the interval between the characters. For example, the character has a height of 20 pixels, and in order to completely include the character, the height of the character frame may be set to 22 pixels, and the interval between the characters is 25 pixels, and then the width of the character frame is set to 25 pixels. The positioning template comprises a plurality of character frames, and after the target position is determined, the binarization character area corresponding to each character can be determined. Because the character frames are arranged in the positioning template according to the character intervals, even under the condition that the full-coverage characteristic area is stained, as long as the character intervals of the crown word numbers exist, the area where the crown word numbers are located can be well identified, and the target position of the positioning template can be well positioned.
In one embodiment, performing the second binarization processing on the target character region to obtain a cut region of the corresponding character includes: determining a binarization gray level threshold value corresponding to each target character area according to a preset binarization percentage; performing second binarization processing on the corresponding target character area according to the binarization gray threshold value to obtain a target binarization character area; and performing indentation according to target pixel points forming the characters in the target binarization character area to obtain a cutting area corresponding to each character.
After the target character area corresponding to each character is determined, second binarization processing is performed on each target character area, and the key of the binarization processing is to determine a binarization grayscale threshold (i.e. a grayscale threshold). The binarization gray level threshold value is determined according to a preset binarization percentage, and the binarization percentage is determined according to the pixel proportion of the character, namely the pixel point number of the character and all the pixel point numbers contained in the target character area. In one embodiment, since it is not known which character is before the recognition, the number of pixel points corresponding to the character including the most pixels is used as a numerator, and all pixel points included in the target character region are used as a denominator to determine the preset binarization percentage. And determining a binarization gray level threshold value according to a preset binarization percentage, and then performing binarization processing according to the binarization gray level threshold value to obtain a target binarization character area. Because the target character area is often set to be larger than the characters, after the target binarization character area is obtained, the cutting area corresponding to each character is obtained by retracting according to the target pixel points after binarization. Fig. 6 is a schematic diagram illustrating the region effect corresponding to the characters before and after the indentation in one embodiment, fig. 6A is a schematic diagram illustrating the character region before the indentation, and fig. 6B is a schematic diagram illustrating the character region after the indentation.
In one embodiment, the indenting according to the target pixel points of the constituent characters in the target binarization character region to obtain the cutting region corresponding to each character includes: performing horizontal projection and vertical projection according to target pixel points forming the character to obtain a horizontal indentation range and a vertical indentation range; and indenting the target binarization character area according to the horizontal indentation range and the vertical indentation range to obtain a cutting area corresponding to each character.
The target pixel points forming the characters are subjected to horizontal projection to obtain a horizontal indentation range, and the horizontal indentation range refers to a horizontal coordinate range. And performing vertical projection on target pixel points forming the character to obtain a vertical indentation range, wherein the vertical indentation range refers to a vertical coordinate range. And indenting the binary character area according to the horizontal indentation range and the vertical indentation range to obtain a cutting area corresponding to each character.
In one embodiment, obtaining a target image containing information on a crown word number comprises: intercepting a target area image containing crown word number information from a target image; carrying out first binarization processing on a target image to obtain a binarized image, wherein the first binarization processing comprises the following steps: and carrying out first binarization processing on the target area image to obtain a binarization image corresponding to the target area image.
And intercepting an area containing the information of the crown word number from the target image to be used as a target area image. This facilitates reducing the complexity of subsequent positioning. And when the first binarization processing is subsequently carried out, only the first binarization processing needs to be carried out on the target area image to obtain a binarization image corresponding to the target area image. Since the range of the information of the prefix number is further limited, the complexity of subsequent calculation is favorably reduced.
As shown in fig. 7, in an embodiment, a schematic diagram illustrating an effect after processing a target image by using a method according to an embodiment of the present application is shown. The effect schematic diagram of the target image, the binarized image obtained after the first binarization and the cutting region obtained after the second binarization and the indentation are sequentially shown in the figure. It can be seen that accurate cutting positioning is well performed even in the case of fouling.
As shown in fig. 8, in one embodiment, there is provided a crown cutting positioning device, comprising:
an image obtaining module 802, configured to obtain a target image including information of a prefix number, where the information of the prefix number includes a plurality of characters.
And an image binarization module 804, configured to perform binarization processing on the target image to obtain a binarized image.
And a template obtaining module 806, configured to obtain a location template matching the crown word number information.
A determining module 808, configured to determine, in the target image, a target character region of each character in the crown word number information according to the positioning template and the binarized image.
And a character region binarization module 810, configured to perform second binarization processing on the target character region to obtain a cutting region of the corresponding character.
In one embodiment, the determining module is further configured to locate a binarized character region of each character in the crown word number information in the binarized image according to the locating template; and determining a corresponding target character area in the target image according to the binarization character area.
As shown in fig. 9, in one embodiment, the determining module 808 includes:
a current position obtaining module 808A, configured to move the positioning template in the binarized image, and obtain a current position of the positioning template in the binarized image.
The point number calculating module 808B is configured to calculate a first target pixel point number included in the positioning template and a second target pixel point number included in a frame of the positioning template at the current position.
And the score calculating module 808C is configured to calculate a score corresponding to the current position of the positioning template according to the number of the first target pixel points and the number of the second target pixel points.
And a character area positioning module 808D, configured to use the position with the largest score as the target position of the positioning template, and position a binarization character area of each character in the prefix number information according to the target position.
In one embodiment, the locating template comprises: a character frame corresponding to each character, the character frame being determined according to the character size and an interval between characters; the determining module 808 is further configured to determine a binarized character area corresponding to each character in the crown word number information in the binarized image according to the character frame included in the positioning template.
In one embodiment, the character region binarization module 810 is further configured to determine a binarization grayscale threshold corresponding to each target character region according to a preset binarization percentage; performing second binarization processing on the corresponding target character area according to the binarization gray threshold value to obtain a target binarization character area; and performing indentation according to target pixel points forming the characters in the target binarization character area to obtain a cutting area corresponding to each character.
In one embodiment, the character region binarization module 810 is further configured to perform horizontal projection and vertical projection according to target pixel points forming the character, so as to obtain a horizontal indentation range and the vertical indentation range; and indenting the target binarization character area according to the horizontal indentation range and the vertical indentation range to obtain a cutting area corresponding to each character.
In one embodiment, the image obtaining module 802 is further configured to intercept a target area image containing information of a crown word number from the target image; the image binarization module 804 is further configured to perform first binarization processing on the target area image to obtain a binarized image corresponding to the target area image.
FIG. 10 is a diagram illustrating an internal structure of a computer device in one embodiment. The computer device may specifically be a server. As shown in fig. 10, the computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and also stores a computer program, and when the computer program is executed by a processor, the computer program can enable the processor to realize the crown cutting and positioning method. The internal memory may also have a computer program stored therein, which when executed by the processor, causes the processor to perform the crown word cutting and locating method. Those skilled in the art will appreciate that the architecture shown in fig. 10 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, the crown word number cutting and positioning method provided by the present application can be implemented in the form of a computer program, and the computer program can be run on a computer device as shown in fig. 10. The memory of the computer device can store various program modules which form the crown word number cutting and positioning device. Such as the image acquisition module 802, the image binarization module 804, the template acquisition module 806, the determination module 808, and the character region binarization module 810 in fig. 8.
In one embodiment, a computer device is proposed, comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of: acquiring a target image containing crown word number information, wherein the crown word number information comprises a plurality of characters; performing first binarization processing on the target image to obtain a binarized image; acquiring a positioning template matched with the crown word number information; determining a target character area of each character in the crown word number information in the target image according to the positioning template and the binary image; and carrying out second binarization processing on the target character area to obtain a cutting area of the corresponding character.
In one embodiment, the determining a target character region of each character in the crown word number information in the target image according to the positioning template and the binarized image includes: positioning a binarization character area of each character in the crown word number information in the binarization image according to the positioning template; and determining a corresponding target character area in the target image according to the binarization character area.
In one embodiment, the locating the binarized character region of each character in the crown word number information in the binarized image according to the locating template includes: moving the positioning template in the binarized image to obtain the current position of the positioning template in the binarized image; calculating the number of first target pixel points contained in the positioning template and the number of second target pixel points contained in the frame of the positioning template at the current position; calculating to obtain a score corresponding to the current position of the positioning template according to the number of the first target pixel points and the number of the second target pixel points; and taking the position with the maximum score as the target position of the positioning template, and positioning a binarization character area of each character in the prefix number information according to the target position.
In one embodiment, the locating template comprises: a character frame corresponding to each character, the character frame being determined according to the character size and an interval between characters; the positioning of the binarization character area of each character in the crown word number information in the binarization image according to the positioning template comprises the following steps: and determining a binarization character area corresponding to each character in the crown word number information in a binarization image according to a character frame contained in the positioning template.
In an embodiment, the performing a second binarization process on the target character region to obtain a cut region of a corresponding character includes: determining a binarization gray level threshold value corresponding to each target character area according to a preset binarization percentage; performing second binarization processing on the corresponding target character area according to the binarization gray threshold value to obtain a target binarization character area; and performing indentation according to target pixel points forming the characters in the target binarization character area to obtain a cutting area corresponding to each character.
In an embodiment, the indenting according to the target pixel points forming the characters in the target binarization character region to obtain a cutting region corresponding to each character includes: performing horizontal projection and vertical projection according to target pixel points forming the character to obtain a horizontal indentation range and a vertical indentation range; and indenting the target binarization character area according to the horizontal indentation range and the vertical indentation range to obtain a cutting area corresponding to each character.
In one embodiment, the acquiring the target image containing the information of the crown word number comprises: intercepting a target area image containing crown word number information from the target image; the first binarization processing is performed on the target image to obtain a binarized image, and the method comprises the following steps: and carrying out first binarization processing on the target area image to obtain a binarization image corresponding to the target area image.
In one embodiment, a computer-readable storage medium is proposed, in which a computer program is stored which, when executed by a processor, causes the processor to carry out the steps of: acquiring a target image containing crown word number information, wherein the crown word number information comprises a plurality of characters; performing first binarization processing on the target image to obtain a binarized image; acquiring a positioning template matched with the crown word number information; determining a target character area of each character in the crown word number information in the target image according to the positioning template and the binary image; and carrying out second binarization processing on the target character area to obtain a cutting area of the corresponding character.
In one embodiment, the determining a target character region of each character in the crown word number information in the target image according to the positioning template and the binarized image includes: positioning a binarization character area of each character in the crown word number information in the binarization image according to the positioning template; and determining a corresponding target character area in the target image according to the binarization character area.
In one embodiment, the locating the binarized character region of each character in the crown word number information in the binarized image according to the locating template includes: moving the positioning template in the binarized image to obtain the current position of the positioning template in the binarized image; calculating the number of first target pixel points contained in the positioning template and the number of second target pixel points contained in the frame of the positioning template at the current position; calculating to obtain a score corresponding to the current position of the positioning template according to the number of the first target pixel points and the number of the second target pixel points; and taking the position with the maximum score as the target position of the positioning template, and positioning a binarization character area of each character in the prefix number information according to the target position.
In one embodiment, the locating template comprises: a character frame corresponding to each character, the character frame being determined according to the character size and an interval between characters; the positioning of the binarization character area of each character in the crown word number information in the binarization image according to the positioning template comprises the following steps: and determining a binarization character area corresponding to each character in the crown word number information in a binarization image according to a character frame contained in the positioning template.
In an embodiment, the performing a second binarization process on the target character region to obtain a cut region of a corresponding character includes: determining a binarization gray level threshold value corresponding to each target character area according to a preset binarization percentage; performing second binarization processing on the corresponding target character area according to the binarization gray threshold value to obtain a target binarization character area; and performing indentation according to target pixel points forming the characters in the target binarization character area to obtain a cutting area corresponding to each character.
In an embodiment, the indenting according to the target pixel points forming the characters in the target binarization character region to obtain a cutting region corresponding to each character includes: performing horizontal projection and vertical projection according to target pixel points forming the character to obtain a horizontal indentation range and a vertical indentation range; and indenting the target binarization character area according to the horizontal indentation range and the vertical indentation range to obtain a cutting area corresponding to each character.
In one embodiment, the acquiring the target image containing the information of the crown word number comprises: intercepting a target area image containing crown word number information from the target image; the first binarization processing is performed on the target image to obtain a binarized image, and the method comprises the following steps: and carrying out first binarization processing on the target area image to obtain a binarization image corresponding to the target area image.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a non-volatile computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the program is executed. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A crown word number cutting and positioning method is characterized by comprising the following steps:
acquiring a target image containing crown word number information, wherein the crown word number information comprises a plurality of characters;
performing first binarization processing on the target image to obtain a binarized image;
acquiring a positioning template matched with the crown word number information;
determining a target character area of each character in the crown word number information in the target image according to the positioning template and the binary image;
and carrying out second binarization processing on the target character area to obtain a cutting area of the corresponding character.
2. The method according to claim 1, wherein the determining a target character area of each character in the crown word number information in the target image according to the positioning template and the binarized image comprises:
positioning a binarization character area of each character in the crown word number information in the binarization image according to the positioning template;
and determining a corresponding target character area in the target image according to the binarization character area.
3. The method according to claim 2, wherein the locating the binarized character area of each character in the crown word number information in the binarized image according to the locating template comprises:
moving the positioning template in the binarized image to obtain the current position of the positioning template in the binarized image;
calculating the number of first target pixel points contained in the positioning template and the number of second target pixel points contained in the frame of the positioning template at the current position;
calculating to obtain a score corresponding to the current position of the positioning template according to the number of the first target pixel points and the number of the second target pixel points;
and taking the position with the maximum score as the target position of the positioning template, and positioning a binarization character area of each character in the prefix number information according to the target position.
4. The method of claim 3, wherein the positioning the template comprises: a character frame corresponding to each character, the character frame being determined according to the character size and an interval between characters;
the positioning of the binarization character area of each character in the crown word number information in the binarization image according to the positioning template comprises the following steps:
and determining a binarization character area corresponding to each character in the crown word number information in a binarization image according to a character frame contained in the positioning template.
5. The method according to claim 1, wherein the performing a second binarization process on the target character region to obtain a cut region of a corresponding character comprises:
determining a binarization gray level threshold value corresponding to each target character area according to a preset binarization percentage;
performing second binarization processing on the corresponding target character area according to the binarization gray threshold value to obtain a target binarization character area;
and performing indentation according to target pixel points forming the characters in the target binarization character area to obtain a cutting area corresponding to each character.
6. The method according to claim 5, wherein the indenting according to the target pixel points constituting the character in the target binarized character region to obtain a cutting region corresponding to each character comprises:
performing horizontal projection and vertical projection according to target pixel points forming the character to obtain a horizontal indentation range and a vertical indentation range;
and indenting the target binarization character area according to the horizontal indentation range and the vertical indentation range to obtain a cutting area corresponding to each character.
7. The method of claim 1, wherein obtaining the target image containing the information of the crown word number comprises:
intercepting a target area image containing crown word number information from the target image;
the first binarization processing is performed on the target image to obtain a binarized image, and the method comprises the following steps:
and carrying out first binarization processing on the target area image to obtain a binarization image corresponding to the target area image.
8. A crown word number cutting and positioning device, characterized in that the device comprises:
the image acquisition module is used for acquiring a target image containing crown word number information, and the crown word number information comprises a plurality of characters;
the image binarization module is used for carrying out first binarization processing on the target image to obtain a binarization image;
the template acquisition module is used for acquiring a positioning template matched with the crown word number information;
the determining module is used for determining a target character area of each character in the crown word number information in the target image according to the positioning template and the binary image;
and the character area binarization module is used for carrying out second binarization processing on the target character area to obtain a cutting area of the corresponding character.
9. A computer-readable storage medium, storing a computer program which, when executed by a processor, causes the processor to carry out the steps of the method according to any one of claims 1 to 7.
10. A computer device comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method according to any one of claims 1 to 7.
CN201811072862.XA 2018-09-13 2018-09-13 Method and device for cutting and positioning crown word number, computer equipment and storage medium Pending CN110895849A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811072862.XA CN110895849A (en) 2018-09-13 2018-09-13 Method and device for cutting and positioning crown word number, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811072862.XA CN110895849A (en) 2018-09-13 2018-09-13 Method and device for cutting and positioning crown word number, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110895849A true CN110895849A (en) 2020-03-20

Family

ID=69785636

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811072862.XA Pending CN110895849A (en) 2018-09-13 2018-09-13 Method and device for cutting and positioning crown word number, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110895849A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112990150A (en) * 2021-05-10 2021-06-18 恒银金融科技股份有限公司 Method for measuring upper and lower boundaries of crown word number based on projection bidirectional accumulation sum
CN117710987A (en) * 2024-02-06 2024-03-15 武汉卓目科技有限公司 Crown word size segmentation method, device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2000070540A1 (en) * 1999-05-13 2000-11-23 Currency Systems International Partial ocr note confirmation methods
JP2009116798A (en) * 2007-11-09 2009-05-28 Fuji Xerox Co Ltd Forgery monitoring system, server, reader and printer
CN106022346A (en) * 2016-05-24 2016-10-12 深圳怡化电脑股份有限公司 Banknote number cutting method and device
CN106296969A (en) * 2016-08-18 2017-01-04 深圳怡化电脑股份有限公司 The recognition methods of bank note and system
CN107358718A (en) * 2017-07-10 2017-11-17 深圳怡化电脑股份有限公司 A kind of crown word number identification method, device, equipment and storage medium
CN108510636A (en) * 2018-03-27 2018-09-07 深圳怡化电脑股份有限公司 Image partition method, image segmentation device and terminal device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2000070540A1 (en) * 1999-05-13 2000-11-23 Currency Systems International Partial ocr note confirmation methods
JP2009116798A (en) * 2007-11-09 2009-05-28 Fuji Xerox Co Ltd Forgery monitoring system, server, reader and printer
CN106022346A (en) * 2016-05-24 2016-10-12 深圳怡化电脑股份有限公司 Banknote number cutting method and device
CN106296969A (en) * 2016-08-18 2017-01-04 深圳怡化电脑股份有限公司 The recognition methods of bank note and system
CN107358718A (en) * 2017-07-10 2017-11-17 深圳怡化电脑股份有限公司 A kind of crown word number identification method, device, equipment and storage medium
CN108510636A (en) * 2018-03-27 2018-09-07 深圳怡化电脑股份有限公司 Image partition method, image segmentation device and terminal device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112990150A (en) * 2021-05-10 2021-06-18 恒银金融科技股份有限公司 Method for measuring upper and lower boundaries of crown word number based on projection bidirectional accumulation sum
CN117710987A (en) * 2024-02-06 2024-03-15 武汉卓目科技有限公司 Crown word size segmentation method, device, electronic equipment and storage medium
CN117710987B (en) * 2024-02-06 2024-06-11 武汉卓目科技有限公司 Crown word size segmentation method, device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110766014B (en) Bill information positioning method, system and computer readable storage medium
CN108710866B (en) Chinese character model training method, chinese character recognition method, device, equipment and medium
CN110659647B (en) Seal image identification method and device, intelligent invoice identification equipment and storage medium
CN109740606B (en) Image identification method and device
CN110619333B (en) Text line segmentation method, text line segmentation device and electronic equipment
CN109063706A (en) Verbal model training method, character recognition method, device, equipment and medium
CN110751500B (en) Processing method and device for sharing pictures, computer equipment and storage medium
CN106326887B (en) A kind of method of calibration and device of optical character identification result
CN109934262B (en) Picture variability judging method, device, computer equipment and storage medium
CN110490190B (en) Structured image character recognition method and system
CN110503682B (en) Rectangular control identification method and device, terminal and storage medium
CN112001406B (en) Text region detection method and device
CN111368638A (en) Spreadsheet creation method and device, computer equipment and storage medium
CN111739020B (en) Automatic labeling method, device, equipment and medium for periodic texture background defect label
CN109389110B (en) Region determination method and device
CN112580499A (en) Text recognition method, device, equipment and storage medium
CN112926564A (en) Picture analysis method, system, computer device and computer-readable storage medium
CN110674811A (en) Image recognition method and device
CN110895849A (en) Method and device for cutting and positioning crown word number, computer equipment and storage medium
CN111553431A (en) Picture definition detection method and device, computer equipment and storage medium
CN113420580B (en) Method and device for positioning auxiliary locator of two-dimensional code, two-dimensional code scanning equipment and storage medium
CN114049540A (en) Method, device, equipment and medium for detecting marked image based on artificial intelligence
CN113256644A (en) Bill image segmentation method, device, medium, and apparatus
CN109726722B (en) Character segmentation method and device
CN109101973B (en) Character recognition method, electronic 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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200320